21 #include "SheafSystem/gathered_insertion_index_space_state.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/index_space_iterator.h" 24 #include "SheafSystem/gathered_insertion_index_space_handle.h" 25 #include "SheafSystem/scoped_index.h" 131 ensure(
contains(old_next_id, xhub_id));
132 ensure(
ct() == old_ct + 1);
133 ensure(
ct() > 1 ?
begin() <= old_begin :
true);
134 ensure(
end() == old_next_id+1);
148 require(precondition_of(
push(xitr, xhub_id.
pod())));
156 ensure(postcondition_of(
push(xitr, xhub_id.
pod())));
203 _end = old_itr_id + 1;
209 ensure(
contains(old_itr_id, xhub_id));
210 ensure(
ct() == old_ct + 1);
211 ensure(
ct() > 1 ?
begin() == old_begin :
true);
212 ensure(
ct() > 1 ?
end() == old_end + 1 :
true);
213 ensure(xitr.
pod() == old_itr_id+1);
214 ensure(xitr.
hub_pod() == old_itr_hub_id);
236 ensure(is_basic_query);
299 ensure(!
contains(xid, old_hub_pod));
300 ensure((result != 0) ?
ct() == old_ct - 1 :
ct() == old_ct);
301 ensure((result == 0) || xupdate_extrema ||
begin() == old_begin);
302 ensure((result == 0) || xupdate_extrema ||
end() == old_end);
305 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
begin() >= old_begin :
true);
306 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
end() <= old_end :
true);
321 define_old_variable(
pod_type old_id =
pod(xhub_id));
325 define_old_variable(
pod_type old_pod =
pod(xhub_id));
348 ensure((result != 0) ?
ct() == old_ct - 1 :
ct() == old_ct);
349 ensure((result == 0) || xupdate_extrema ||
begin() == old_begin);
350 ensure((result == 0) || xupdate_extrema ||
end() == old_end);
353 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
begin() >= old_begin :
true);
354 ensure((result != 0) && xupdate_extrema && !
is_empty() ?
end() <= old_end :
true);
376 define_old_variable(
pod_type old_itr_id = xitr.
pod());
396 ensure(
ct() == old_ct - 1);
397 ensure(xupdate_extrema ||
begin() == old_begin);
398 ensure(xupdate_extrema ||
end() == old_end);
401 ensure(xupdate_extrema && !
is_empty() ?
begin() >= old_begin :
true);
402 ensure(xupdate_extrema && !
is_empty() ?
end() <= old_end :
true);
404 ensure(unexecutable(
"xitr.is_done() || xitr.hub_pod() == old_next_itr_hub_pod"));
496 ensure(is_basic_query);
625 ensure(
contains(old_next_id, xrange_id));
643 define_old_variable(
pod_type old_itr_pod = xitr.
pod());
652 ensure(
contains(old_itr_pod, xrange_id));
653 ensure(xitr.
pod() == old_itr_pod+1);
654 ensure(xitr.
hub_pod() == old_itr_hub_pod);
667 define_old_variable(
pod_type old_pod = xis_range_id ?
pod(xid) : xid);
668 define_old_variable(
pod_type old_hub_pod = xis_range_id ? xid :
hub_pod(xid));
669 define_old_variable(
bool old_contains_entry = xis_range_id ?
contains_hub(xid) :
contains(xid));
682 ensure(!old_contains_entry || !
contains(old_pod, old_hub_pod));
683 ensure((result == 0) || (result == 1));
702 define_old_variable(
pod_type old_itr_id = xitr.
pod());
711 ensure(xitr.
is_done() || xitr.
pod() > old_itr_id);
733 ensure(unexecutable(
"map rep is empty"));
752 ensure(unexecutable(
"map rep is gathered"));
802 (void) explicit_index_space_state::operator=(xother);
807 ensure((*
this) == xother);
857 static const std::string result(
"gathered_insertion_index_space_state");
939 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
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.
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...
virtual void map_rep_gather()=0
Gathers the map representation into an interval.
virtual gathered_insertion_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
size_type ct() const
The number of members.
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.
An abstract iterator over the ids of an id 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_...
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.
pod_type end() const
Ending id of this space.
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 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 bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
bool is_gathered() const
True if begin() == 0 and end() == ct().
void put_is_persistent(bool xis_persistent)
Set if this id space should be written to disk.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
virtual size_type map_rep_remove_entry(pod_type xid, bool xis_range_id)=0
Removes the entry containing range id xid (xis_range_id true) or domain id xid (xis_range_id false) f...
virtual void update_extrema()=0
Update the id extrema.
void clear()
Delete all ids.
pod_type _end
Ending id of this space.
Abstract base class with useful features for all objects.
virtual void map_rep_push(index_space_iterator &xitr, pod_type xrange_id)=0
Inserts entry (xitr.pod(), xrange_id) into the map representation. Increments all domain ids greater ...
virtual pod_type pod(pod_type xid) const =0
The pod index in this space equivalent to xid in the unglued hub 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...
pod_type begin() const
Beginning id of this space.
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.
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.
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 bool invariant() const
Class invariant.
virtual void map_rep_push_back(pod_type xrange_id)=0
Inserts entry (next_id(), xrange_id) into the map representation.
virtual void update_extrema_after_remove()
Update the id extrema after a remove operation.
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 void map_rep_clear()=0
Removes all entrires from the map representation.
virtual ~gathered_insertion_index_space_state()
Destructor.
size_type _ct
The number of members.
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 const std::string & class_name() const
The name of this class.
virtual bool invariant() const
Class invariant.
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.
An implementation of class explicit_index_space_state that supports gathered insertion of new members...
gathered_insertion_index_space_state()
Default constructor.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
pod_type _begin
Beginning id of this space.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
pod_type next_id() const
The id inserted by the next call to push_back.
void enable_invariant_check() const
Enable invariant checking.
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 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...
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.