21 #include "SheafSystem/singleton_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/singleton_index_space_handle.h" 27 #include "SheafSystem/singleton_index_space_iterator.h" 38 const std::string& xname,
43 require(!xname.empty());
44 require(!xid_spaces.
contains(xname));
50 lstate->new_state(xid_spaces, xname,
false);
52 lstate->_hub_id = xhub_id;
61 ensure(&result.
id_spaces() == &xid_spaces);
65 ensure(result.
name() == xname);
68 ensure(result.
hub_id() == xhub_id);
69 ensure(result.
ct() == 1);
81 const std::string& xname,
88 require(!xname.empty());
89 require(!xid_spaces.
contains(xname));
95 lstate->new_state(xid_spaces, xid, xname,
false);
97 lstate->_hub_id = xhub_id;
106 ensure(&result.
id_spaces() == &xid_spaces);
110 ensure(result.
index() == xid);
111 ensure(result.
name() == xname);
114 ensure(result.
hub_id() == xhub_id);
115 ensure(result.
ct() == 1);
155 ensure(
begin() == 0);
200 ensure(is_basic_query);
232 result = result && (_hub_id == lother._hub_id);
275 _hub_id = lother._hub_id;
277 (void) explicit_index_space_state::operator=(xother);
282 ensure((*
this) == xother);
306 bool result = (xid == 0);
310 ensure(is_basic_query);
325 bool result = (xhub_id == _hub_id);
329 ensure(is_basic_query);
460 handles().release(reinterpret_cast<singleton_index_space_handle&>(xid_space));
464 ensure(is_basic_query);
482 bool result = (lid_space != 0) && handles().allocated(*lid_space);
486 ensure(is_basic_query);
498 sheaf::singleton_index_space_state::
509 ensure(is_basic_query);
597 iterators().release(reinterpret_cast<singleton_index_space_iterator&>(xitr));
601 ensure(is_basic_query);
619 bool result = (litr != 0) && iterators().allocated(*litr);
623 ensure(is_basic_query);
635 sheaf::singleton_index_space_state::
646 ensure(is_basic_query);
664 static const std::string result(
"singleton_index_space_state");
693 sheaf::singleton_index_space_state::
786 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
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 operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
An iterator over an id space in which contains only one id.
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...
size_type ct() const
The number of members.
virtual void release_id_space(index_space_handle &xid_space) const
Returns the id space handle xid_space to the handle pool.
virtual singleton_index_space_state * clone() const
Virtual constructor; create a new instance of the same type at this.
virtual pod_type index() const
Index of this space.
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
An abstract iterator over the ids of an id space.
static singleton_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname, pod_type xhub_id)
Create a new singleton id space in the id space family xid_space at the next available id space index...
virtual void release_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the iterator pool.
pod_type end() const
Ending id of this 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 bool invariant() const
Class invariant.
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_iterator & get_iterator() const
Allocates an id space iterator from the iterator pool.
singleton_index_space_state()
Default constructor.
virtual void detach()=0
Detach this handle form its state, if any.
virtual singleton_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
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.
static size_type handle_pool_ct()
The number of handles in the pool.
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.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
virtual bool contains(pod_type xid) const
True if this space contains id xid.
std::string name() const
Name of this space.
virtual index_space_handle & get_id_space() const
Allocates an id space handle from the handle pool.
pod_type begin() const
Beginning id 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.
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.
static size_type iterator_pool_ct()
The number of iterators in the 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...
static size_type iterator_pool_deep_size()
The deep size of the iterator pool.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
pod_type hub_id() const
The hub id of the singleton id.
virtual ~singleton_index_space_state()
Destructor.
An implementation of class explicit_index_space_handle that has a singleton id space state...
size_type _ct
The number of members.
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.
bool invariant_check() const
True if invariant checking is enabled.
pod_type hub_id() const
The hub id of the singleton id.
pod_index_type pod_type
The "plain old data" index type for this.
int_type pod_index_type
The plain old data index type.
static size_type handle_pool_deep_size()
The deep size of the handle pool.
virtual bool invariant() const
Class invariant.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
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.
An implementation of explicit_index_space_state for an id space containing a single id...
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.
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...
const hub_index_space_handle & hub_id_space() const
The hub id space of this family.
virtual bool contains(pod_type xid) const
True if this space contains id xid.
virtual const std::string & class_name() const
The name of this class.