21 #include "SheafSystem/eval_iterator.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/base_space_member.h" 25 #include "SheafSystem/eval_family.h" 26 #include "SheafSystem/sec_rep_descriptor.h" 27 #include "SheafSystem/section_evaluator.h" 28 #include "SheafSystem/section_space_schema_member.h" 29 #include "SheafSystem/section_space_schema_poset.h" 30 #include "SheafSystem/sec_vd.h" 31 #include "SheafSystem/subposet_member_iterator.h" 42 const int BUFFER_UB = 16;
48 _discretization_members(BUFFER_UB),
49 _non_discretization_members(BUFFER_UB)
58 _down_set_collection_enabled =
false;
75 _discretization_members(BUFFER_UB),
76 _non_discretization_members(BUFFER_UB)
101 if(_schema_anchor != 0)
104 delete _schema_anchor;
122 bool result =
dynamic_cast<const eval_iterator*
>(xother) != 0;
168 invariance(
order() == BIORDER);
172 invariance(unexecutable(evaluation
subposet is above discretization
subposet));
192 _discretization_members(BUFFER_UB),
193 _non_discretization_members(BUFFER_UB)
204 _down_set_collection_enabled =
false;
220 ensure(unexecutable(!
is_done() implies
this is
first member));
241 (_schema_anchor != 0) &&
261 _down_set_collection_enabled =
false;
262 _discretization_members.
set_ct(0);
263 _non_discretization_members.
set_ct(0);
288 bool ltruncate = xtruncate;
298 if(
action() == PREVISIT_ACTION)
304 bool lnone_of_the_above =
true;
314 if(_vertex_discretization)
329 _disc_reversal_enabled =
330 (ltype_id == 5) || (ltype_id == 8) || (ltype_id == 9);
337 _discretization_members.
set_ct(0);
338 _non_discretization_members.
set_ct(0);
339 _down_set_collection_enabled =
true;
341 _evaluator_id =
index();
342 _maximal_eval_id =
index();
348 lnone_of_the_above =
false;
360 if(_disc_reversal_enabled)
389 bool is_reversed = (_evaluator_id != first_eval);
391 if(is_reversed && _discretization_members.
ct() == 2)
394 _discretization_members[0] = _discretization_members[1];
395 _discretization_members[1] = save;
404 lnone_of_the_above =
false;
407 if(lnone_of_the_above)
411 if(_down_set_collection_enabled)
423 else if(
action() == POSTVISIT_ACTION)
425 if(_maximal_eval_id ==~
index())
436 _down_set_collection_enabled =
false;
440 _disc_reversal_enabled =
false;
444 for(
int i=0; i<_discretization_members.
ct(); ++i)
449 for(
int i=0; i<_non_discretization_members.
ct(); ++i)
473 post_fatal_error_message(
"unrecognized action");
544 define_old_variable(
bool old_descending =
_descending);
545 define_old_variable(
bool old_strict =
_strict);
564 put_schema_variables();
576 ensure(
strict() == old_strict);
593 require(
schema_anchor().host()->contains_member(xschema_anchor_index));
598 define_old_variable(
bool old_descending =
_descending);
599 define_old_variable(
bool old_strict =
_strict);
601 define_old_variable(
int old_anchor_version =
anchor().version());
602 define_old_variable(
int old_schema_anchor_version =
schema_anchor().version());
633 ensure(
anchor().version() == old_anchor_version);
636 ensure(
strict() == old_strict);
638 ensure(
schema_anchor().version() == old_schema_anchor_version);
654 require(
schema_anchor().host()->contains_member(xschema_anchor_index));
659 define_old_variable(
bool old_descending =
_descending);
660 define_old_variable(
bool old_strict =
_strict);
662 define_old_variable(
int old_anchor_version =
anchor().version());
663 define_old_variable(
int old_schema_anchor_version =
schema_anchor().version());
673 ensure(
anchor().version() == old_anchor_version);
676 ensure(
strict() == old_strict);
678 ensure(
schema_anchor().version() == old_schema_anchor_version);
735 result = _base_space->
db(
index());
884 scoped_index result(*_disc_id_space, _discretization_members[xi]);
906 size_type ldisc_mbr_ct = ldisc_mbrs.ct();
911 size_type lnew_xdofs_ct = old_xdofs_ct + ldof_ct;
913 xdofs.
set_ct(lnew_xdofs_ct);
918 for(
int i=0; i<ldisc_mbr_ct; ++i)
920 xsec.
get_fiber(ldisc_mbrs[i], &xdofs[ldof_index],
950 size_type ldisc_mbr_ct = ldisc_mbrs.ct();
958 for(
int i=0; i<ldisc_mbr_ct; ++i)
960 xsec.
put_fiber(ldisc_mbrs[i], &xdofs[ldof_index],
991 if(_schema_anchor == 0)
993 _schema_anchor = xschema_anchor.
clone();
998 delete _schema_anchor;
999 _schema_anchor = xschema_anchor.
clone();
1026 fiber_bundle::eval_iterator::
1027 put_schema_variables()
1042 _disc_reversal_enabled =
false;
1052 if(_evaluators != 0)
poset_state_handle * host() const
The poset which this is a handle to a component of.
virtual void force_is_done()
Force the iterator to be done.
A client handle for a subposet.
bool is_valid() const
True if this is a valid id.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
int version(bool xunalias=true) const
The (possibly aliased) version of this component. The version of the host used when evaluating proper...
size_type ct() const
The number of items currently in use.
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
bool visit_once() const
True if traversal should only visit a member once; that is, it should not revisit members it has alre...
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
section_evaluator & evaluator()
The section evaluator associated with the current evaluation member (mutable version).
virtual eval_iterator * clone() const
Make a new instance of the same type as this.
action_type action() const
The type of action the client should take when the iterator returns control to the client...
abstract_poset_member * _anchor
The top member of the down set being iterated over.
row_dof_tuple_type * row_dof_tuple(pod_index_type xtuple_hub_id, bool xrequire_write_access=false) const
The row dof tuple with tuple hub id xtuple_hub_id.
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
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 void force_is_done()
Force the iterator to be done.
An iterator over the members of the evaluation subposet contained in the downset of the base space of...
pod_index_type member_dof_tuple_id(pod_index_type xmbr_hub_id, bool xauto_access) const
The dof tuple hub id of the member with hub id xmbr_hub_id.
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
void put_visit_once(bool xvisit_once)
Set visit_once() to xvisit_once.
virtual bool is_ancestor_of(const any *xother) const
True if other conforms to this.
section_space_schema_member & schema_anchor()
The schema member whose base space is being iterated over; the top member of the domain of iteration ...
virtual bool contains_member(pod_index_type xmbr_hub_id) const
True if this poset contains poset member with hub id xmbr_hub_id.
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
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 invalidate()
Make this id invalid.
pod_index_type type_id() const
The type id of the current evaluation member.
Abstract base class with useful features for all objects.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
static eval_family * new_family(const std::string &xname)
Creates an instance of the evaluator family associated with name xname.
bool invariant() const
The class invariant.
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
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.
~eval_iterator()
Destructor.
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 put_schema_anchor(const section_space_schema_member &xschema_anchor)
Set schema_anchor() to the same state as xschema_anchor.
void set_ct(size_type xct)
Sets ct() == xct.
An index within the external ("client") scope of a given id space.
virtual poset_type type_id() const
Identifier for the type of this poset.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
bool descending() const
True if iterating over down set of anchor.
const bool UPPER
Selector for upper cover.
int db(pod_index_type xmbr_hub_id) const
The base space dimension of the member with hub id xmbr_hub_id.
scoped_index client_id() const
The client id of the current evaluation member.
void next()
Makes this the next member of the subset.
void next()
Makes this the next member of the subset.
subposet & discretization()
The discretization subposet for section spaces on this schema (mutable version).
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
void initialize_schema_anchor(const section_space_schema_member &xanchor)
Initializes the schema anchor.
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...
const scoped_index & greater_index() const
The index of the greater member of the current link.
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.
bool is_done() const
True if iteration finished.
const scattered_insertion_index_space_handle & id_space() const
The id space for the members of with this (const version).
static const poset_path & standard_schema_path()
The path of the schema required by this class.
int db() const
The dimension of the current evaluation member.
void first()
Moves this to the first member of the iteration.
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
bool _descending
True if iterating over the up/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 reset(bool xreset_markers=true)
Restarts the iteration over the down set of anchor().
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 put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
eval_iterator()
Default constructor; creates an unattached iterator.
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
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.
bool invariant() const
The class invariant.
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.
sec_vd_dof_type dof_type
The type of degree of freedom.
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 ...
A client handle for a poset member which has been prepared for use as a schema for a section space...
base_space_poset & base_space()
The host of the anchor (mutable version).
int type_id
The cell type id.
bool _strict
True if iterating over the strict up/down set of anchor.
int df() const
The dimension of the fiber space component.
section_evaluator * member(pod_index_type xtype_id) const
The evaluator associated with cell type xtype_id. Note that the result may be void.
pod_index_type first_cover_member(bool xlower, pod_index_type xmbr_hub_id) const
Hub id of the first member of the lower (xlower true) or upper (xlower false) cover of the member wit...
subposet & filter()
The subposet which is the filter; Defines what is passed, not what is blocked.
block< scoped_index > & discretization_members()
The discretization members in the downset of the current evaluation member (mutable version)...
virtual schema_poset_member & schema()
The schema for this member (mutable version).
scoped_index discretization_client_id(size_type xi)
The client id of the xi-th discretization member in the downset of the current evaluation member...
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 strict() const
True if iterating over xstrict up/down set of anchor.
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...
base_space_poset & base_space()
The base space for section spaces on this schema.
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.