21 #include "SheafSystem/refinable_poset.h" 23 #include "SheafSystem/namespace_poset.impl.h" 24 #include "SheafSystem/abstract_poset_member.h" 25 #include "SheafSystem/implicit_crg_interval.h" 27 #include "SheafSystem/poset_dof_map.h" 28 #include "SheafSystem/poset_handle_factory.h" 29 #include "SheafSystem/poset_member_iterator.h" 30 #include "SheafSystem/poset_state.h" 31 #include "SheafSystem/poset_type.h" 32 #include "SheafSystem/schema_poset_member.h" 33 #include "SheafSystem/subposet.h" 53 require(!xpath.
empty());
56 require(xschema_path.
full());
65 table_type* ltable =
new table_type();
84 ltable->new_state(xns, xpath, lschema, *lmap);
95 ensure(xns.
owns(result, xauto_access));
96 ensure(result.
path(
true) == xpath);
98 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
112 require( has_version(xversion) );
119 poset::put_version(xversion);
123 ensure(version() == xversion);
136 require(state_is_read_accessible());
157 require(state_is_read_accessible());
178 require(state_is_read_accessible());
199 require(state_is_read_accessible());
220 require(!xauto_access ? state_is_read_write_accessible() :
true);
223 get_read_write_access(
true);
228 define_old_variable(
int old_version_ct = version_ct());
230 poset_state_handle::begin_jim_edit_mode(
false);
232 int lnew_ver = version_ct();
244 string lname = version_to_name(0);
245 delete_subposet_name(lname,
false);
246 delete_subposet_name(lname+
"_jims",
false);
248 assertion(version_ct() == 0);
254 assertion(version_ct() == old_version_ct);
257 new_version(lnew_ver);
261 ensure(state_is_read_write_accessible());
262 ensure(in_jim_edit_mode());
263 ensure(version_ct() == old_version_ct + 1);
276 require(precondition_of(end_jim_edit_mode(xensure_lattice_invarinat, xauto_access)));
280 end_jim_edit_mode(xensure_lattice_invariant, xauto_access);
284 ensure(postcondition_of(end_jim_edit_mode(xensure_lattice_invarinat, xauto_access)));
304 ensure(postcondition_of(poset::poset()));
330 sheaf::refinable_poset::
331 new_version(
int xversion)
335 require(state_is_read_write_accessible());
336 require(!includes_subposet(version_to_name(xversion),
false));
338 define_old_variable(
int old_version_ct = version_ct());
344 string whole_name = version_to_name(xversion);
345 string jims_name(whole_name);
346 jims_name +=
"_jims";
352 powerset().whole().new_state();
353 powerset().whole().put_name(whole_name,
true,
false);
354 powerset().whole().make_equal_to(&old_whole);
361 jims().put_name(jims_name,
true,
false);
362 jims().make_equal_to(&old_jims);
369 ensure(version_ct() == old_version_ct + 1);
388 sheaf::refinable_poset::
422 return REFINABLE_POSET_ID;
433 static const char* result =
"refinable_poset";
448 require(xis_jim ? in_jim_edit_mode() : state_is_read_write_accessible());
449 require(contains_row_dof_tuple(xdof_tuple_id) || !
is_valid(xdof_tuple_id));
454 define_old_variable(
int old_member_ct = member_ct());
458 pod_index_type result = poset::new_member(xis_jim, xdof_tuple_id);
462 coarsest_common_refinement().insert_member(result);
465 coarsest_common_refinement_jims().insert_member(result);
471 ensure(cover_is_empty(
LOWER, result));
472 ensure(cover_is_empty(
UPPER, result));
487 require(precondition_of(poset::new_member(same args)));
491 define_old_variable(
int old_member_ct = member_ct());
495 poset::new_member(xindex.
hub_pod(), xis_jim, xdof_tuple_id);
499 coarsest_common_refinement().insert_member(xindex);
502 coarsest_common_refinement_jims().insert_member(xindex);
508 ensure(contains_member(xindex));
509 ensure(cover_is_empty(
LOWER, xindex));
510 ensure(cover_is_empty(
UPPER, xindex));
523 require(in_jim_edit_mode());
527 define_old_variable(
const scoped_index old_member_index_ub = member_index_ub());
528 define_old_variable(
size_type old_member_ct = member_ct());
532 pod_index_type result = poset::new_member_interval(xinterval_type, xsize);
540 coarsest_common_refinement().insert_member(i);
543 coarsest_common_refinement_jims().insert_member(i);
549 ensure(postcondition_of(poset::new_member_interval(xinterval_type, xsize)));
550 ensure_for_range(
pod_index_type i=result, i<member_index_ub().pod(), ++i,
551 coarsest_common_refinement().contains_member(i));
564 require(precondition_of(poset::new_member_interval(same args)));
568 define_old_variable(
const scoped_index old_member_index_ub = member_index_ub());
569 define_old_variable(
size_type old_member_ct = member_ct());
573 poset::new_member_interval(xindex.
hub_pod(), xinterval_type, xsize);
579 for(
pod_index_type i = linterval.begin(); i < linterval.end(); ++i)
581 coarsest_common_refinement().insert_member(i);
582 if(linterval.is_jim(i))
584 coarsest_common_refinement_jims().insert_member(i);
590 ensure(postcondition_of(poset::new_member_interval(xindex, xinterval_type, xsize)));
591 ensure_for_range(
pod_index_type i=0, i<xsize, ++i, coarsest_common_refinement().contains_member(xindex.
hub_id() + i));
654 result = result && poset::invariant();
656 if(invariant_check())
658 disable_invariant_check();
663 enable_invariant_check();
virtual ~refinable_poset()
Destructor.
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
A client handle for a subposet.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
bool full() const
True if both poset name and member name are not empty.
poset_path path(bool xauto_access=true) const
A path to this component.
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...
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
poset_type
Identifiers for poset types.
void put_version(int xversion)
Set the current level to xversion.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
subposet & coarsest_common_refinement_jims()
The jims of the coarsest_common_refinement (mutable version).
virtual void get_read_access() const
Get read access to the state associated with this.
subposet & coarsest_common_refinement()
The coarsest common refinement of all versions.
virtual refinable_poset * clone() const
Virtual constructor; creates a new handle of the same actual type as this, attached to the same state...
Abstract implementation of crg_interval for an interval of implicit cover relation graph members...
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...
Abstract base class with useful features for all objects.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
A factory for instanting descendants of an abstract type T, given the class name of the descendant...
virtual void end_refine_mode(bool xensure_lattice_invariant=true, bool xauto_access=true)
Prevent editing of jims and jim order relation; synonym for end_jim_edit_mode(xensure_lattice_invaria...
A client handle for a partially order set that can be refined, that is, a jim can be converted to a j...
bool owns(const poset_state_handle &xposet, bool xauto_access) const
True if and only if this contains the poset xposet. synonym for contains_poset(xposet.poset_path(true), xauto_access)
An index within the external ("client") scope of a given id space.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
virtual pod_index_type new_member(bool xis_jim, pod_index_type xdof_tuple_id)
Create a disconnected member with is_jim == xis_jim and the dof tuple identified by xdof_tuple_id...
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
const bool UPPER
Selector for upper cover.
virtual poset_type type_id() const
Identifier for the type of this poset.
refinable_poset()
Default constructor; creates a new refinable_poset handle not attached to any state.
bool empty() const
True if both poset name and member name are empty.
static refinable_poset & new_table(namespace_type &xhost, const poset_path &xpath, const poset_path &xschema_path, bool xauto_access)
Creates a new poset in namespace xns with path xpath and schema specified by xschema_path.
virtual bool is_jim(pod_index_type xmbr_index) const =0
True if and only if the member with index xmbr_index is join-irreducible.
const bool LOWER
Selector for lower cover.
virtual void detach_from_state()
Detach this handle from its state, if any.
virtual bool is_attached() const
True if this is attached to a state.
subposet & coarsest_common_refinement_jims()
The jims of the coarsest common refinement.
virtual void begin_refine_mode(bool xauto_access=true)
Create a new version and allow editing of jims and jim order relation.
scoped_index hub_id() const
This mapped to the hub id space.
poset_powerset_state * powerset() const
The set of subposets of host().
int_type pod_index_type
The plain old data index type.
virtual pod_index_type new_member_interval(const std::string &xinterval_type, size_type xsize, const block< pod_index_type > &xdof_tuple_ids, const block< pod_index_type > &xdata)
Create a disconnected member interval of type xinterval_type with size xsize, dof tuple ids xdof_tupl...
void insert_prototype(T *xprototype)
Sets xprototype as the prototype for its client class.
An array representation of abstract class poset_dof_map.
subposet & coarsest_common_refinement()
The coarsest common refinement of all versions of this poset (mutable version).
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
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...
A client handle for a poset member which has been prepared for use as a schema.
virtual bool invariant() const
Class invariant.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
virtual const char * class_name() const
The name of this class.