20 #include "SheafSystem/assert_contract.h" 21 #include "SheafSystem/block.h" 22 #include "SheafSystem/eval_family.h" 23 #include "SheafSystem/poset_state_handle.h" 24 #include "SheafSystem/postorder_iterator.h" 25 #include "SheafSystem/section_eval_iterator.h" 26 #include "SheafSystem/section_evaluator.h" 27 #include "SheafSystem/section_space_schema_member.h" 28 #include "SheafSystem/section_space_schema_poset.h" 40 require(is_ancestor_of(&xother));
51 _anchor->detach_from_state();
56 if(lother._anchor != 0)
62 _fiber_schema_itr = lother._fiber_schema_itr;
64 _evaluation_itr = lother._evaluation_itr;
70 ensure(is_initialized() ? anchor().is_same_state(&xother.
anchor()) :
true);
88 _anchor->detach_from_state();
128 invariance(any::invariant());
130 if(invariant_check())
132 disable_invariant_check();
134 invariance( is_initialized() == (_anchor != 0) );
135 invariance( is_initialized() == (_fiber_schema_itr.is_initialized()) );
136 invariance( is_initialized() == (_evaluation_itr.is_initialized()) );
140 enable_invariant_check();
162 bool result = _anchor != 0;
177 require(is_initialized());
196 require(is_initialized());
215 require(is_initialized());
238 require(is_initialized());
239 require(anchor().state_is_read_accessible());
243 _evaluation_itr.reset(xreset_markers);
244 _fiber_schema_itr.reset(xreset_markers);
249 ensure(is_initialized());
262 require(is_initialized());
263 require(anchor().state_is_read_accessible());
264 require(anchor().host()->contains_member(xanchor_index));
270 _anchor->attach_to_state(xanchor_index);
274 _evaluation_itr.put_schema_anchor(xanchor_index);
275 _evaluation_itr.reset(xreset_markers);
280 _fiber_schema_itr.put_anchor(anchor().fiber_schema_id());
281 _fiber_schema_itr.reset(xreset_markers);
286 ensure(is_initialized());
287 ensure(anchor().index() == xanchor_index);
300 require(is_initialized());
301 require(anchor().state_is_read_accessible());
302 require(anchor().host()->contains_member(xanchor_index));
306 reset(xanchor_index.
hub_pod(), xreset_markers);
311 ensure(is_initialized());
312 ensure(anchor().index() ==~ xanchor_index);
326 require(is_initialized() ? anchor_is_ancestor_of(xanchor) :
true);
332 reset_anchor(xanchor);
334 _evaluation_itr.put_schema_anchor(xanchor);
335 _evaluation_itr.reset();
342 string ldof_sp_name = schema_poset_member::dof_subposet_name(
"top",
false);
344 _fiber_schema_itr.put_anchor(&(xanchor.
fiber_schema()));
345 _fiber_schema_itr.put_filter(ldof_sp_name);
346 _fiber_schema_itr.reset();
351 ensure(is_initialized());
352 ensure(anchor().is_same_state(&xanchor));
353 ensure(anchor().is_same_type(&xanchor));
366 require(is_initialized());
367 require(xreset ? anchor().state_is_read_accessible():
true);
371 int result = _evaluation_itr.ct(xreset)*_fiber_schema_itr.ct(xreset);
376 ensure(evaluators_done());
377 ensure(components_done());
391 require(is_initialized());
392 require(anchor().state_is_read_accessible());
393 require(anchor().host()->contains_member(xhub_id));
398 _evaluation_itr.has_visited(anchor().host()->get_base_space_id_from_index(xhub_id)) &&
399 _fiber_schema_itr.has_visited(anchor().host()->get_fiber_schema_id_from_index(xhub_id));
414 require(is_initialized());
415 require(anchor().state_is_read_accessible());
416 require(anchor().host()->contains_member(xid));
420 return has_visited(xid.
hub_pod());
429 require(is_initialized());
430 require(anchor().state_is_read_accessible());
432 require(anchor().host()->is_same_state(xmbr.
host()));
436 bool result = _evaluation_itr.has_visited(xmbr.
base_space_id()) &&
453 require(is_initialized());
454 require(anchor().state_is_read_accessible());
455 require(anchor().host()->contains_member(xhub_id));
459 _evaluation_itr.put_has_visited(anchor().host()->get_base_space_id_from_index(xhub_id), xvalue);
460 _fiber_schema_itr.put_has_visited(anchor().host()->get_fiber_schema_id_from_index(xhub_id), xvalue);
464 ensure(has_visited(xhub_id) == xvalue);
478 require(is_initialized());
479 require(anchor().state_is_read_accessible());
480 require(anchor().host()->contains_member(xid));
484 put_has_visited(xid.
hub_pod(), xvalue);
488 ensure(has_visited(xid) == xvalue);
501 require(is_initialized());
503 require(!evaluators_done());
522 require(is_initialized());
524 require(!evaluators_done());
544 require(is_initialized());
546 require(!evaluators_done());
567 require(is_initialized());
571 result = _evaluation_itr.is_done();
587 require(is_initialized());
588 require(!evaluators_done());
592 _evaluation_itr.next(
false);
612 require(is_initialized());
616 result = _fiber_schema_itr.is_done();
632 require(is_initialized());
633 require(!components_done());
637 _fiber_schema_itr.next();
660 require(!evaluators_done());
680 require(!evaluators_done());
701 require(!components_done());
750 size_type ldisc_mbr_ct = ldisc_mbrs.ct();
755 size_type lnew_xdofs_ct = old_xdofs_ct + ldof_ct;
757 xdofs.
set_ct(lnew_xdofs_ct);
762 for(
int i=0; i<ldisc_mbr_ct; ++i)
764 xsec.
get_fiber(ldisc_mbrs[i], &xdofs[ldof_index],
795 size_type ldisc_mbr_ct = ldisc_mbrs.ct();
803 for(
int i=0; i<ldisc_mbr_ct; ++i)
805 xsec.
put_fiber(ldisc_mbrs[i], &xdofs[ldof_index],
868 ensure(
anchor().is_attached());
869 ensure(
anchor().is_same_state(&xanchor));
902 ensure(
anchor().is_same_state(&xanchor));
bool components_done() const
True if iteration over fiber components is finished.
virtual int ct(bool xreset=false)
The number of members of the iteration set, from the current member to the end, inclusive. If xreset, reset before computing the count.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
bool evaluators_done() const
True if iteration over the evaluation set is finished.
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
size_type ct() const
The number of items currently in use.
section_space_schema_member & anchor()
The schema member whose downset is being iterated over; the top member of the domain of iteration (mu...
schema_poset_member & fiber_schema()
The fiber schema component of this (mutable version).
virtual void next_component()
Makes the next fiber component the current fiber component.
const scoped_index & fiber_id() const
The id of the fiber schema member associated with the current component.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
void get_fiber(pod_index_type xdisc_id, vd_lite &xfiber) const
Sets xfiber to the fiber referred to by discretization id xdisc_id.
virtual bool is_schematized(bool xauto_access) const
True if this poset has been prepared for use as a schema, that is, if the top member has been schemat...
section_space_schema_member * _anchor
The schema member whose downset is being iterated over; the top member of the domain of iteration...
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
virtual bool anchor_is_ancestor_of(const section_space_schema_member &xmbr) const
True if xmbr conforms to the type of item of this.
virtual void reset_components()
Restarts iteration at first component of current evaluator.
virtual bool has_visited(pod_index_type xhub_id) const
True if this has already visited hub id xhub_id.
Abstract base class with useful features for all objects.
pod_index_type fiber_schema_id() const
The member id of the fiber schema component of this.
bool state_is_read_write_accessible() const
True if this is attached and if the state is accessible for read and write or access control is disab...
void set_ct(size_type xct)
Sets ct() == xct.
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 non-void state.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
section_evaluator & evaluator()
The evaluator (local section) associated with the current evaluation member (mutable version)...
bool invariant() const
The class invariant.
virtual section_eval_iterator * clone() const
Make a new instance of the same type as this.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
A section of a fiber bundle with a d-dimensional vector space fiber.
Iterates over the evaluation members of a section space schema anchor; gathers the dof ids for each e...
void scatter_dofs(sec_vd &xsec, const block< sec_vd::dof_type > &xdofs, size_type xindex)
Scatters the dofs for the current evalaution member from the location xindex and following of xdofs i...
block< scoped_index > & discretization_members()
The ids of the discretization members in the down set of the current evaluation member (mutable versi...
virtual ~section_eval_iterator()
Destructor.
virtual void reset(bool xreset_markers=true)
Restarts the iteration over the down set of anchor().
void reset_anchor(const section_space_schema_member &xanchor)
Creates anchor if needed and attaches it to xanchor.
virtual void next_evaluator()
Makes the next member of the evaluation set the current evaluation member.
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
postorder_iterator _fiber_schema_itr
The iterator for the fiber schema component.
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
int_type pod_index_type
The plain old data index type.
const scoped_index & evaluator_id() const
The id of the current evaluation member.
sec_vd_dof_type dof_type
The type of degree of freedom.
virtual section_eval_iterator & operator=(const section_eval_iterator &xother)
Assignment operator.
A client handle for a poset member which has been prepared for use as a schema for a section space...
int df() const
The dimension of the fiber space component.
section_eval_iterator()
Default constructor; creates an unattached iterator.
virtual bool is_ancestor_of(const any *xother) const
True if other conforms to this.
void gather_dofs(const sec_vd &xsec, block< sec_vd::dof_type > &xdofs)
Gathers the dofs for the current evalaution member from section xsec and appends them to the back of ...
virtual void reset(bool xreset_markers=RESET)
Restarts the iteration over the down set of anchor() If xreset_markers, set !has_visited for all memb...
virtual 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...
bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
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.
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...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
pod_index_type base_space_id() const
The member id of the base space component of this.