21 #include "SheafSystem/explicit_index_space_state.h" 23 #include "SheafSystem/abstract_product_structure.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/explicit_index_space_interval.h" 26 #include "SheafSystem/explicit_index_space_iterator.h" 27 #include "SheafSystem/factory.h" 28 #include "SheafSystem/hub_index_space_handle.h" 29 #include "SheafSystem/index_space_collection.h" 30 #include "SheafSystem/index_space_family.h" 31 #include "SheafSystem/scoped_index.h" 32 #include "SheafSystem/std_iomanip.h" 71 result = result && (
_ct == xother.
_ct);
73 result = result && (
_end == xother.
_end);
77 if(result && (_product != 0))
79 result = result && (*_product == *xother.
_product);
101 ensure(is_basic_query);
120 ensure(is_basic_query);
139 ensure(is_basic_query);
192 ensure((*
this) == xother);
202 const std::string& xname,
207 require(!xname.empty());
208 require(!xid_spaces.
contains(xname));
218 new_state(xid_spaces, result, xname, xis_persistent);
226 ensure(xid_spaces.
name(
index()) == xname);
240 const std::string& xname,
247 require(!xname.empty());
248 require(!xid_spaces.
contains(xname));
261 _host = lexplicit_interval;
267 lexplicit_interval->
insert(*
this);
278 ensure(
index() == xid);
280 ensure(xid_spaces.
name(
index()) == xname);
330 ensure(is_basic_query);
349 ensure(is_basic_query);
368 ensure(is_basic_query);
387 ensure(is_basic_query);
402 bool result = (
_ct == 0);
406 ensure(is_basic_query);
425 ensure(is_basic_query);
444 ensure(is_basic_query);
459 bool result = (
begin() == 0) && (
end() ==
ct());
463 ensure(is_basic_query);
484 ensure(is_basic_query);
503 ensure(is_basic_query);
522 ensure(is_basic_query);
543 ensure(is_basic_query);
563 ensure(is_basic_query);
582 ensure(is_basic_query);
601 ensure(is_basic_query);
720 ensure(is_basic_query);
815 ensure(is_basic_query);
836 ensure(is_basic_query);
855 ensure(is_basic_query);
908 ensure(is_basic_query);
929 ensure(is_basic_query);
952 xid_space.
attach_to(const_cast<explicit_index_space_state*>(
this));
1007 ensure(is_basic_query);
1022 bool result =
false;
1028 ensure(is_basic_query);
1051 xitr.
attach_to(const_cast<explicit_index_space_state*>(
this));
1075 static const std::string result(
"explicit_index_space_state");
1110 ensure(result != 0);
1135 require(other != 0);
1198 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
1214 ensure(result >= 0);
1229 using namespace std;
1231 xos <<
"class name: " << xe.
class_name() << endl;
1232 xos <<
"index: " << xe.
index() << endl;
1233 xos <<
"ct: " << xe.
ct() << endl;
1234 xos <<
"begin: " << xe.
begin() << endl;
1235 xos <<
"end: " << xe.
end() << endl;
1236 xos <<
"persistent: " << boolalpha << xe.
is_persistent() << noboolalpha << endl;
1242 xos << setw(10) << litr.
pod();
1251 xos << setw(10) << litr.
hub_pod();
virtual pod_type glued_hub_pod(pod_type xid) const
The pod index in the hub id space equivalent to xid in this id space. synonym for unglued_hub_pod(xid...
virtual void release_id_space(index_space_handle &xid_space) const =0
Returns the id space handle xid_space to the handle pool.
virtual bool allocated_iterator(const index_space_iterator &xitr) const =0
True if and only if id space iterator xitr was allocated by the iterator pool.
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
const index_space_collection * collection(pod_type xid) const
Id space collection for id xid (const version).
bool is_persistent() const
True if this id space should be written to disk.
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...
abstract_product_structure * _product
The product structure for this id space.
virtual index_space_handle & get_id_space() const =0
Allocates an id space handle from the handle pool.
virtual void attach_to(pod_type xindex)
Attach to the state with index xindex in the id space family id_spaces().
virtual const std::string & class_name() const
The name of this class.
virtual explicit_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
const index_space_collection & host() const
The host collection (const version).
size_type ct() const
The number of members.
std::string name(pod_type xid) const
The name for id xid.
virtual void attach_to(pod_type xindex)
Attach to the state with index xindex in the id space family id_spaces().
An abstract class that defines the product structure for an id space.
virtual explicit_index_space_state * clone() const =0
Virtual constructor; create a new instance of the same type at this.
An abstract iterator over the ids of an id space.
virtual pod_type unglued_hub_pod(pod_type xid) const =0
The pod index in the unglued hub id space equivalent to xid in this id space.
pod_type end() const
Ending id of this space.
pod_type pod() const
The current id in the iteration.
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
virtual void release_iterator(index_space_iterator &xitr) const =0
Returns the id space iterator xitr to the iterator pool.
const abstract_product_structure & product_structure() const
The product structure for this id space (const version).
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...
void put_name(pod_type xid, const std::string &xname)
Associate name xname with id space index xid.
const index_space_family & id_spaces() const
The id space family for this (const version).
bool has_product_structure() const
True if this id space has a product structure.
virtual void next()=0
Makes id() the next id in the iteration.
virtual bool is_attached() const =0
True if this handle is attached to a state.
An implementation of class sum_index_space_handle that has a primary sum id space state...
virtual const index_space_family & id_spaces() const =0
The id space family for this (const version).
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 contains_glued_hub(pod_type xid) const
True if this space contains an id equivalent to xid in the hub id space.
virtual void reset()=0
Restarts the iteration.
virtual void new_product_structure(const abstract_product_structure &xproduct)
Creates a new product structure for this id space by cloning the product structure, xproduct.
Abstract base class with useful features for all objects.
virtual pod_type pod(pod_type xid) const =0
The pod index in this space equivalent to xid in the unglued hub id space.
pod_type _index
The index of this id space.
bool is_done() const
True if iteration is finished.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
A factory for instanting descendants of an abstract type T, given the class name of the descendant...
An implementation of class index_space_handle for an explicit_index_space_state.
pod_type begin() const
Beginning id of this space.
An index within the external ("client") scope of a given id space.
virtual bool is_attached() const
True if this handle is attached to a state.
void invalidate_extrema()
Invalidate the extrema.
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.
virtual void delete_product_structure()
Deletes the product structure for this id space.
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.
virtual ~explicit_index_space_state()
Destructor.
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 bool contains_unglued_hub(pod_type xid) const =0
True if this space contains an id equivalent to xid in the unglued hub id space.
A collection of id space states. This is a virtual class with provides an interface for accessing the...
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
virtual index_space_iterator & get_iterator() const =0
Allocates an id space iterator from the iterator pool.
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...
An implementation of index_space_interval for an interval of explicit id spaces.
explicit_index_space_state()
Default constructor.
void insert(explicit_index_space_state &xid_space)
Insert the explicit id space xid_space into this interval.
size_type _ct
The number of members.
virtual bool is_attached() const =0
True if this iterator is attached to a state.
bool invariant_check() const
True if invariant checking is enabled.
virtual bool contains(pod_type xid) const =0
True if this space contains id xid.
pod_index_type pod_type
The "plain old data" index type for this.
virtual bool allocated_id_space(const index_space_handle &xid_space) const =0
True if and only if id space handle xid_space was allocated by the handle pool.
An implementation of class index_space_iterator for an explicit_index_space_state.
pod_type index() const
The index of this id space.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
virtual bool invariant() const
Class invariant.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
virtual pod_type glued_hub_pod(pod_type xid) const
The pod index in the glued hub id space equivalent to xid in this id space.
bool is_empty() const
True if there are no ids in the space.
bool _is_persistent
True if this id space should be written to disk.
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.
pod_type reserve_next_explicit_id()
Reserve the next available id for an explicit index space.
pod_type hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space. synonym for unglued_hub...
const hub_index_space_handle & hub_id_space() const
The hub id space of this family.
virtual abstract_product_structure * clone() const =0
Virtual constructor, makes a new instance of the same type as this.
index_space_collection * _host
The host collection.
pod_type hub_pod() const
The current unglued hub id in the iteration. synonym for unglued_hub_pod().
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.