20 #include "SheafSystem/discretization_iterator.h" 21 #include "SheafSystem/assert_contract.h" 22 #include "SheafSystem/section_space_schema_member.h" 23 #include "SheafSystem/section_space_schema_poset.h" 24 #include "SheafSystem/sec_rep_descriptor.h" 40 _ascending_has_visited = 0;
41 _descending_has_visited = 0;
82 if(_schema_anchor != 0)
85 delete _schema_anchor;
97 if(_ascending_has_visited != 0)
98 delete _ascending_has_visited;
161 invariance(
order()==BIORDER);
208 ensure(unexecutable(!
is_done() implies
this is
first member));
273 bool ltruncate = xtruncate;
283 if(
action()==PREVISIT_ACTION)
307 _discretization_member_index =
_index;
339 _ascending_has_visited->
put(
index().pod(),
true);
347 else if(
action()==POSTVISIT_ACTION)
366 _discretization_member_index =
_index;
390 while(!_up_set.
empty())
392 _ascending_has_visited->
put(_up_set.
front(),
false);
409 _evaluation_member_index =
_index;
422 post_fatal_error_message(
"unrecognized action");
490 define_old_variable(
bool old_descending =
_descending);
491 define_old_variable(
bool old_strict =
_strict);
518 ensure(
strict() == old_strict);
535 require(
schema_anchor().host()->contains_member(xschema_anchor_index));
539 define_old_variable(
bool old_descending =
_descending);
540 define_old_variable(
bool old_strict =
_strict);
542 define_old_variable(
int old_anchor_version =
anchor().version());
543 define_old_variable(
int old_schema_anchor_version =
schema_anchor().version());
566 ensure(
anchor().version() == old_anchor_version);
569 ensure(
strict() == old_strict);
571 ensure(
schema_anchor().version() == old_schema_anchor_version);
587 require(
schema_anchor().host()->contains_member(xschema_anchor_index));
591 define_old_variable(
bool old_descending =
_descending);
592 define_old_variable(
bool old_strict =
_strict);
594 define_old_variable(
int old_anchor_version =
anchor().version());
595 define_old_variable(
int old_schema_anchor_version =
schema_anchor().version());
605 ensure(
anchor().version() == old_anchor_version);
608 ensure(
strict() == old_strict);
610 ensure(
schema_anchor().version() == old_schema_anchor_version);
621 return _discretization_member_index;
632 return _evaluation_member_index;
674 if(_schema_anchor == 0)
676 _schema_anchor = xschema_anchor.
clone();
681 delete _schema_anchor;
682 _schema_anchor = xschema_anchor.
clone();
731 ensure(_ascending_has_visited != 0);
virtual void force_is_done()
Force the iterator to be done.
virtual void force_is_done()
Force the iterator to be done.
bool is_valid() const
True if this is a valid id.
int version(bool xunalias=true) const
The (possibly aliased) version of this component. The version of the host used when evaluating proper...
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
virtual discretization_iterator * clone() const
Make a new instance of the same type as this.
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
bool empty() const
Checks if the container has no elements, i.e. whether begin() == end().
action_type action() const
The type of action the client should take when the iterator returns control to the client...
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
bool is_multivalued() const
Switch that tells the user if the multivalued subposet exists.
virtual bool contains_member(pod_index_type xmbr_hub_id) const
True if this poset contains poset member with hub id xmbr_hub_id.
bool is_same_state(const poset_state_handle *xhost, pod_index_type xhub_id) const
True is this is attached to state with hub id xhub_id in host xhost.
void put(int i, bool value)
Sets i-th member to value.
section_space_schema_member & schema_anchor()
The schema member whose base space is being iterated over; the top member of the domain of iteration ...
reference front()
Returns a reference to the first element in the container.
void put_schema_anchor(const section_space_schema_member &xschema_anchor)
Set schema_anchor() to the same state as xschema_anchor.
void next()
Makes this the next member of the subset.
void invalidate()
Make this id invalid.
Abstract base class with useful features for all objects.
A map from Zn (the integers mod n) to bools. A characteristic function used to represent subsets of Z...
virtual abstract_poset_member & anchor()
The poset member whose downset is being iterated over; the top member of the domain of iteration (mut...
order_type order() const
The order of the iteration. Determines which actions are exported to the client.
void pop_front()
Removes the first element of the container.
An index within the external ("client") scope of a given id space.
virtual void initialize_has_visited(const abstract_poset_member &xanchor)
Initializes the has_visited markers.
bool descending() const
True if iterating over down set of anchor.
void next()
Makes this the next member of the subset.
Iterator over the discretization subposet associated with a section_space_schema_member anchor...
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
virtual void initialize_has_visited(const abstract_poset_member &xanchor)
Initializes the has_visited markers.
const scoped_index & discretization_member_index() const
The current discretization member index.
const scoped_index & evaluation_member_index() const
The current evaluation member index.
bool is_done() const
True if iteration finished.
void first()
Moves this to the first member of the iteration.
bool _descending
True if iterating over the up/down set of anchor.
virtual void reset(bool xreset_markers=true)
Restarts the iteration over the down set of anchor().
void put_has_visited(pod_index_type xhub_id, bool xvalue)
Set the visited marker for hub id xhub_id to xvalue. Intended for use reseting iterator without havin...
virtual void detach_from_state()
Detach this handle from its state, if any.
bool invariant_check() const
True if invariant checking is enabled.
total_poset_member & base_space()
The base space component of this (mutable version).
void push_front(const T &value)
Prepends the given element value to the beginning of the container.
void initialize_traversal(const abstract_poset_member &xanchor)
Initializes the anchor, has_visited markers and filter.
int_type pod_index_type
The plain old data index type.
void clear()
Removes all elements from the container.
zn_to_bool * has_visited() const
The marker bit vector. /.
bool invariant() const
The class invariant.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
A client handle for a poset member which has been prepared for use as a schema for a section space...
bool _strict
True if iterating over the strict up/down set of anchor.
An abstract client handle for a member of a poset.
discretization_iterator()
Default constructor; creates an unattached iterator.
bool invariant() const
The class invariant.
~discretization_iterator()
Destructor.
void initialize_schema_anchor(const section_space_schema_member &xanchor)
Initializes the schema anchor.
subposet & filter()
The subposet which is the filter; Defines what is passed, not what is blocked.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Namespace for the fiber_bundles component of the sheaf system.
bool is_same_type(const any *other) const
True if other is the same type as this.
virtual void attach_to_state(pod_index_type xbase_space_id, pod_index_type xfiber_schema_id)=0
Attach to the state in host() with component ids xbase_id and xfiber_schema_id.
void enable_invariant_check() const
Enable invariant checking.
bool is_multivalued() const
True, if the current discretization member is in the multivalued subposet.
bool strict() const
True if iterating over xstrict up/down set of anchor.
scoped_index _index
The index of the lesser end of the current link; the current item in the iteration.
section_space_schema_member * clone(bool xnew_state, bool xauto_access=true) const
Make a new handle instance of current. Attach the new instance to a new state if xnew_state is true...
subposet & multivalued()
The multivalued subposet for section spaces on this schema (mutable version).
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
const scoped_index & index() const
The index of the current member of the iteration.
pod_index_type base_space_id() const
The member id of the base space component of this.