21 #include "SheafSystem/primitives_index_space_state.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/deep_size.h" 24 #include "SheafSystem/index_space_family.h" 25 #include "SheafSystem/hub_index_space_handle.h" 26 #include "SheafSystem/explicit_index_space_handle.h" 27 #include "SheafSystem/primitives_index_space_handle.h" 28 #include "SheafSystem/primitives_index_space_iterator.h" 29 #include "SheafSystem/primitives_schema_member_index.h" 34 sheaf::PRIMITIVES_SCHEMA_MEMBER_INDEX_END - sheaf::PRIMITIVES_SCHEMA_MEMBER_INDEX_BEGIN;
38 const pod_type BEGIN = 0;
39 const pod_type END = CT;
41 const pod_type HUB_BEGIN = sheaf::PRIMITIVES_SCHEMA_MEMBER_INDEX_BEGIN;
42 const pod_type HUB_END = sheaf::PRIMITIVES_SCHEMA_MEMBER_INDEX_END;
54 const std::string& xname)
58 require(!xname.empty());
59 require(!xid_spaces.
contains(xname));
64 lstate->new_state(xid_spaces, xname,
false);
70 ensure(&result.
id_spaces() == &xid_spaces);
74 ensure(result.
name() == xname);
86 const std::string& xname)
92 require(!xname.empty());
93 require(!xid_spaces.
contains(xname));
98 lstate->new_state(xid_spaces, xid, xname,
false);
104 ensure(&result.
id_spaces() == &xid_spaces);
108 ensure(result.
index() == xid);
109 ensure(result.
name() == xname);
226 (void) explicit_index_space_state::operator=(xother);
231 ensure((*
this) == xother);
255 bool result = (0 <= xid) && (xid <
_end);
259 ensure(is_basic_query);
274 bool result = (HUB_BEGIN <= xhub_id) && (xhub_id < HUB_END);
278 ensure(is_basic_query);
409 handles().release(reinterpret_cast<primitives_index_space_handle&>(xid_space));
413 ensure(is_basic_query);
431 bool result = (lid_space != 0) && handles().allocated(*lid_space);
435 ensure(is_basic_query);
447 sheaf::primitives_index_space_state::
458 ensure(is_basic_query);
546 iterators().release(reinterpret_cast<primitives_index_space_iterator&>(xitr));
550 ensure(is_basic_query);
568 bool result = (litr != 0) && iterators().allocated(*litr);
572 ensure(is_basic_query);
584 sheaf::primitives_index_space_state::
595 ensure(is_basic_query);
613 static const std::string result(
"primitives_index_space_state");
642 sheaf::primitives_index_space_state::
735 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
bool contains_hub(pod_type xid) const
True if this space contains an id equivalent to xid in the unglued hub id space. synonym for contains...
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
virtual pod_type index() const
Index of this space.
An abstract iterator over the ids of an id space.
virtual bool is_persistent() const
True if this id space should be written to disk.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
virtual void detach()=0
Detach this handle form its state, if any.
bool is_gathered() const
True if begin() == 0 and end() == ct().
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
virtual const index_space_family & id_spaces() const
The id space family for this (const version).
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
virtual void detach()=0
Detach this handle form its state, if any.
primitives_index_space_state()
Default constructor.
virtual bool contains_unglued_hub(pod_type xid) const
True if this space contains an id equivalent to xid in the unglued hub id space.
virtual bool allocated_iterator(const index_space_iterator &xitr) const
True if and only if id space iterator xitr was allocated by the iterator pool.
void attach(explicit_index_space_handle &xid_space) const
Attach the id space handle xid_space to this state.
pod_type _end
Ending id of this space.
virtual bool invariant() const
Class invariant.
virtual ~primitives_index_space_state()
Destructor.
Abstract base class with useful features for all objects.
A implementation of abstract class explicit_index_space_state for the primitives row dof id space...
virtual bool allocated_id_space(const index_space_handle &xid_space) const
True if and only if id space handle xid_space was allocated by the handle pool.
virtual pod_type unglued_hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
virtual const std::string & class_name() const
The name of this class.
std::string name() const
Name of this space.
virtual bool is_attached() const
True if this handle is attached to a state.
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
virtual bool contains(pod_type xid) const
True if this space contains id xid.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
bool is_explicit_interval(pod_type xid)
True, if and only if the id space interval that contains index xid is an explicit interval...
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
virtual void release_id_space(index_space_handle &xid_space) const
Returns the id space handle xid_space to the handle pool.
virtual primitives_index_space_state * clone() const
Virtual constructor; create a new instance of the same type at this.
An iterator over the id space for the primitives row dof id space.
static size_type handle_pool_deep_size()
The deep size of the handle pool.
An implementation of class explicit_index_space_handle that has a primitives id space state...
size_type _ct
The number of members.
virtual index_space_iterator & get_iterator() const
Allocates an id space iterator from the iterator pool.
static size_type iterator_pool_deep_size()
The deep size of the iterator pool.
virtual index_space_handle & get_id_space() const
Allocates an id space handle from the handle pool.
bool invariant_check() const
True if invariant checking is enabled.
pod_index_type pod_type
The "plain old data" index type for this.
virtual primitives_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
int_type pod_index_type
The plain old data index type.
virtual bool conforms_to_state(const index_space_collection &xhost, pod_type xlocal_id) const
True if this conforms to the handle type required by the state with local scope id xlocal_id in the h...
virtual bool invariant() const
Class invariant.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
static size_type iterator_pool_ct()
The number of iterators in the pool.
static size_type handle_pool_ct()
The number of handles in the pool.
Factory and container for a family of id spaces.
static primitives_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname)
Create a new primitives id space in the id space family xid_space at the next available id space inde...
virtual void release_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the iterator pool.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
static factory< explicit_index_space_state > & id_space_factory()
A factory for making descendants of this class.
pod_type _begin
Beginning id of this space.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
bool is_same_type(const any *other) const
True if other is the same type as this.
void enable_invariant_check() const
Enable invariant checking.
virtual bool is_attached() const
True if this iterator is attached to a state.
A reallocated pool of objects of type T. Objects in the pool are either allocated or stored in a free...