21 #include "SheafSystem/primary_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/primary_index_space_handle.h" 27 #include "SheafSystem/primary_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);
159 ensure(
begin() == 0);
204 ensure(is_basic_query);
247 ensure(is_basic_query);
346 (void) explicit_index_space_state::operator=(xother);
351 ensure((*
this) == xother);
375 bool result = (0 <= xid) && (xid <
_end);
379 ensure(is_basic_query);
398 ensure(is_basic_query);
529 handles().release(reinterpret_cast<primary_index_space_handle&>(xid_space));
533 ensure(is_basic_query);
551 bool result = (lid_space != 0) && handles().allocated(*lid_space);
555 ensure(is_basic_query);
567 sheaf::primary_index_space_state::
578 ensure(is_basic_query);
666 iterators().release(reinterpret_cast<primary_index_space_iterator&>(xitr));
670 ensure(is_basic_query);
688 bool result = (litr != 0) && iterators().allocated(*litr);
692 ensure(is_basic_query);
704 sheaf::primary_index_space_state::
715 ensure(is_basic_query);
733 static const std::string result(
"primary_index_space_state");
762 sheaf::primary_index_space_state::
856 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
virtual void release_id_space(index_space_handle &xid_space) const
Returns the id space handle xid_space to the handle pool.
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...
static size_type iterator_pool_deep_size()
The deep size of the iterator pool.
size_type ct() const
The number of members.
virtual pod_type index() const
Index of this space.
An abstract iterator over the ids of an id space.
virtual primary_index_space_state * clone() const
Virtual constructor; create a new instance of the same type at this.
pod_type end() const
Ending id 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.
static size_type iterator_pool_ct()
The number of iterators in the pool.
virtual void extend(size_type xct)
Extend this id space to have ct() == xct.
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 bool contains(pod_type xid) const
True if this space contains id xid.
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 index_space_handle & get_id_space() const
Allocates an id space handle from the handle pool.
virtual ~primary_index_space_state()
Destructor.
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.
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.
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.
An implementation of class explicit_index_space_handle that has a primary id space state...
virtual const std::string & class_name() const
The name of this class.
static size_type handle_pool_deep_size()
The deep size of the handle pool.
primary_index_space_state()
Default constructor.
Abstract base class with useful features for all objects.
pod_type hub_term_id() const
The term id of this in the hub id space.
virtual index_space_iterator & get_iterator() const
Allocates an id space iterator from the iterator pool.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
pod_type offset() const
The offset into the hub id space.
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
std::string name() const
Name of this space.
static primary_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname, pod_type xoffset, size_type xct)
Create a new primary id space in the id space family xid_space at the next available id space index w...
pod_type begin() const
Beginning id of this space.
void put_hub_term_id(pod_type xhub_term_id)
Sets hub_term_id() to xhub_term_id.
virtual bool is_attached() const
True if this handle is attached to a state.
pod_type _hub_term_id
The term id of this in the hub id space.
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.
const hub_index_space_handle & hub_id_space() const
The hub id space.
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...
A computed implementation class explicit_index_space_state that is used for the terms of the primary ...
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 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...
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.
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 void release_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the iterator pool.
virtual primary_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
virtual bool invariant() const
Class invariant.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
virtual size_type ct() const
The number of members.
bool is_empty() const
True if there are no ids in the 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.
Factory and container for a family of id spaces.
pod_type offset() const
The offset into the hub id space.
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.
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 invariant() const
Class invariant.
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
The offset into the hub id space.
static size_type handle_pool_ct()
The number of handles in the pool.