21 #include "SheafSystem/section_space_schema_poset.h" 23 #include "SheafSystem/abstract_poset_member.impl.h" 24 #include "SheafSystem/arg_list.h" 25 #include "SheafSystem/array_poset_dof_map.h" 26 #include "SheafSystem/index_iterator.h" 27 #include "SheafSystem/index_space_iterator.h" 28 #include "SheafSystem/list_cover_set.h" 29 #include "SheafSystem/error_message.h" 30 #include "SheafSystem/namespace_poset.impl.h" 31 #include "SheafSystem/namespace_poset_member.h" 32 #include "SheafSystem/pod_types.h" 33 #include "SheafSystem/poset_member_iterator.h" 34 #include "SheafSystem/poset_state.h" 35 #include "SheafSystem/schema_descriptor.h" 36 #include "SheafSystem/section_space_schema_member.impl.h" 37 #include "SheafSystem/section_space_schema_table_dofs_type.h" 38 #include "SheafSystem/std_limits.h" 39 #include "SheafSystem/tern.h" 40 #include "SheafSystem/wsv_block.h" 61 static const string result(
"section_space_schema_schema");
65 ensure(!result.empty());
82 result(standard_schema_poset_name(),
"section_space_schema_schema");
86 ensure(result.
full());
87 ensure(result.
poset_name() == standard_schema_poset_name());
111 ldof_specs =
"size SIZE_TYPE false";
112 ldof_specs +=
" alignment SIZE_TYPE false";
113 ldof_specs +=
" type POD_INDEX_TYPE false";
117 ldof_specs +=
" rep_path C_STRING true";
118 ldof_specs +=
" base_space_path C_STRING true";
119 ldof_specs +=
" fiber_space_path C_STRING true";
122 standard_schema_path().member_name(),
123 poset_path(standard_schema_poset_name(),
"bottom"),
174 result = result && ldisc_sp.
has_id_space() && !ldisc_sp.id_space().is_empty();
175 ldisc_sp.detach_from_state();
200 require(xargs.
conforms_to(xns, standard_schema_path(),
true, xauto_access));
216 lrep.get_read_access();
219 result = rep_is_valid(lrep, lbase_space);
223 lrep.release_access();
224 lbase_space.release_access();
227 lrep.detach_from_state();
244 require(state_is_read_accessible());
248 result = _base_space->max_db();
281 require(state_is_read_accessible());
289 result = _fiber_space->schema().row_dof_ct();
304 require(state_is_read_accessible());
306 return *_fiber_space->schema().host();
313 require(state_is_read_accessible());
315 return *_fiber_space->schema().host();
322 return *_fiber_space;
329 return *_fiber_space;
336 return _discretization;
343 return _discretization;
366 require(rep().state_is_read_accessible());
370 string result = _rep.evaluator_family_name();
387 require(state_is_read_accessible());
388 require(is_homogeneous(xindex));
393 tuple(xindex.
hub_pod(), lbase_space_id, lfiber_schema_id);
395 xbase_space_id.
put(base_space().member_hub_id_space(
false), lbase_space_id);
396 xfiber_schema_id.
put(fiber_schema().member_hub_id_space(
false), lfiber_schema_id);
400 ensure(contains_range_member(xbase_space_id, xfiber_schema_id,
false));
415 require(state_is_read_accessible());
416 require(is_homogeneous(xindex));
424 ensure(contains_range_member(xbase_space_id, xfiber_schema_id,
false));
439 require(contains_range_member(xbase_space_id, xfiber_schema_id,
false));
446 xindex.
put(member_hub_id_space(
false), lindex);
450 ensure(is_homogeneous(xindex));
465 require(contains_range_member(xbase_space_id, xfiber_schema_id,
false));
473 ensure(is_homogeneous(xindex));
490 ensure(is_basic_query);
494 return is_homogeneous(xindex.
hub_pod());
511 ensure(is_basic_query);
522 bool xauto_access)
const 526 require(state_is_auto_read_accessible(xauto_access));
530 bool result = contains_range_member(xbase_space_id.
hub_pod(),
536 ensure(is_basic_query);
547 bool xauto_access)
const 551 require(state_is_auto_read_accessible(xauto_access));
561 ensure(is_basic_query);
574 require(state_is_auto_read_write_accessible(xauto_access));
596 _rep.detach_from_state();
597 _discretization.detach_from_state();
598 _evaluation.detach_from_state();
609 :
poset(xtop, xbottom),
630 require(state_is_read_write_accessible());
631 require(fiber_schema().is_attached());
637 table_dof_subposet().new_state(
this);
638 table_dof_subposet().put_name(schema_poset_member::table_dof_subposet_name(
"top"),
true,
false);
642 begin_jim_edit_mode(
false);
649 fiber_schema().table_dof_subposet().id_space().get_iterator();
666 table_dof_subposet().insert_member(lid);
670 fiber_schema().table_dof_subposet().id_space().release_iterator(litr);
674 initialize_dof_id_space(table_dof_subposet());
676 end_jim_edit_mode(
false,
false);
680 crg().enable_invariant_check();
684 ensure(crg().invariant());
685 ensure(table_dof_subposet().is_attached());
705 return SECTION_SPACE_SCHEMA_POSET_ID;
716 static const char* result =
"section_space_schema_poset";
731 require(is_attached());
735 int old_access_request_depth = access_request_depth();
737 rep().get_read_access();
738 base_space().get_read_access();
739 fiber_space().get_read_access();
740 poset::get_read_access();
744 ensure(state_is_read_accessible());
745 ensure(access_request_depth() == old_access_request_depth + 1);
746 ensure(rep().state_is_read_accessible());
747 ensure(base_space().state_is_read_accessible());
748 ensure(fiber_space().state_is_read_accessible());
749 ensure(fiber_schema().state_is_read_accessible());
762 require(is_attached());
763 require(!xrelease_read_only_access ? state_is_not_read_only_accessible() :
true);
768 int old_access_request_depth = access_request_depth();
770 rep().get_read_access();
771 base_space().get_read_access();
772 fiber_space().get_read_access();
773 poset::get_read_write_access(xrelease_read_only_access);
777 ensure(state_is_read_write_accessible());
778 ensure(access_request_depth() == old_access_request_depth + 1);
779 ensure(rep().state_is_read_accessible());
780 ensure(base_space().state_is_read_accessible());
781 ensure(fiber_space().state_is_read_accessible());
782 ensure(fiber_schema().state_is_read_accessible());
795 require(state_is_read_accessible());
799 int old_access_request_depth = access_request_depth();
811 rep().release_access(
false);
812 base_space().release_access(
false);
813 fiber_space().release_access(
false);
814 poset::release_access(
false);
816 while(xall && state_is_read_accessible());
820 ensure(!xall ? access_request_depth() == old_access_request_depth - 1 :
821 access_request_depth() == 0);
822 ensure(access_request_depth() == 0 ? state_is_not_read_accessible() :
true);
823 ensure(unexecutable(
"schema, rep, base, base schema, fiber, and fiber schema access released"));
838 require(state_is_read_accessible());
854 rep().attach_to_state(&xns, lrep_path,
true);
867 rep().get_read_access();
868 discretization().attach_to_state(&(base_space()), rep().discretization_subposet_name());
869 evaluation().attach_to_state(&(base_space()), rep().evaluation_subposet_name());
873 ensure(rep().is_attached());
874 ensure(base_space().is_attached());
875 ensure(fiber_space().is_attached());
876 ensure(discretization().is_attached());
877 ensure(evaluation().is_attached());
879 rep().release_access();
880 base_space().release_access();
896 require(state_is_read_accessible());
900 poset::attach_handle_data_members();
911 rep().attach_to_state(lns, ldofs.
rep_path,
true);
923 discretization().
attach_to_state(&(base_space()), rep().discretization_subposet_name());
924 evaluation().attach_to_state(&(base_space()), rep().evaluation_subposet_name());
928 ensure(rep().is_attached());
929 ensure(base_space().is_attached());
931 ensure(fiber_space().is_attached());
932 ensure(discretization().is_attached());
933 ensure(evaluation().is_attached());
947 require(state_is_read_write_accessible());
951 define_old_variable(
int old_rep_access_request_depth = rep().access_request_depth());
952 define_old_variable(
int old_base_space_access_request_depth = base_space().access_request_depth());
953 define_old_variable(
int old_fiber_space_access_request_depth = fiber_space().access_request_depth());
964 string rep_name(rep().name());
965 string base_space_name(base_space().name());
966 string fiber_space_name(fiber_space().name());
968 #ifdef DIAGNOSTIC_OUTPUT 969 cout <<
"poset: " << name() << endl
970 <<
"\trep: " << rep_name
971 <<
" old lvl:" << old_rep_access_request_depth << endl
972 <<
"\tbase_space: " << base_space_name
973 <<
" old lvl:" << old_base_space_access_request_depth << endl
974 <<
"\tfiber_space: " << fiber_space_name
975 <<
" old lvl:" << old_fiber_space_access_request_depth << endl;
978 int old_access_request_depth = access_request_depth();
979 for(
size_type i=0; i<old_access_request_depth; ++i)
981 rep().release_access(
false);
982 base_space().release_access(
false);
983 fiber_space().release_access(
false);
986 define_old_variable(
int rep_access_request_depth = rep().access_request_depth());
987 define_old_variable(
int base_space_access_request_depth = base_space().access_request_depth());
988 define_old_variable(
int fiber_space_access_request_depth = fiber_space().access_request_depth());
990 #ifdef DIAGNOSTIC_OUTPUT 991 cout <<
" \trep lvl:" << rep_access_request_depth
992 <<
" base_space lvl:" << base_space_access_request_depth
993 <<
" fiber_space lvl:" << fiber_space_access_request_depth
999 poset::terminate_access();
1003 ensure(!is_attached());
1004 ensure(unexecutable(
"state has been deleted"));
1005 ensure(rep_access_request_depth == (old_rep_access_request_depth - old_access_request_depth));
1006 ensure(base_space_access_request_depth == (old_base_space_access_request_depth - old_access_request_depth));
1007 ensure(fiber_space_access_request_depth == (old_fiber_space_access_request_depth - old_access_request_depth));
1051 require(precondition_of(poset_state_handle::new_member(xis_jim, xdof_tuple_id)));
1052 require(is_new_member_available());
1057 poset_state_handle::new_member(xis_jim, xdof_tuple_id);
1061 ensure(postcondition_of(poset_state_handle::new_member(xis_jim, xdof_tuple_id)));
1074 require(precondition_of(poset_state_handle::new_member(xis_jim, xdof_map, xcopy_dof_map)));
1075 require(is_new_member_available());
1080 poset_state_handle::new_member(xis_jim, xdof_map, xcopy_dof_map);
1084 ensure(postcondition_of(poset_state_handle::new_member(xis_jim, xdof_map, xcopy_dof_map)));
1165 member_id(
const std::string& xbase_space_name,
const std::string& xfiber_schema_name)
const 1169 require(state_is_read_accessible());
1170 require(base_space().contains_member(xbase_space_name,
false));
1171 require(fiber_schema().contains_member(xfiber_schema_name,
false));
1176 base_space().member_id(xbase_space_name,
false);
1178 fiber_schema().member_id(xfiber_schema_name,
false);
1181 ordinal(lbase_space_id, lfiber_schema_id, result);
1185 ensure(contains_member(result,
false));
1195 const std::string& xfiber_schema_name,
1200 require(state_is_read_accessible());
1201 require(base_space().contains_member(xbase_space_name,
false));
1202 require(fiber_schema().contains_member(xfiber_schema_name,
false));
1206 result.
put(member_hub_id_space(
false),
1207 member_id(xbase_space_name, xfiber_schema_name));
1211 ensure(contains_member(result,
false));
1224 require(state_is_read_accessible());
1229 member_hub_id_space(
false).is_empty() ||
1230 !member_id_spaces(
false).is_reserved_term_full();
1234 ensure(is_basic_query);
1381 require(state_is_read_accessible());
1393 post_fatal_error_message(
"Product subposet hack, ver 2. Row decomposition i/o not supported for section space schema.");
1415 result = schema().host()->index().pod();
1418 result = _rep.host()->index().pod();
1421 result = _fiber_space->index().pod();
1424 result = _base_space->index().pod();
1474 invariance(poset::invariant());
1476 if(invariant_check())
1478 disable_invariant_check();
1480 invariance(state_is_read_accessible() ? rep().state_is_read_accessible() :
true);
1482 invariance(state_is_read_accessible() ? base_space().state_is_read_accessible() :
true);
1484 invariance(state_is_read_accessible() ? fiber_space().state_is_read_accessible() :
true);
1488 invariance(unexecutable(
"rep.evaluator_family_name is compatible with base_space"));
1493 enable_invariant_check();
1507 require(is_ancestor_of(&xother));
1511 poset::operator=(xother);
1515 ensure(is_same_state(&xother));
1529 #ifndef DOXYGEN_SKIP_INSTANTIATIONS 1534 sheaf::namespace_poset::
1535 member_poset<fiber_bundle::section_space_schema_poset>(
const poset_path& xpath,
bool xauto_access)
const;
1540 sheaf::namespace_poset::
1541 contains_poset<fiber_bundle::section_space_schema_poset>(
const poset_path& xpath,
bool xauto_access)
const;
1546 sheaf::namespace_poset::
1547 contains_path<fiber_bundle::section_space_schema_poset>(
const poset_path& xpath,
bool xauto_access)
const;
1552 sheaf::namespace_poset::
1553 path_is_auto_read_accessible<fiber_bundle::section_space_schema_poset>(
const poset_path& xpath,
bool xauto_access)
const;
1558 sheaf::namespace_poset::
1559 path_is_auto_read_available<fiber_bundle::section_space_schema_poset>(
const poset_path& xpath,
bool xauto_access)
const;
1561 #endif // ifndef DOXYGEN_SKIP_INSTANTIATIONS A client handle for a subposet.
virtual void terminate_access()
Release all access to posets this depends on, then detach and delete the state.
virtual void attach_handle_data_members()
Initializes the handle data members when this handle is attached to a state.
static bool rep_is_valid(const sec_rep_descriptor &xrep, const poset_state_handle &xbase_space)
True if the discretization and evaluation subposets named in xrep are included in xbase_space and the...
int df() const
The dimension of the fiber space.
void initialize_table_dof_subposet()
Create the table dof members with the same ids as the table dofs in the fiber schema id space and ini...
bool full() const
True if both poset name and member name are not empty.
virtual pod_index_type new_member(bool xis_jim, pod_index_type xdof_tuple_id)
Create a disconnected member with is_jim == xis_jim. Redefined here only to trap attempts to make a n...
virtual index_iterator * get_decomposition(pod_index_type xindex) const
An iterator over the members of the decomposition identified by xindex.
An abstract iterator over the ids of an id space.
virtual const char * class_name() const
The name of this class.
c_string rep_path
The section representation path.
virtual bool has_id_space() const
True if this already has an id space.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
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...
std::string discretization_subposet_name() const
The name of the discretization subposet.
poset_type
Identifiers for poset types.
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...
pod_index_type ordinal(pod_index_type xi, pod_index_type xj, size_type xj_ub)
2-tuple to ordinal conversion.
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...
bool state_is_auto_read_accessible(bool xauto_access) const
True if the state is auto accessible for read, that is, if the state is already accessible for read o...
A client handle for a general, abstract partially order set.
virtual bool includes_subposet(pod_index_type xsubposet_hub_id, bool xauto_access=true) const
True if this poset includes subposet with hub id xsubposet_hub_id.
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...
static const std::string & standard_schema_poset_name()
The name of the standard schema poset for this class.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
section_space_schema_member & top()
The top of member of the lattice (mutable version)
subposet & discretization()
The discretization subposet for section spaces on this schema.
virtual void get_read_access() const
Get read access to the state associated with this.
int db() const
The dimension of the base space.
virtual void get_read_access() const
Get read access to the state associated with this.
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.
pod_index_type member_id(const std::string &xbase_space_name, const std::string &xfiber_schema_name) const
The member id for base space member with name xbase_space_namd, and fiber schema member with name xfi...
virtual void next()=0
Makes id() the next id in the iteration.
The general, abstract map from dof ids to dof values.
subposet & evaluation()
The evaluation subposet for section spaces on this schema.
virtual bool invariant() const
Class invariant.
Table dofs type for class section_space_schema_poset.
Abstract base class with useful features for all objects.
section_space_schema_poset()
Default constructor; disabled.
poset & fiber_space()
The fiber space for section spaces on this schema.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
A whitespace separated list of arguments. Insertion operaters are used to insert arguments into the l...
bool is_done() const
True if iteration is finished.
c_string base_space_path
The base space path.
virtual ~section_space_schema_poset()
Destructor.
A client handle for a mutable partially ordered set.
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...
primitive_value & value(int xi)
The value of the xi-th argument.
virtual void detach_from_state()
Detach this handle from its state, if any.
An index within the external ("client") scope of a given id space.
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
virtual pod_index_type prereq_id(int xi) const
The id of the xi-th prerequisite poset for this.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
std::string poset_name() const
The poset name part of the path.
sec_rep_descriptor & rep()
The representation for section spaces on this schema.
virtual void initialize_handle_data_members(const namespace_poset &xns)
Initializes the handle data members that depend on the table dofs and are required to get access when...
std::string evaluator_family_name() const
The name of the evaluator family for section spaces on this schema.
void put(const index_space_handle &xid_space, pod_type xpod)
Set the scope to id space, xid_space and pod() to xpod.
void attach_to_state(const poset_state_handle *xother)
Attach this handle to the same state as xother.
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
bool is_homogeneous(const scoped_index &xindex) const
True if xindex is in the homogeneous member id space.
Iterates over the subset of Zn defined by the characteristic function host().
virtual pod_index_type new_member_range(const std::string &xrange_type, size_type xsize, const block< scoped_index > &xdof_tuple_ids, const block< pod_index_type > &xdata)
Create a disconnected member range of type xrange_type with size xsize, dof tuple ids xdof_tuple_ids...
bool conforms_to(const namespace_poset &xns, const poset_path &xschema_path, bool xuse_table_schema, bool xauto_access) const
True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_t...
section_space_schema_poset & operator=(const poset_state_handle &xother)
Assignment operator; disabled.
section_space_schema_member & bottom()
The bottom of member of the lattice (mutable version)
An abstract schema poset for a section space. A Cartesian product subspace of the tensor product of a...
virtual poset_type type_id() const
Identifier for the type of this poset.
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...
poset_state_handle & fiber_schema()
The fiber schema for section spaces on this schema (mutable version).
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...
T::table_dofs_type & table_dofs(T &x0)
The table dofs pod type for x0 (mutable version).
int_type pod_index_type
The plain old data index type.
bool is_new_member_available() const
True if and only if a member can be created.
c_string fiber_space_path
The fiber schema space path.
std::string evaluation_subposet_name() const
The name of the evaluation subposet.
A client handle for a poset member which has been prepared for use as a schema for a section space...
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
void tuple(pod_index_type x, size_type xj_ub, pod_index_type &xi, pod_index_type &xj)
Ordinal to 2-tuple conversion.
virtual void get_read_access() const
Get read access to the state associated with this.
void tuple(const scoped_index &xindex, scoped_index &xbase_space_id, scoped_index &xfiber_schema_id) const
The tuple conversion from section space schema id xindex to the base space id xbase_space_id and fibe...
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
void update_hub_id_space(bool xauto_access)
Extends the hub id space to match extension of the base space.
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().
base_space_poset & base_space()
The base space for section spaces on this schema.
A description for a section representation scheme.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.