21 #include "SheafSystem/section_space_schema_member.impl.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/array_index_space_state.h" 25 #include "SheafSystem/cover_set_iterator.h" 26 #include "SheafSystem/discretization_iterator.h" 27 #include "SheafSystem/index_space_iterator.h" 28 #include "SheafSystem/scattered_insertion_index_space_handle.h" 29 #include "SheafSystem/namespace_poset.h" 30 #include "SheafSystem/sec_rep_descriptor.h" 31 #include "SheafSystem/section_space_schema_poset.h" 32 #include "SheafSystem/sheaves_namespace.h" 33 #include "SheafSystem/std_set.h" 52 const string& result = static_class_name();
56 ensure(!result.empty());
71 static const string result(
"section_space_schema_member");
75 ensure(!result.empty());
90 attach_to_state(&xother);
94 ensure(is_same_state(&xother));
108 require(is_ancestor_of(&xother));
131 _base_space.detach_from_state();
132 _fiber_schema.detach_from_state();
134 if(_discretization_id_space != 0)
136 _discretization_id_space->release_id_space(*_discretization_id_space);
152 require(is_attached());
171 require(is_attached());
192 require(is_attached());
197 result = rep().is_same_state(&xother.
rep());
211 return _base_space_id;
220 require(is_factorable());
224 result.
put(_base_space.hub_id_space(), _base_space_id);
228 ensure(result.
same_scope(base_space().hub_id_space()));
241 require(is_factorable());
254 require(is_factorable());
269 require(is_attached());
271 require(is_factorable());
276 result = base_space().is_same_state(&xother.
base_space());
290 return _fiber_schema_id;
299 require(is_factorable());
303 result.
put(_fiber_schema.hub_id_space(), _fiber_schema_id);
307 ensure(result.
same_scope(fiber_schema().hub_id_space()));
320 require(is_factorable());
324 return _fiber_schema;
333 require(is_factorable());
337 return _fiber_schema;
348 require(is_attached());
350 require(is_factorable());
355 result = fiber_schema().is_same_state(&xother.
fiber_schema());
372 require(is_attached());
376 poset& result = host()->fiber_space();
391 require(is_attached());
395 poset& result = host()->fiber_space();
412 require(state_is_read_accessible());
416 if(!row_cache_consistent())
442 if(!row_cache_consistent())
447 result = _evaluation_ct;
466 require(state_is_read_accessible());
470 if(!row_cache_consistent())
475 result = _discretization_ct;
494 require(state_is_read_accessible());
495 require(is_factorable());
499 result = fiber_schema().row_dof_ct();
512 df(
bool xauto_access)
518 require(state_is_auto_read_accessible(xauto_access));
519 require(is_factorable());
556 ensure(is_basic_query);
571 subposet& result = host()->discretization();
588 subposet& result = host()->discretization();
605 require(is_attached());
610 result = discretization().is_same_state(&xother.
discretization());
628 subposet& result = host()->evaluation();
645 subposet& result = host()->evaluation();
662 require(is_attached());
667 result = evaluation().is_same_state(&xother.
evaluation());
684 require(is_attached());
688 string result = rep().evaluator_family_name();
704 require(!xsp.
name().empty());
710 if(xindex == TOP_INDEX)
716 result = poset_path::make_reserved_name(
"", xindex,
717 xsp.
name() +
"_id_space");
722 ensure(!result.empty());
736 require(!xsp.
name().empty());
741 string result = intersection_id_space_name(xsp, xindex);
745 ensure(!result.empty());
760 require(state_is_read_accessible());
761 require(is_ancestor_of(&xother));
777 result = is_same_state(&xother);
802 _discretization_id_space = 0;
807 ensure(!is_attached());
808 ensure(!is_factorable());
819 require(state_is_read_accessible());
825 schema_poset_member::attach_handle_data_members();
829 if(_index == TOP_INDEX || _index == BOTTOM_INDEX)
833 _base_space_id = _index;
834 _fiber_schema_id = _index;
836 else if(host()->is_homogeneous(_index))
840 host()->tuple(_index, _base_space_id, _fiber_schema_id);
854 _base_space.attach_to_state(&(host()->base_space()), _base_space_id);
859 _fiber_schema.attach_to_state(&(host()->fiber_schema()), _fiber_schema_id);
872 ensure(!
is_valid(base_space_id()) || base_space().is_attached());
873 ensure(!
is_valid(fiber_schema_id()) || fiber_schema().is_attached());
893 bool xin_table_dofs)
const 899 require(state_is_read_accessible());
900 require(host()->is_schematized(
false));
901 require(host()->contains_member(xbase_id, xfiber_id,
false));
906 host()->ordinal(xbase_id, xfiber_id, lid);
908 result = contains_dof(lid, xin_table_dofs);
921 bool xin_table_dofs)
const 927 require(state_is_read_accessible());
928 require(host()->is_schematized(
false));
1006 require(state_is_read_accessible());
1017 ltable_dof_id_space->
reserve(fiber_schema().table_dof_id_space().ct());
1024 fiber_schema().table_dof_id_space().get_iterator();
1027 host()->ordinal(BOTTOM_INDEX, litr.
hub_pod(), lid);
1033 fiber_schema().table_dof_id_space().release_iterator(litr);
1039 schema_poset_member::update_table_dof_id_space();
1055 require(state_is_read_accessible());
1066 if(_table_dof_descriptors != 0)
1068 _table_dof_descriptors->remove_reference();
1071 _table_dof_descriptors->add_reference();
1080 ldesc.size = fiber_schema().size(itr.
pod(),
true);
1081 ldesc.alignment = fiber_schema().alignment(itr.
pod(),
true);
1082 ldesc.type = fiber_schema().type(itr.
pod(),
true);
1083 ldesc.offset = fiber_schema().offset(itr.
pod(),
true);
1088 _table_dof_tuple_ub = fiber_schema().table_dof_tuple_ub();
1094 ldesc.alignment = 0;
1095 ldesc.type = NOT_A_PRIMITIVE_TYPE;
1096 ldesc.offset = _table_dof_tuple_ub;
1102 schema_poset_member::update_table_dof_descriptors();
1127 require(state_is_read_accessible());
1131 if(!row_cache_consistent())
1152 require(state_is_auto_read_accessible(xauto_access));
1161 if(!row_cache_consistent())
1187 require(state_is_read_accessible());
1191 if(!row_cache_consistent())
1212 require(state_is_auto_read_accessible(xauto_access));
1221 if(!row_cache_consistent())
1247 require(state_is_read_accessible());
1248 require(is_factorable());
1268 require(state_is_auto_read_accessible(xauto_access));
1269 require(is_factorable());
1274 fiber_schema().dof_id_space(xis_table_dofs, xauto_access);
1291 require(state_is_read_accessible());
1292 require(is_factorable());
1293 require(xis_table_dof ? fiber_schema_id_space(xis_table_dof).contains(xdof_id) :
true);
1314 require(state_is_read_accessible());
1315 require(is_factorable());
1316 require(fiber_schema_id_space(xis_table_dof).contains(xfiber_dof_id));
1337 bool xauto_access)
const 1341 require(state_is_read_accessible());
1342 require(is_factorable());
1343 require(fiber_schema_id_space(xis_table_dof, xauto_access).contains(xfiber_dof_id));
1365 require(state_is_read_accessible());
1366 require(is_factorable());
1367 require(xis_table_dof ? fiber_schema_id_space(xis_table_dof).contains(xdof_id) :
true);
1389 require(state_is_read_accessible());
1390 require(is_factorable());
1391 require(fiber_schema_id_space(xis_table_dof).contains(xfiber_dof_id));
1412 bool xauto_access)
const 1416 require(state_is_read_accessible());
1417 require(is_factorable());
1418 require(fiber_schema_id_space(xis_table_dof, xauto_access).contains(xfiber_dof_id));
1440 require(state_is_read_accessible());
1441 require(is_factorable());
1442 require(xis_table_dof ? fiber_schema_id_space(xis_table_dof).contains(xdof_id) :
true);
1463 require(state_is_read_accessible());
1464 require(is_factorable());
1465 require(fiber_schema_id_space(xis_table_dof).contains(xfiber_dof_id));
1485 bool xauto_access)
const 1489 require(state_is_read_accessible());
1490 require(is_factorable());
1491 require(fiber_schema_id_space(xis_table_dof, xauto_access).contains(xfiber_dof_id));
1512 require(state_is_read_accessible());
1513 require(is_factorable());
1514 require(xis_table_dof ? fiber_schema_id_space(xis_table_dof).contains(xdof_id) :
true);
1536 require(state_is_read_accessible());
1537 require(is_factorable());
1538 require(fiber_schema_id_space(xis_table_dof).contains(xfiber_dof_id));
1559 bool xauto_access)
const 1563 require(state_is_read_accessible());
1564 require(is_factorable());
1565 require(fiber_schema_id_space(xis_table_dof, xauto_access).contains(xfiber_dof_id));
1587 require(state_is_read_accessible());
1588 require(is_factorable());
1592 size_type result = fiber_schema().dof_tuple_ub(
false);
1608 require(state_is_auto_read_accessible(xauto_access));
1609 require(is_factorable());
1639 require(state_is_read_accessible());
1640 require(fiber_schema_id_space(
false).contains(xfiber_dof_id));
1641 require(is_factorable());
1645 if(!row_cache_consistent())
1651 fiber_schema().size(xfiber_dof_id,
false)*_discretization_ct;
1667 require(state_is_auto_read_accessible(xauto_access));
1668 require(fiber_schema_id_space(
false, xauto_access).contains(xfiber_dof_id));
1669 require(is_factorable());
1679 fiber_schema_id_space(
false).pod(xfiber_dof_id);
1680 size_type result = component_size(lfiber_dof_id);
1708 get_ext_id(
const std::string& xid_space_name)
const 1712 require(state_is_read_accessible());
1713 require(is_factorable());
1724 require(precondition_of(host()->base_space().get_ext_id(base_space_id(), xid_space_name)));
1730 host()->base_space().get_ext_id(base_space_id(), xid_space_name,
false);
1734 ensure(result >= 0);
1783 require(state_is_read_accessible());
1807 require(state_is_read_accessible());
1890 require(state_is_read_accessible());
1891 require(host()->contains_range_member(xbase_space_id, xfiber_schema_id,
false));
1896 host()->ordinal(xbase_space_id, xfiber_schema_id, lpod);
1898 _index = hub_id(lpod);
1899 _version = CURRENT_HOST_VERSION;
1901 attach_handle_data_members();
1905 ensure(base_space_id() == xbase_space_id);
1906 ensure(base_space().is_attached());
1907 ensure(fiber_schema_id() == xfiber_schema_id);
1908 ensure(fiber_schema().is_attached());
1922 require(state_is_read_accessible());
1923 require(host()->contains_range_member(xbase_space_id, xfiber_schema_id,
false));
1927 attach_to_state(xbase_space_id.
hub_pod(),
1932 ensure(base_space_id() == xbase_space_id.
hub_pod());
1933 ensure(base_space().is_attached());
1934 ensure(fiber_schema_id() == xfiber_schema_id.
hub_pod());
1935 ensure(fiber_schema().is_attached());
1950 require(xhost != 0);
1951 require(host_is_ancestor_of(xhost));
1958 xhost->
ordinal(xbase_space_id, xfiber_schema_id, lpod);
1961 _index = hub_id(lpod);
1962 _version = CURRENT_HOST_VERSION;
1964 attach_handle_data_members();
1968 ensure(base_space_id() == xbase_space_id);
1969 ensure(base_space().is_attached());
1970 ensure(fiber_schema_id() == xfiber_schema_id);
1971 ensure(fiber_schema().is_attached());
1985 require(xhost != 0);
1986 require(host_is_ancestor_of(xhost));
1992 attach_to_state(xhost,
1998 ensure(base_space_id() == xbase_space_id.
hub_pod());
1999 ensure(base_space().is_attached());
2000 ensure(fiber_schema_id() == xfiber_schema_id.
hub_pod());
2001 ensure(fiber_schema().is_attached());
2016 require(xhost != 0);
2017 require(host_is_ancestor_of(xhost));
2019 require(xbase_path.
full());
2021 require(xfiber_schema_path.
full());
2028 attach_to_state(xhost,
2034 ensure(is_attached());
2035 ensure(base_space().has_path(xbase_path,
false));
2036 ensure(fiber_schema().has_path(xfiber_schema_path,
false));
2051 _base_space.detach_from_state();
2052 _base_space_id = _base_space.index().pod();
2053 _fiber_schema.detach_from_state();
2054 _fiber_schema_id = _fiber_schema.index().pod();
2056 schema_poset_member::detach_from_state();
2060 ensure(!is_attached());
2139 invariance(schema_poset_member::invariant());
2141 if(invariant_check())
2145 disable_invariant_check();
2149 invariance(is_factorable() ? base_space().is_attached() :
true);
2150 invariance(is_factorable() ? fiber_schema().is_attached() :
true);
2157 enable_invariant_check();
2218 <<
" host = \'" << p.
host()->
name() <<
"\'" 2220 <<
" name = \'" << p.
name() <<
'\'' 2221 <<
" version= " << p.
version(
false)
2222 <<
" unaliased version= " << p.
version()
2238 os <<
"member: host = \'\'' index = -1 name = \'\''" virtual const std::string & class_name() const
The name of this class.
poset_state_handle * host() const
The poset which this is a handle to a component of.
A client handle for a subposet.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
bool full() const
True if both poset name and member name are not empty.
int version(bool xunalias=true) const
The (possibly aliased) version of this component. The version of the host used when evaluating proper...
bool in_scope() const
True if and only if scope() contains an entry for pod().
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
virtual bool conforms_to(const schema_poset_member &xother, bool xis_table_dofs) const
True if this schema contains all the table dofs (xis_table_dofs true) or row dofs (xis_is_table_dofs ...
An abstract iterator over the ids of an id space.
schema_poset_member & fiber_schema()
The fiber schema component of this (mutable version).
pod_type pod() const
The current id in the iteration.
virtual ~section_space_schema_member()
Destructor; deletes a poset member and its attached state, if any.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
virtual size_t size() const =0
The number of bytes in this dof.
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
A client handle for a general, abstract partially order set.
bool contains_range_member(const scoped_index &xbase_space_id, const scoped_index &xfiber_schema_id, bool xauto_access) const
True if this poset contains a member with base space id xbase_space_id and fiber schema id xfiber_sch...
virtual void update_table_dof_descriptors() const
Update the table dof descriptors.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
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.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
virtual sheaf::primitive_type type() const =0
The primitive type index of the dof defined by this.
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
virtual void get_read_access() const
Get read access to the state associated with this.
const scoped_index & index() const
The index of the component state this handle is attached to.
virtual void next()=0
Makes id() the next id in the iteration.
std::string name() const
A name for this.
bool is_factorable() const
True if this member is factorable into base space and fiber schema components.
static const std::string & static_class_name()
The name of this class.
bool same_scope(const scoped_index &xother) const
True if and only if this is in the same id space as xother.
virtual void update_table_dof_id_space() const
Updates table dof id space.
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...
virtual size_t alignment() const =0
The alignment for this dof.
Abstract base class with useful features for all objects.
pod_index_type fiber_schema_id() const
The member id of the fiber schema component of this.
virtual section_space_schema_member & operator=(const abstract_poset_member &xother)
Assignment operator; attaches this to the same state as xother.
bool is_done() const
True if iteration is finished.
bool same_base_space(const section_space_schema_member &xother) const
True if this has the same base as xother.
primitive_type
Type ids for sheaf primitives.
virtual void attach_handle_data_members()
Initializes the handle data members when this handle is attached to a state.
A client handle for a mutable partially ordered set.
virtual pod_index_type get_ext_id(const std::string &xid_space_name) const
Gets an external id corresponding to index() in the id space with name xid_space_name. /.
An index within the external ("client") scope of a given id space.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
static std::string intersection_id_space_name(const subposet &xsp, const pod_index_type xhub_id)
The name of the id space for intersection of xsp with the down set of the member with hub id xhub_id...
virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access=true) const
True if some version of this poset contains poset member with hub id xmbr_hub_id. ...
bool same_fiber_schema(const section_space_schema_member &xother) const
True if this has the same fiber schema as xother.
std::string name(pod_index_type xdof_id, bool xis_table_dof) const
The name of the table dof (xis_table_dof true) or row dof referred to by xdof_id in the schema define...
void reserve(size_type xcapacity)
Reserve enough memory for xcapacity number of ids.
int discretization_ct() const
The number of members in the intersection of the discretization subposet and the down set of the base...
void put(const index_space_handle &xid_space, pod_type xpod)
Set the scope to id space, xid_space and pod() to xpod.
An array for storing structs which describe the size, alignment, and offset of dofs within a dof tupl...
std::string evaluator_family_name() const
The name of the evaluator family for section spaces on schemae hosted by this.
subposet & discretization()
The discretization subposet for section spaces on this schema (mutable version).
virtual std::string name() const
The name of this poset.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
section_space_schema_member()
Default constructor; creates a new, unattached section_space_schema_member handle. Intended for use only by descendants.
bool same_discretization(const section_space_schema_member &xother) const
True if this has the same discretization as xother.
virtual void to_stream(std::ostream &xos=std::cout) const
Virtual stream insertion.
bool contains_dof(const schema_poset_member &xother, bool xin_table_dofs) const
True if xother is a dof in the table dofs part (xin_table_dofs == true) or in the row dofs part (xin_...
virtual bool invariant() const
Class invariant.
Basic description of a dof.
size_type fiber_size() const
The number of bytes in the fiber.
const index_space_handle & fiber_schema_id_space(bool xis_table_dofs) const
The id space for the dofs in the down set of the fiber schema of this.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
An abstract schema poset for a section space. A Cartesian product subspace of the tensor product of a...
virtual void detach_from_state()
Detach this handle from its state, if any.
total_poset_member & base_space()
The base space component of this (mutable version).
poset_state_handle & fiber_schema()
The fiber schema for section spaces on this schema (mutable version).
const index_space_handle & discretization_id_space() const
The id space for the discretization members in the down set of the base space of this (const version)...
size_type component_size(pod_index_type xfiber_dof_id) const
The number of bytes in the component referred to by xfiber_dof_id.
void ordinal(const scoped_index &xbase_space_id, const scoped_index &xfiber_schema_id, scoped_index &xindex) const
The ordinal conversion from base space id xbase_space_id and fiber schema id xfiber_schema_id to sect...
int_type pod_index_type
The plain old data index type.
poset & fiber_space()
The fiber space for section spaces on this schema (mutable version).
std::string member_name() const
The member name part of the path.
bool same_rep(const section_space_schema_member &xother) const
True if this has the same rep as xother.
int evaluation_ct() const
The number of members in the intersection of the evaluation subposet and the down set of the base spa...
A handle for a scattered_insertion_index_space_state.
A client handle for a poset member which has been prepared for use as a schema for a section space...
int db() const
The dimension of the base space component.
bool same_evaluation(const section_space_schema_member &xother) const
True if this has the same evaluation as xother.
void push_back(const scoped_index &xhub_id)
Make the next id in this space equivalent to xhub_id in the hub id space. synonym for push_back(xhub_...
int df() const
The dimension of the fiber space component.
An abstract client handle for a member of a poset.
sec_rep_descriptor & rep()
The representation for section spaces on this schema (mutable version).
virtual schema_poset_member & unrestricted_schema()
The unrestricted schema for this poset member (mutable version).
virtual schema_poset_member & schema()
The schema for this member (mutable version).
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
virtual void attach_to_state(pod_index_type xbase_space_id, pod_index_type xfiber_schema_id)=0
Attach to the state in host() with component ids xbase_id and xfiber_schema_id.
void enable_invariant_check() const
Enable invariant checking.
A client handle for a poset member which has been prepared for use as a schema.
pod_type hub_pod() const
The current unglued hub id in the iteration. synonym for unglued_hub_pod().
A client handle for an unrestricted member of a poset. A total_poset_member is guaranteed not to be r...
virtual size_type offset(pod_index_type xdof_id, bool xis_table_dof) const
The offset for the table dof (xis_table_dof true) or row dof referred to by xdof_id in the schema def...
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.
base_space_poset & base_space()
The base space for section spaces on this schema.
A description for a section representation scheme.
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...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
pod_index_type base_space_id() const
The member id of the base space component of this.