22 #include "SheafSystem/field_eval_iterator.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/base_space_member.h" 26 #include "SheafSystem/base_space_poset.h" 27 #include "SheafSystem/binary_section_space_schema_member.h" 28 #include "SheafSystem/eval_family.h" 29 #include "SheafSystem/sec_rep_descriptor.h" 30 #include "SheafSystem/section_evaluator.h" 31 #include "SheafSystem/section_space_schema_member.h" 32 #include "SheafSystem/section_space_schema_poset.h" 33 #include "SheafSystem/sec_ed_invertible.h" 34 #include "SheafSystem/sec_vd.h" 35 #include "SheafSystem/std_limits.h" 36 #include "SheafSystem/subposet_member_iterator.h" 37 #include "SheafSystem/field_vd.h" 54 fields::field_eval_iterator::
57 _coordinate_discretization_members(BUFFER_UB),
58 _property_discretization_members(BUFFER_UB),
59 _non_discretization_members(BUFFER_UB)
105 ensure(unexecutable(!
is_done() implies
this is
first member));
111 fields::field_eval_iterator::
116 _coordinate_discretization_members(BUFFER_UB),
117 _property_discretization_members(BUFFER_UB),
118 _non_discretization_members(BUFFER_UB)
165 ensure(unexecutable(!
is_done() implies
this is
first member));
179 delete _coordinate_schema_anchor;
182 delete _property_schema_anchor;
186 delete _property_has_been_visited;
266 const subposet& result = _evaluation;
290 result = _base_space->
db(
index());
442 bool result = (*_property_has_been_visited)[xhub_id];
476 require(dynamic_cast<const binary_section_space_schema_member*>(&xcoord.
schema()) != 0);
485 for(
size_type i=0; i<_coordinate_discretization_members.
ct(); ++i)
487 xcoord.
get_fiber(_coordinate_discretization_members[i], ldofs,
510 int lresult =
depth() - _top_zone_depth;
512 return lresult >= 0 ? lresult : 0;
531 _property_has_been_visited->
extend_to(lmember_index_ub);
558 (_property_has_been_visited->
ub() >= lmember_index_ub);
587 _coordinate_schema_anchor = xcoordinate_schema_anchor.
clone();
588 _coordinate_schema_anchor->
attach_to_state(&xcoordinate_schema_anchor);
592 _coordinate_evaluators =
605 ensure(_coordinate_schema_anchor->
is_same_state(&xcoordinate_schema_anchor));
606 ensure(_coordinate_schema_anchor->
version() == xcoordinate_schema_anchor.
version());
607 ensure(_coordinate_schema_anchor->
is_same_type(&xcoordinate_schema_anchor));
608 ensure(_coordinate_evaluators != 0);
631 _property_schema_anchor = xproperty_schema_anchor.
clone();
636 _property_evaluators =
648 ensure(_property_schema_anchor->
is_same_state(&xproperty_schema_anchor));
649 ensure(_property_schema_anchor->
version() == xproperty_schema_anchor.
version());
650 ensure(_property_schema_anchor->
is_same_type(&xproperty_schema_anchor));
651 ensure(_property_evaluators != 0);
652 ensure(_property_has_been_visited != 0);
675 _coordinate_correction_enabled =
false;
676 _property_correction_enabled =
false;
677 _coordinate_vertex_discretization =
679 _property_vertex_discretization =
697 require(xdisc_mbrs.
ct() == 2);
727 bool is_reversed = (_evaluator_id.
hub_pod() != first_eval);
732 xdisc_mbrs[0] = xdisc_mbrs[1];
733 xdisc_mbrs[1] = save;
761 _down_set_collection_enabled =
false;
762 _coordinate_discretization_members.
set_ct(0);
763 _property_discretization_members.
set_ct(0);
764 _non_discretization_members.
set_ct(0);
788 bool ltruncate = xtruncate;
798 if(
action() == PREVISIT_ACTION)
801 #ifdef DIAGNOSTIC_OUTPUT 803 <<
" id: " << setw(4) <<
index()
805 <<
" depth(): " << setw(4) <<
depth()
806 <<
" top_zone_depth: " << setw(14) << _top_zone_depth
816 bool lnone_of_the_above =
true;
826 _top_zone_depth =
depth();
834 _evaluator_id =
index();
839 bool lis_correctable =
840 (_correction_set.find(
type_id()) != _correction_set.end());
841 _coordinate_correction_enabled =
842 lis_correctable && _coordinate_vertex_discretization;
843 _property_correction_enabled =
844 lis_correctable && _property_vertex_discretization;
848 _coordinate_discretization_members.
set_ct(0);
850 for(
int i=0; i<_property_discretization_members.
ct(); ++i)
852 _property_has_been_visited->
put(_property_discretization_members[i].pod(),
true);
854 _property_discretization_members.
set_ct(0);
856 _non_discretization_members.
set_ct(0);
858 _down_set_collection_enabled =
true;
864 lnone_of_the_above =
false;
885 if(_property_correction_enabled &&
886 (_property_discretization_members.
ct() == 2))
891 lnone_of_the_above =
false;
904 if(_coordinate_correction_enabled &&
905 (_coordinate_discretization_members.
ct() == 2))
915 lnone_of_the_above =
false;
918 if(lnone_of_the_above)
922 if(_down_set_collection_enabled)
930 else if(
action() == POSTVISIT_ACTION)
932 if(
depth() == _top_zone_depth)
940 #ifdef DIAGNOSTIC_OUTPUT 941 cout <<
"postvisit: " 942 <<
" id: " << setw(4) <<
index()
944 <<
" depth(): " << setw(4) <<
depth()
945 <<
" top_zone_depth: " << setw(14) << _top_zone_depth
966 for(
int i=0; i<_coordinate_discretization_members.
ct(); ++i)
970 for(
int i=0; i<_property_discretization_members.
ct(); ++i)
975 for(
int i=0; i<_non_discretization_members.
ct(); ++i)
979 _non_discretization_members.
set_ct(0);
983 _down_set_collection_enabled =
false;
987 _coordinate_correction_enabled =
false;
988 _property_correction_enabled =
false;
1010 post_fatal_error_message(
"unrecognized action");
1036 if(xwas_eval_member)
1050 _top_zone_depth =
depth();
1060 _state = EXECUTE_PREVISIT_ACTION;
1088 for(
int i=0; i<_property_discretization_members.
ct(); ++i)
1090 _property_has_been_visited->
put(_property_discretization_members[i].pod(),
true);
1094 _coordinate_discretization_members.
set_ct(0);
1095 _property_discretization_members.
set_ct(0);
1096 _non_discretization_members.
set_ct(0);
1147 ensure(result != 0);
1171 invariance(
order() == BIORDER);
1181 invariance(unexecutable(
"coordinate discretization is not coarser than evaluation"));
1182 invariance(unexecutable(
"property discretization is not coarser than evaluation"));
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.
void repeat(bool xwas_eval_member)
Repeats the iteration over the down set of index(). If index() refers to a zone that has just been re...
void next()
Makes this the next member of the subset.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
virtual field_eval_iterator * clone() const
Make a new instance of the same type as this.
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...
section_evaluator & property_evaluator() const
The property field evaluator associated with the current evaluation member.
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.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
virtual bool is_ancestor_of(const any *xother) const
True if other conforms to this.
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
std::string type_name(pod_index_type xmbr_hub_id) const
The type id of the member with hub id xmbr_hub_id.
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.
Namespace for fields component of sheaf system.
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...
int refinement_depth(pod_index_type xmbr_hub_id) const
The refinement depth of the member with hub id xmbr_hub_id.
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.
pod_index_type type_id() const
The type id of the current member.
virtual void force_is_done()
Force the iterator to be done.
An iterator which concurrently traverses the schema of both the coordinates and property sections of ...
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
section_space_schema_member & coordinate_schema_anchor() const
The coordinates field schema member which is being iterated over.
A client handle for a general, abstract partially order set.
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 property_has_been_visited(pod_index_type xhub_id) const
True if xhub_id is the hub id of a property discretization member that has been visited previously...
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.
int ub() const
The upper bound for the domain index.
void update_capacity()
Updates capacity of internal data structures to match any changes in the size of the base space...
virtual namespace_poset * name_space() const
The namespace of host()
size_t depth() const
The length of the path from anchor() to the current member.
size_type refinement_depth() const
The refinement depth; the number of evaluation members the current evaluation member is contained in...
pod_index_type prototype_type_id(const std::string &xname, bool xauto_access=true) const
The type id of the base space member prototype with name xname.
section_space_schema_member & property_schema_anchor() const
The property field schema member which is being iterated over.
void attach_to_state(const poset_state_handle *xhost, pod_index_type xhub_id)
Attach this handle to the state with hub id xhub_id in the current version of host xhost...
void gather_coordinate_dofs(const sec_vd &xcoord, block< sec_vd::dof_type > &xdofs)
Gather the coordinate dofs for the current evaluation member from xcoord into xdofs.
const block< scoped_index > & property_discretization_members() const
The property discretization members in the downset of the current evaluation member.
void ensure_discretization_order(block< scoped_index > &xdisc_mbrs)
Ensures correct order of the discretization members.
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...
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.
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.
~field_eval_iterator()
Destructor.
pointer_type base() const
The underlying storage array.
void set_ct(size_type xct)
Sets ct() == xct.
const subposet & evaluation() const
The evaluation subposet shared by both schema.
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.
section_evaluator & coordinate_evaluator() const
The coordinate field evaluator associated with the current evaluation member.
zn_to_bool * make_false()
Constant function false, auto-allocated. Note on terminology: "false" is a keyword, so this function can not be just "false"
A vd-valued property as a function of global coordinates.
sec_vd & property() const
The dependent variable of this field.
const block< scoped_index > & coordinate_discretization_members() const
The coordinate discretization members in the downset of the current evaluation member.
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.
void initialize_property_schema(const section_space_schema_member &xanchor)
Initializes the property schema anchor.
void next()
Makes this the next member of the subset.
std::string evaluator_family_name() const
The name of the evaluator family for section spaces on schemae hosted by this.
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...
SHEAF_DLL_SPEC void max(const vd &x0, vd_value_type &xresult, bool xauto_access)
Maximum component of x0, pre-allocated version.
base_space_member & base_space() const
The base space of this field.
const scoped_index & greater_index() const
The index of the greater member of the current link.
std::string type_name() const
The type name of the current member.
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.
bool same_evaluation() const
True if the coordinates and property sections both use the same evaluation subposet.
static const poset_path & standard_schema_path()
The path of the schema required by this class.
virtual void detach_from_state()
Detach this handle from its state, if any.
void first()
Moves this to the first member of the iteration.
void initialize_coordinate_schema(const section_space_schema_member &xanchor)
Initializes the coordinate schema anchor.
iterator_state _state
The current state of iteration.
const base_space_poset & base_space() const
The base space shared by both schema.
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).
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
bool invariant() const
The class invariant.
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.
zn_to_bool * has_visited() const
The marker bit vector. /.
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
bool invariant() const
The class invariant.
sec_vd_dof_type dof_type
The type of degree of freedom.
A client handle for a poset member which has been prepared for use as a schema for a section space...
sec_ed_invertible & coordinates() const
The independent variable of this field.
virtual bool is_jim(pod_index_type xmbr_hub_id, bool xin_current_version=true) const
True if the member with hub id xmbr_hub_id is a jim in the current version (xin_current_version == tr...
bool state_is_read_accessible() const
True if this is attached and if the coordinates and property are accessible for read or access contro...
virtual subposet & jims()
The subset of all jims (mutable version)
virtual void reset(bool xreset_markers=true)
Restarts the iteration.
int df() const
The dimension of the fiber space component.
bool is_same_state(const poset_state_handle *xother) const
True if this is attached to the same state as xother.
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...
void extend_to(int xub)
Make the upper bound at least xub.
virtual schema_poset_member & schema()
The schema for this member (mutable version).
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.
int db() const
The dimension of the current evaluation member.
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.
bool enough_capacity() const
True if the internal data structures have enough capacity for the current size of base_space()...
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.
void initialize_discretization_order_correction()
Initializes the set of evaluation member prototypes for which the discretization member order correct...