21 #include "SheafSystem/gathered_insertion_index_space_handle.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/index_space_family.h" 24 #include "SheafSystem/index_space_iterator.h" 25 #include "SheafSystem/gathered_insertion_index_space_state.h" 26 #include "SheafSystem/scoped_index.h" 63 ensure((*
this) == xother);
76 require(xid_spaces.
contains(xindex));
88 ensure(
index() == xindex);
97 const std::string& xname)
101 require(xid_spaces.
contains(xname));
113 ensure(
name() == xname);
135 ensure((*
this) == xother);
175 ensure(is_basic_query);
197 ensure(is_basic_query);
257 ensure(
contains(old_next_id, xhub_id));
258 ensure(
ct() == old_ct + 1);
259 ensure(
ct() > 1 ?
begin() <= old_begin :
true);
260 ensure(
end() == old_next_id+1);
275 require(precondition_of(
push(xitr, xhub_id.
pod())));
283 ensure(postcondition_of(
push(xitr, xhub_id.
pod())));
309 define_old_variable(
pod_type old_itr_id = xitr.
pod());
316 ensure(
contains(old_itr_id, xhub_id));
317 ensure(
ct() == old_ct + 1);
318 ensure(
ct() > 1 ?
begin() == old_begin :
true);
319 ensure(
ct() > 1 ?
end() == old_end + 1 :
true);
320 ensure(xitr.
pod() == old_itr_id+1);
321 ensure(xitr.
hub_pod() == old_itr_hub_id);
342 ensure(is_basic_query);
392 ensure(!
contains(xid, old_hub_pod));
393 ensure((result != 0) ?
ct() == old_ct - 1 :
ct() == old_ct);
394 ensure((result == 0) || xupdate_extrema ||
begin() == old_begin);
395 ensure((result == 0) || xupdate_extrema ||
end() == old_end);
398 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
begin() >= old_begin :
true);
399 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
end() <= old_end :
true);
416 define_old_variable(
pod_type old_id =
pod(xhub_id));
426 ensure((result != 0) ?
ct() == old_ct - 1 :
ct() == old_ct);
427 ensure((result == 0) || xupdate_extrema ||
begin() == old_begin);
428 ensure((result == 0) || xupdate_extrema ||
end() == old_end);
431 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
begin() >= old_begin :
true);
432 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
end() <= old_end :
true);
454 define_old_variable(
pod_type old_itr_id = xitr.
pod());
463 ensure(
ct() == old_ct - 1);
464 ensure(xupdate_extrema ||
begin() == old_begin);
465 ensure(xupdate_extrema ||
end() == old_end);
468 ensure(xupdate_extrema && !
is_empty() ?
begin() >= old_begin :
true);
469 ensure(xupdate_extrema && !
is_empty() ?
end() <= old_end :
true);
471 ensure(unexecutable(
"xitr.is_done() || xitr.hub_pod() == old_next_itr_hub_pod"));
514 ensure(is_basic_query);
557 ensure(is_basic_query);
623 ensure((*
this) == xother);
644 ensure(*result == *
this);
708 ensure(is_basic_query);
792 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
gathered_insertion_index_space_handle & operator=(const gathered_insertion_index_space_handle &xother)
Assignment operator; attach this handle to the state of xother. synonym for attach_to(xother).
virtual void attach_to(pod_type xindex)
Attach to the state with index xindex in the id space family id_spaces().
virtual pod_type index() const
Index of this space.
bool in_scope() const
True if and only if scope() contains an entry for pod().
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
bool is_empty() const
True if there are no ids in the space.
An abstract iterator over the ids of an id space.
pod_type next_id() const
The id inserted by the next call to push_back.
void push_back(const scoped_index &xhub_id)
Make the next id in this space equivalent to xhub_id in the hub id space. synonym for push_back(xhub_...
size_type remove(const scoped_index &xid, bool update_extrema)
Removes the equivalence associated with xid.hub_pod(). synonym for remove_hub(xid.hub_pod(), xupdate_extrema). Returns the number of entries actually removed, either 0 or 1.
virtual void reserve(size_type xcapacity)=0
Reserve enough memory for xcapacity number of ids.
pod_type pod() const
The current id in the iteration.
virtual size_type capacity() const =0
The number of ids reserved in memory.
virtual 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...
void gather()
Gathers this id space into an interval.
size_type remove(const scoped_index &xid, bool update_extrema)
Removes the equivalence associated with xid.hub_pod(). synonym for remove_hub(xid.hub_pod(), xupdate_extrema). Returns the number of entries actually removed, either 0 or 1.
virtual bool invariant() const
Class invariant.
void clear()
Delete all ids.
void put_is_persistent(bool xis_persistent)
Set if this id space should be written to disk.
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).
void put_is_persistent(bool xis_persistent)
Set if this id space should be written to disk.
virtual bool is_attached() const =0
True if this handle is attached to a state.
const hub_index_space_handle & hub_id_space() const
The hub id space.
virtual void update_extrema()=0
Update the id extrema.
void clear()
Delete all ids.
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
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...
gathered_insertion_index_space_state & state()
The gathered_insertion id space state (gathered_insertion version).
Abstract base class with useful features for all objects.
bool is_done() const
True if iteration is finished.
An implementation of class index_space_handle for an explicit_index_space_state.
std::string name() const
Name of this space.
pod_index_type pod_type
The "plain old data" index type for this.
virtual ~gathered_insertion_index_space_handle()
Destructor.
bool is_scoped() const
True if and only if scope() is attached.
void push(index_space_iterator &xitr, const scoped_index &xhub_id)
Makes id xitr.id() in this id space equivalent to xhub_id in the hub id space. Increments all ids gre...
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.
A handle for a gathered_insertion_index_space_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.
virtual bool invariant() const
Class invariant.
void reserve(size_type xcapacity)
Reserve enough memory for xcapacity number of ids.
size_type remove_hub(pod_type xhub_id, bool update_extrema)
Removes the equivalence associated with hub id xhub_id. Returns the number of entries actually remove...
gathered_insertion_index_space_handle()
Default constructor.
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...
void gather()
Gathers this id space into a 0-based, contiguous interval.
virtual bool contains(pod_type xlocal_id) const =0
True if this collection contains the id space with local id xlocal_id.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
virtual gathered_insertion_index_space_handle * clone() const
Virtual constructor, makes a new instance of the same type as this. If the handle is attached...
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...
size_type capacity() const
The number of ids reserved in memory.
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.
virtual pod_type begin() const
Beginning id of this space.
bool invariant_check() const
True if invariant checking is enabled.
void update_extrema()
Update the id extrema.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
virtual pod_type end() const
Ending id of this space.
void push_back(const scoped_index &xhub_id)
Make the next id in this space equivalent to xhub_id in the hub id space. synonym for push_back(xhub_...
virtual size_type ct() const
The number of members.
Factory and container for a family of id spaces.
An implementation of class explicit_index_space_state that supports gathered insertion of new members...
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
pod_type next_id() const
The id inserted by the next call to push_back.
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 contains(pod_type xid) const
True if this space contains id xid.
size_type remove_hub(pod_type xhub_id, bool update_extrema)
Removes the equivalence associated with hub id xhub_id. Returns the number of entries actually remove...
void push(index_space_iterator &xitr, const scoped_index &xhub_id)
Makes id xitr.id() in this id space equivalent to xhub_id in the hub id space. Increments all ids gre...
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.