21 #include "SheafSystem/field_vd.h" 23 #include "SheafSystem/arg_list.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/base_space_member.h" 26 #include "SheafSystem/block.impl.h" 27 #include "SheafSystem/chart_point.h" 28 #include "SheafSystem/discretization_iterator.h" 29 #include "SheafSystem/discretization_pusher.h" 30 #include "SheafSystem/error_message.h" 31 #include "SheafSystem/eval_family.h" 32 #include "SheafSystem/field_eval_iterator.h" 33 #include "SheafSystem/hash_index_space_state.h" 34 #include "SheafSystem/name_multimap.h" 35 #include "SheafSystem/namespace_poset_member.h" 36 #include "SheafSystem/poset_path.h" 37 #include "SheafSystem/print_property_dofs_action.h" 38 #include "SheafSystem/property_disc_iterator.h" 39 #include "SheafSystem/put_property_dofs_fcn_action.h" 40 #include "SheafSystem/sec_at1_space.h" 41 #include "SheafSystem/sec_ed_invertible.h" 42 #include "SheafSystem/sec_rep_descriptor.h" 43 #include "SheafSystem/sec_vd_space.h" 44 #include "SheafSystem/section_evaluator.h" 45 #include "SheafSystem/section_pusher.h" 46 #include "SheafSystem/section_space_schema_poset.h" 47 #include "SheafSystem/structured_block_1d.h" 48 #include "SheafSystem/structured_block_2d.h" 49 #include "SheafSystem/structured_block_3d.h" 50 #include "SheafSystem/subposet.h" 74 ensure(!is_attached());
88 xother.state_is_read_accessible());
99 ensure(coordinates().is_same_state(&xother.
coordinates()));
100 ensure(property().is_same_state(&xother.
property()));
101 ensure(base_space().is_same_state(&xother.
base_space()));
130 _property = xproperty.
clone(
false,
false);
146 ensure(coordinates().is_same_state(&xcoordinates));
147 ensure(property().is_same_state(&xproperty));
166 require(xauto_access ||
169 require(xauto_access ||
183 _property =
new sec_vd(&xns, xproperty_path, xauto_access);
187 _coordinates->get_read_access();
188 _property->get_read_access();
198 _property->release_access();
204 ensure(coordinates().path(
true) == xcoordinates_path);
205 ensure(property().path(
true) == xproperty_path);
217 : _property(xproperty), _coordinates(xcoordinates), _base_space(xbase_space)
422 require(xproperty_dofs.
ct() > 0);
430 for(
int i= 0; i<xglobal_coords.
ct(); ++i)
432 lprop_dof0 += xglobal_coords[i]*lfactor;
437 for(
int i=1; i<xproperty_dofs.
ct(); ++i)
439 xproperty_dofs[i] = 0.0;
444 ensure_for_all(i, 1, xproperty_dofs.
ct(), xproperty_dofs[i] == 0.0);
459 require(xdof_fcn != 0);
501 require(xdof_fcn != 0);
503 define_old_variable(
int old_coordinates_access_request_depth = xcoordinates.
access_request_depth());
514 int ldc = xcoordinates.
schema().
df();
552 lcoords[c] = lcontext.
values[c];
557 xdof_fcn(lcoords, ldofs);
641 define_old_variable(
int old_coordinates_access_request_depth = xcoordinates.
access_request_depth());
652 int ldc = xcoordinates.
schema().
df();
690 lcoords[c] = lcontext.
values[c];
695 xproperty_dofs_action(lcontext.
disc_id, lcoords);
725 const std::string& xtitle_text,
726 bool xzero_specified,
727 bool xauto_access)
const 744 for(
int i=0; i<8; ++i)
750 if(!xtitle_text.empty())
752 xos << xtitle_text << endl << endl;
763 for(
int i=0; i<8; ++i)
955 for(
int i=0; i<
dp(); i++)
987 require(!
base_space().host()->includes_subposet(xresult_name,
false));
988 require(
property().schema().rep().name() ==
"element_element_constant");
989 require(
property().schema().evaluation().has_id_space());
990 require(unexecutable(
"Lower cover of property() base space contains only zones."));
991 require(unexecutable(
"property value positive"));
1002 result->
put_name(xresult_name,
true,
false);
1032 lresult_mbr_client_id =
1037 lresult_mbr_id = lresult_space.
hub_pod(lresult_mbr_client_id);
1044 lresult_mbr_id = lbase_host->
new_member(
false);
1048 string lresult_mbr_name = xresult_member_names.
name(lresult_mbr_client_id);
1049 if(!lresult_mbr_name.empty())
1051 lbase_host->
put_member_name(lresult_mbr_id, lresult_mbr_name,
true,
false);
1057 lresult_space.
insert(lresult_mbr_client_id, lresult_mbr_id);
1062 lbase_host->
new_link(lbase_id, lresult_mbr_id);
1067 lbase_host->
new_link(lresult_mbr_id, lzone_id.pod());
1075 lbase_host->
delete_link(lbase_id, lzone_id.pod());
1084 ensure(result != 0);
1085 ensure(result->
name() == xresult_name);
1086 ensure(
base_space().host()->includes_subposet(xresult_name,
false));
1102 bool xdelete_coord_fiber,
1103 bool xdelete_prop_fiber)
1122 while(!lmbr_itr.is_done())
1124 lmbr.attach_to_state(lmbr_itr.index());
1126 if(lmbr.is_jim(
false))
1134 lin_links[lprereq_id].insert(lmbr.index().pod());
1141 lmbr.detach_from_state();
1164 lin_links[lprop_schema_host_index].erase(lprop_host_index);
1168 if(lin_links[lprop_schema_host_index].empty())
1175 lin_links[lprop_fiber_space_index].erase(lprop_schema_host_index);
1176 lin_links[lbase_host_index].erase(lprop_schema_host_index);
1180 if(lin_links[lprop_fiber_space_index].empty() && xdelete_prop_fiber)
1190 lin_links[lcoord_schema_host_index].erase(lcoord_host_index);
1194 if(lin_links[lcoord_schema_host_index].empty())
1199 lin_links[lcoord_fiber_space_index].erase(lcoord_schema_host_index);
1200 lin_links[lbase_host_index].erase(lcoord_schema_host_index);
1204 if(lin_links[lcoord_fiber_space_index].empty() && xdelete_coord_fiber)
1212 if(lin_links[lbase_host_index].empty())
1502 result = lcoord_depth < lprop_depth ? lcoord_depth : lprop_depth;
1506 ensure(result >= 0);
1689 ensure(!result.empty());
1705 static const string result(
"field_vd");
1709 ensure(!result.empty());
1724 require(xother != 0);
1730 bool result =
dynamic_cast<const field_vd*
>(xother) != 0;
1752 ensure(result != 0);
1801 lproperty = xsection;
1946 require(precondition_of(
push(xsrc, xdst,
true)));
1950 push(xsrc, xdst,
true);
1954 ensure(postcondition_of(
push(xsrc, xdst,
true)));
1985 #include "SheafSystem/field_vd_funcs.impl.h" virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
poset_state_handle * host() const
The poset which this is a handle to a component of.
virtual void delete_link(pod_index_type xgreater, pod_index_type xlesser)
Delete the cover link between hub id xgreater and hub id xlesser.
A context for discretization members. Intended for implementing various iterators, especially concurrent iterations over multiple sections.
virtual void get_read_write_access(bool xbase_access, bool xrelease_read_only_access)
Get read write access to the coordinates and property sections, which implies read access to the base...
A client handle for a subposet.
scoped_index disc_id
The global index of the disc member.
bool state_is_not_read_only_accessible() const
True if this is attached and if the coordinates and property are not accessible for read only access ...
bool state_is_not_read_only_accessible() const
True if this is attached and the state is not accessible for read only access.
host_type * host() const
The poset this is a member of.
virtual field_vd & operator=(const field_vd &xother)
Assignment operator.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
virtual void new_link(pod_index_type xgreater, pod_index_type xlesser)
Insert a cover link from greater to lesser (that is, hub id xgreater covers hub id xlesser)...
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
void print_property_dofs(std::ostream &xos, property_dof_function_type xproperty_dofs_fcn, const std::string &xtitle_text, bool xzero_specified, bool xauto_access) const
Prints the property dofs and coordinates at the property discretization points. If xproperty_dof_fcn ...
size_type ct() const
The number of items currently in use.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
A push-forward operator for discretization subposets; pushes members into the global coordinate space...
bool state_is_read_write_accessible(bool xbase_access=false) const
True if this is attached and if coordinates(), property() and (if xbase access) base_space() are acce...
void(* property_dof_function_type)(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
The type of the function for computing the property dofs at given global coordinates.
virtual void get_prop_disc_values(const sec_vd &xsec)=0
The gets the values of xsec at the property discretization points.
int db() const
The dimension of the base space.
static void property_dof_function_example(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
Example property dof function; property value is x*1000000 + y*1000 + z, intended to be easy to check...
virtual const std::string & class_name() const
The name of this class.
const scoped_index & index() const
The member index of this poset within the namespace host()
schema_poset_member & fiber_schema()
The fiber schema component of this (mutable version).
A point in a 3D chart space.
namespace_poset & name_space() const
The namespace this resides in.
subposet * embed_property(const std::string &xresult_name, name_multimap &xresult_member_names, bool xauto_access)
Creates a decomposition of the base space such that the value of property() is constant on each membe...
Namespace for fields component of sheaf system.
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
void get_fiber(pod_index_type xdisc_id, vd_lite &xfiber) const
Sets xfiber to the fiber referred to by discretization id xdisc_id.
base_space_member * _base_space
The base space of this field.
virtual void get_read_access() const
Get read access to the state associated with this.
virtual void initialize_point_locator(bool xauto_access)
Initializes point locater search structure using default values.
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
bool contains_poset_member(pod_index_type xposet_hub_id, pod_index_type xmember_hub_id, bool xauto_access=true) const
True if this contains a poset with hub id xposet_hub_id which contains a member with hub id xmember_h...
A client handle for a general, abstract partially order set.
int dc() const
The dimension of the coordinates (independent variable) space.
virtual void value_at_point_ua(const chart_point &xpt, value_type *xresult, size_type xresult_ub, bool xauto_access=true) const
Value of the field at xpt, unattached version.
static const std::string & static_class_name()
The name of this class.
virtual field_vd * clone() const
Virtual constructor, makes a new instance of the same type as this.
bool state_is_not_read_write_accessible() const
True if state is attached and if not accessible for read and write or access control is disabled...
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
const section_space_schema_member & property_schema() const
The property field schema member which is being iterated over.
virtual ~field_vd()
Destructor.
bool same_property_fiber_schema(const field_vd &xother, bool xauto_access) const
True if this has the same property fiber as xother.
virtual bool contains_member(pod_index_type xmbr_hub_id) const
True if this poset contains poset member with hub id xmbr_hub_id.
A partial multi-valued relation with total injective inverse between names and indices of type index_...
bool is_same_state(const poset_state_handle *xhost, pod_index_type xhub_id) const
True is this is attached to state with hub id xhub_id in host xhost.
virtual void point_at_value_ua(const sec_vd_dof_type *xvalue, size_type xvalue_ub, chart_point &xresult)
Finds a chart point which is the preimage in this of xvalue; unattached version.
tuple * clone(bool xnew_state, bool xauto_access=true) const
Make a new handle instance of current. Attach the new instance to a new state if xnew_state is true...
virtual void get_read_access() const
Get read access to the state associated with this.
host_type * host() const
The poset this is a member of.
poset_state_handle & member_poset(pod_index_type xhub_id, bool xauto_access=true) const
The poset_state_handle object referred to by hub id xhub_id.
virtual namespace_poset * name_space() const
The namespace of host()
virtual bool invariant() const
Class invariant.
const scoped_index & index() const
The index of the component state this handle is attached to.
void property_at_coordinates(const vd_lite &xcoord, vd_lite &xprop) const
The value of the property at the given global coordinates.
std::string name() const
A name for this.
SHEAF_DLL_SPEC field_at0 & operator>>(const field_at0 &xsrc, field_at0 &xdst)
Pushes xsrc.property() to xdst.property().
virtual void put_member_name(pod_index_type xmbr_hub_id, const std::string &xname, bool xunique, bool xauto_access=false)
Make xname a name for the member with hub id xmbr_hub_id. if xunique, make xname the only name...
void clear_state_is_modified()
Sets the state_is_modified floag to false.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual pod_index_type new_member(bool xis_jim, pod_index_type xtuple_hub_id)
Create a disconnected member with is_jim == xis_jim and the dof tuple identified by hub id xtuple_hub...
bool same_discretization() const
True if the coordinates and property sections both use the same discretization subposet.
sec_vd & property()
The property section being acted on.
A client handle for a member of a base space poset.
void push_pa(const sec_vd &xinput, sec_vd &result, bool xauto_access)
Pushes field xinput from sec_rep_space domain() to sec_rep_space range(), pre-allocated.
A client handle for a member of a namespace poset.
bool is_valid() const
True if this ia a valid point in a chart.
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
A section of a fiber bundle with a d-dimensional Euclidean vector space fiber.
Abstract base class with useful features for all objects.
poset & fiber_space()
The fiber space for section spaces on this schema.
Abstract vector space over dof_type (volatile version).
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
virtual void put_name(const std::string &xname, bool xunique, bool xauto_access)
Make xname a name for this; if xunique, make xname the only name.
void clear_state_is_modified()
Sets the state_is_modified floag to false.
An abstract invertible section of a fiber bundle with a d-dimensional base space and a d-dimensional ...
namespace_poset_member & top()
The top member of the poset (mutable version)
bool state_is_read_write_accessible() const
True if this is attached and if the state is accessible for read and write or access control is disab...
poset * host() const
The poset which this is a handle to a member of.
pointer_type base() const
The underlying storage array.
virtual int d() const
Dimension of this as a vector space.
void set_ct(size_type xct)
Sets ct() == xct.
virtual scattered_insertion_index_space_handle & new_id_space(const std::string &xstate_class_name)
Creates an id space for the members of this.
An index within the external ("client") scope of a given id space.
SHEAF_DLL_SPEC void push(const field_vd &xsrc, field_vd &xdst, bool xauto_access)
Pushes xsrc.property() to xdst.property().
virtual bool is_attached() const
True if this handle is attached to a non-void state.
virtual void get_read_access() const
Get read access to the state associated with this.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
property_disc_iterator * new_property_disc_iterator() const
Iterator over property discretiation.
A member of a Cartesian product space; a tuple of attributes (volatile version).
int access_request_depth() const
The number of times access has been requested and granted without being released. ...
bool state_is_modified() const
True if write access has been granted and released since the last call to clear_state_is_modified().
virtual void insert_member(pod_index_type xmbr_hub_id)
Inserts the member of host() with hub id xmbr_hub_id.
A vd-valued property as a function of global coordinates.
bool cover_is_empty(bool xlower, pod_index_type xmbr_hub_id) const
True if and only if the lower (xlower true) or upper (xlower false) cover set of the member with hub ...
sec_vd & property() const
The dependent variable of this field.
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
void push(const section_space_schema_member &xsrc, const sec_vd &xglobal_coord, discretization_push_action &xpush_action, bool xauto_access)
Pushes each member of the discretization of xsrc into the fiber space of xglobal_coord and then execu...
vd_dof_type dof_type
The type of the degrees of freedom.
void insert(pod_type xid, const scoped_index &xhub_id)
Make id xid in this id space equivalent to xhub_id in the hub id space. synonym for insert(xid...
void next()
Makes this the next member of the subset.
subposet & discretization()
The discretization subposet for section spaces on this schema (mutable version).
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
void delete_poset(pod_index_type xhub_id, bool xauto_access)
Delete the poset with hub id xhub_id.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &xos, const field_at0 &xfield)
Inserts field_at0 xfield into ostream xos.
sec_vd_value_type values[values_ub]
The values of another section (typically the global coordinates) at this disc point.
base_space_member & base_space() const
The base space of this field.
const block< discretization_context > & property_discretization_members() const
The property discretization members in the downset of the current evaluation member.
The general section push-forward operator; moves sections from one sec_rep_space to another using ext...
A section of a fiber bundle with a d-dimensional vector space fiber.
const hub_index_space_handle & member_hub_id_space(bool xauto_access) const
The member hub id space.
bool is_done() const
True if iteration finished.
virtual void end_jim_edit_mode(bool xensure_lattice_invariant=true, bool xauto_access=true)
prevent editing of jims and jim order relation
Iterates over the subset of Zn defined by the characteristic function host().
void detach_from_state()
Detaches field from state it is currently attached to.
bool same_evaluation() const
True if the coordinates and property sections both use the same evaluation subposet.
const bool LOWER
Selector for lower cover.
base_space_member * clone(bool xnew_state, bool xauto_access=true) const
Make a new handle instance of current. Attach the new instance to a new state if xnew_state is true...
virtual void detach_from_state()
Detach this handle from its state, if any.
pod_type hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space; synonym for unglued_hub...
void put_property_dofs(property_dof_function_type xproperty_dofs_fcn, bool xauto_access)
Sets the dofs of property() to values computed by xproperty_dofs_fcn.
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
int access_request_depth() const
The number of times access has been requested and granted without being released. ...
bool invariant_check() const
True if invariant checking is enabled.
virtual bool is_attached() const
True if this handle has a state associated with it.
An abstract discretization push action for field_vds::put_property_dofs.
bool state_is_not_read_accessible() const
True if this is attached and if the coordinates and property are not accessible for read or access co...
total_poset_member & base_space()
The base space component of this (mutable version).
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
static bool access_control_disabled()
True if access control mechanism is disabled. Default value is enabled (false) and access is controll...
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
int_type pod_index_type
The plain old data index type.
sec_ed_invertible * _coordinates
The independent variable of this field.
static property_disc_iterator * new_property_disc_iterator(const section_space_schema_member &xcoords_schema, const section_space_schema_member &xprop_schema)
Creates an iterator appropriate for xcoords and xprop.
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
virtual sec_ed_invertible * clone() const
Make a new handle, no state instance of current.
A handle for a scattered_insertion_index_space_state.
static void enable_access_control()
Enables access control. Synonym for read_write_monitor::enable_access_control(). Should only be invok...
int db() const
The dimension of the base space component.
sec_ed_invertible & coordinates() const
The independent variable of this field.
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
bool state_is_read_accessible() const
True if this is attached and if the coordinates and property are accessible for read or access contro...
virtual sec_vd * clone() const
Make a new handle, no state instance of current.
bool state_is_not_read_write_accessible(bool xbase_access=false) const
True if this is not attached or if coordinates(), property() or (if xbase access) base_space() are no...
const section_space_schema_member & coordinates_schema() const
The coordinates field schema member which is being iterated over.
int df() const
The dimension of the fiber space component.
virtual void delete_member(pod_index_type xmbr_hub_id)
Delete the member with hub id xmbr_hub_id. Warning: this routine does not delete links; it will leave...
int dp() const
The dimension of the property (dependent variable) space.
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
pod_index_type first_cover_member(bool xlower, pod_index_type xmbr_hub_id) const
Hub id of the first member of the lower (xlower true) or upper (xlower false) cover of the member wit...
static void delete_field_spaces(field_vd *xfield, bool xdelete_coord_fiber, bool xdelete_prop_fiber)
Deletes field xfield and all associated section spaces, section schema spaces, and base space...
std::string name(index_type xindex) const
The primary (0-th) name associated with index xindex.
index_iterator member_iterator() const
double sec_vd_dof_type
The type of degree of freedom in the section space.
sec_vd * _property
The dependent variable of this field.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
bool is_same_type(const any *other) const
True if other is the same type as this.
Abstract vector space over dof_type.
void enable_invariant_check() const
Enable invariant checking.
bool state_is_read_only_accessible() const
True if this is attached and if the coordinates and property are accessible for read access but not f...
static void enable_access_control()
Enables access control. Should only be invoked once at beginning of a program, before any other Sheaf...
bool state_is_not_read_accessible() const
True if this is attached and if the state is accessible for read or if access control is disabled...
bool state_is_read_only_accessible() const
True if this is attached and the state is accessible for read access but not for write.
field_vd()
Default constructor.
Abstract iterator over the discretization of the property section of a field_vd. Concurrently travers...
static bool access_control_disabled()
True if access control mechanism is disabled. Default value is enabled (false) and access is controll...
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
A client handle for an unrestricted member of a poset. A total_poset_member is guaranteed not to be r...
A discretization push action for field_vds::print_property_dofs.
virtual void begin_jim_edit_mode(bool xauto_access=true)
Allow editing of jims and jim order relation.
const int PREREQ_IDS_UB
Number of prerequisites ids. Must be consistent with PREREQ_ID_*_INDEX below.
virtual const scoped_index & member_id(bool xauto_access) const
An id in the member hub id space; intended for copying to initialize ids to the member id space...
bool state_is_modified() const
True if write access has been granted and released since the last call to clear_state_is_modified().