21 #include "SheafSystem/offset_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/offset_index_space_handle.h" 27 #include "SheafSystem/offset_index_space_iterator.h" 38 const std::string& xname,
44 require(!xname.empty());
45 require(!xid_spaces.
contains(xname));
46 require(xoffset >= 0);
52 lstate->
new_state(xid_spaces, xname,
false);
63 ensure(&result.
id_spaces() == &xid_spaces);
67 ensure(result.
name() == xname);
70 ensure(result.
offset() == xoffset);
71 ensure(result.
ct() == xct);
83 const std::string& xname,
91 require(!xname.empty());
92 require(!xid_spaces.
contains(xname));
93 require(xoffset >= 0);
99 lstate->
new_state(xid_spaces, xid, xname,
false);
110 ensure(&result.
id_spaces() == &xid_spaces);
114 ensure(result.
index() == xid);
115 ensure(result.
name() == xname);
118 ensure(result.
offset() == xoffset);
119 ensure(result.
ct() == xct);
158 ensure(
begin() == 0);
203 ensure(is_basic_query);
280 (void) explicit_index_space_state::operator=(xother);
285 ensure((*
this) == xother);
309 bool result = (0 <= xid) && (xid <
_end);
313 ensure(is_basic_query);
332 ensure(is_basic_query);
463 handles().release(reinterpret_cast<offset_index_space_handle&>(xid_space));
467 ensure(is_basic_query);
485 bool result = (lid_space != 0) && handles().allocated(*lid_space);
489 ensure(is_basic_query);
501 sheaf::offset_index_space_state::
512 ensure(is_basic_query);
600 iterators().release(reinterpret_cast<offset_index_space_iterator&>(xitr));
604 ensure(is_basic_query);
622 bool result = (litr != 0) && iterators().allocated(*litr);
626 ensure(is_basic_query);
638 sheaf::offset_index_space_state::
649 ensure(is_basic_query);
667 static const std::string result(
"offset_index_space_state");
696 sheaf::offset_index_space_state::
789 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
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...
pod_type _offset
The offset into the hub id space.
static offset_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname, pod_type xoffset, size_type xct)
Create a new offset id space in the id space family xid_space at the next available id space index wi...
static size_type handle_pool_ct()
The number of handles in the pool.
virtual void release_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the iterator pool.
pod_type offset() const
The offset into the hub id space.
virtual index_space_iterator & get_iterator() const
Allocates an id space iterator from the iterator pool.
virtual pod_type index() const
Index of this space.
virtual index_space_handle & get_id_space() const
Allocates an id space handle from the handle pool.
An abstract iterator over the ids of an id space.
pod_type end() const
Ending id of this space.
virtual offset_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
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 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.
An implementation of class explicit_index_space_handle that has a offset id space state...
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 offset_index_space_state * clone() const
Virtual constructor; create a new instance of the same type at this.
virtual void detach()=0
Detach this handle form its state, if any.
virtual void release_id_space(index_space_handle &xid_space) const
Returns the id space handle xid_space to the handle 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.
Abstract base class with useful features for all objects.
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.
static size_type iterator_pool_ct()
The number of iterators in the pool.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
std::string name() const
Name of this space.
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
pod_type begin() const
Beginning id of this space.
virtual bool is_attached() const
True if this handle is attached to a state.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
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.
bool is_gathered() const
True if begin() == 0 and end() == ct().
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
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.
bool is_explicit_interval(pod_type xid)
True, if and only if the id space interval that contains index xid is an explicit interval...
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.
A computed implementation of abstract class explicit_index_space_state. This representation assumes t...
virtual bool contains(pod_type xid) const
True if this space contains id xid.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
virtual bool invariant() const
Class invariant.
void new_state(index_space_family &xid_spaces, const std::string &xname, bool xis_persistent)
Create a new id space state in the id space family xid_spaces at the next available id space index wi...
virtual ~offset_index_space_state()
Destructor.
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.
size_type _ct
The number of members.
bool invariant_check() const
True if invariant checking is enabled.
pod_index_type pod_type
The "plain old data" index type for this.
int_type pod_index_type
The plain old data index type.
offset_index_space_state()
Default constructor.
virtual const std::string & class_name() const
The name of this class.
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 handle_pool_deep_size()
The deep size of the handle pool.
static size_type iterator_pool_deep_size()
The deep size of the iterator pool.
virtual size_type ct() const
The number of members.
bool is_empty() const
True if there are no ids in the space.
Factory and container for a family of id spaces.
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.
An iterator over a gathered id space in which the equivlence between the ids in the space and the hub...
pod_type _begin
Beginning id of this space.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
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...
pod_type offset() const
The offset into the hub id space.