20 #include "SheafSystem/section_iteration_state.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/base_space_poset.h" 24 #include "SheafSystem/binary_section_space_schema_member.h" 25 #include "SheafSystem/block.impl.h" 26 #include "SheafSystem/error_message.h" 27 #include "SheafSystem/eval_family.h" 28 #include "SheafSystem/section_evaluator.h" 29 #include "SheafSystem/section_space_schema_member.h" 30 #include "SheafSystem/section_space_schema_poset.h" 31 #include "SheafSystem/sec_vd.h" 32 #include "SheafSystem/structured_block_1d.h" 33 #include "SheafSystem/structured_block_2d.h" 34 #include "SheafSystem/structured_block_3d.h" 61 vertex_discretization =
false;
62 correction_enabled =
false;
83 eval_sp.detach_from_state();
85 for(
int i=1; i<eval_mbrs.ct(); ++i)
94 if(disc_to_seq_map != 0)
96 delete disc_to_seq_map;
124 down_set.reserve(32);
125 visited.extend_to(base_space_host->member_index_ub().pod());
133 if(!eval_sp.is_attached())
138 eval_id.invalidate();
141 if(eval_mbrs.ub() == 0)
143 eval_mbrs.reserve(4);
155 if(!disc_sp.is_attached())
163 disc_sp.attach_to_state(&xschema.
evaluation());
164 vertex_discretization =
false;
170 vertex_discretization = (disc_sp.name() ==
"__vertices");
173 disc_to_seq_map =
new unordered_map<pod_index_type, pod_index_type>();
177 disc_to_seq_map->clear();
189 discretization_members.reserve(ldisc_ub);
190 dofs.reserve(ldisc_ub*df);
195 if(correction_set.empty())
197 initialize_correction_set();
200 correction_enabled =
false;
226 base_space_host = &xbase_space_host;
230 down_set.reserve(1024);
231 visited.extend_to(base_space_host->member_index_ub().pod());
236 evaluators = eval_family::new_family(
"dlinear",
237 *base_space_host->name_space());
240 if(!eval_sp.is_attached())
245 eval_id.invalidate();
248 if(eval_mbrs.ub() == 0)
250 eval_mbrs.reserve(4);
262 if(!disc_sp.is_attached())
265 disc_sp.attach_to_state(&base_space_host->vertices());
266 disc_to_seq_map =
new unordered_map<pod_index_type, pod_index_type>();
267 vertex_discretization =
true;
271 disc_to_seq_map->clear();
284 discretization_members.reserve(ldisc_ub);
285 dofs.reserve(ldisc_ub*df);
289 if(correction_set.empty())
291 initialize_correction_set();
294 correction_enabled =
false;
319 correction_set.insert(base_space_host->prototype_type_id(
"triangle_complex"));
321 correction_set.insert(base_space_host->prototype_type_id(
"quad_complex"));
339 require(discretization_members.ct() == 2);
366 base_space_host->first_cover_member(
UPPER, xgreater_index.
hub_pod());
368 bool is_reversed = (eval_id != first_eval);
373 discretization_members[0].disc_id = discretization_members[1].disc_id;
374 discretization_members[1].disc_id = save;
393 vertex_discretization &&
394 (correction_set.find(base_space_host->type_id(eval_id)) !=
395 correction_set.end());
412 eval_type_id = base_space_host->type_id(eval_id);
413 eval = evaluators->member(eval_type_id);
414 eval_mbr = eval_mbrs[base_space_host->db(eval_id)];
415 eval_mbr->attach_to_state(base_space_host, eval_id);
419 ensure(eval_id == xindex);
420 ensure(local_id == 0);
422 ensure(eval_mbr != 0);
423 ensure(eval_mbr->is_attached());
443 eval_type_id = base_space_host->type_id(eval_id);
444 eval = evaluators->member(eval_type_id);
448 ensure(eval_id == xindex);
449 ensure(local_id == 0);
465 size_type lct = discretization_members.ct();
467 if(lct == discretization_members.ub())
469 discretization_members.reserve(2*lct);
474 discretization_members.set_ct(lct+1);
480 ldisc_context.
eval_id = eval_id;
482 ldisc_context.
disc_id = xindex;
484 if(correction_enabled && (discretization_members.ct() == 2))
486 ensure_discretization_order(xgreater_index);
497 size_type lct = discretization_members.ct();
499 if(lct == discretization_members.ub())
501 discretization_members.reserve(2*lct);
506 discretization_members.set_ct(lct+1);
512 ldisc_context.
eval_id = eval_id;
514 ldisc_context.
disc_id = xindex;
530 require(dynamic_cast<const binary_section_space_schema_member*>(&xsec.
schema()) != 0);
541 dofs.reserve(row_dof_ct);
543 dofs.set_ct(row_dof_ct);
547 size_type ldisc_ct = discretization_members.ct();
549 dofs.reserve(ldisc_ct*df);
557 scoped_index ldisc_id = discretization_members[i].disc_id;
564 dofs.set_ct(ldofs_ct);
586 require_for_all(i, 0, xother_pts.
ct(), disc_sp.contains_member(xother_pts[i].disc_id));
scoped_index eval_id
The eval member the disc member is contained in.
A context for discretization members. Intended for implementing various iterators, especially concurrent iterations over multiple sections.
scoped_index disc_id
The global index of the disc member.
void initialize(const section_space_schema_member &xschema)
Inializes an instance with schema xschema.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
size_type ct() const
The number of items currently in use.
A homogeneous collection of connected quads arranged in an i_size() x j_size() array.
void initialize_order_correction()
Previsit action for eval_sp members.
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.
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
void gather_dofs(const sec_vd &xsec)
Gathers dofs from xsec into the dofs buffer.
void set_evaluation_member(const scoped_index &xindex)
Sets eval_id to xindex, initializes local_id and eval.
virtual namespace_poset * name_space() const
The namespace of host()
A homogeneous collection of connected segments arranged in an i_size() array.
bool is_hub_scope() const
True if and only if the id space of this is the hub id space.
A client handle for a base space member which represents a homgeneous collection of local cells...
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
void dof_tuple(dof_type *xbuf, int xbuflen) const
Copies the entire dof tuple into xbuf.
int local_id
The local index of the disc member with respect to the eval member.
An index within the external ("client") scope of a given id space.
void ensure_discretization_order(const scoped_index &xgreater_index)
Ensures correct order of the discretization members.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
const bool UPPER
Selector for upper cover.
static int row_dof_ct(const namespace_poset &xns, const poset_path &xpath, bool xauto_access=true)
The number of row dofs defined by the schema specified by xns and xpath. Synonym for dof_ct(xns...
void attach_to_state(const poset_state_handle *xother)
Attach this handle to the same state as xother.
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).
sec_vd_value_type values[values_ub]
The values of another section (typically the global coordinates) at this disc point.
A section of a fiber bundle with a d-dimensional vector space fiber.
void gather_discretization_member(const scoped_index &xindex, const scoped_index &xgreater_index)
Puts xindex into the discretization gather buffer and, if enabled, corrects discretization order...
A homogeneous collection of connected hexahedra arranged in an i_size() x j_size() x k_size() array...
virtual void detach_from_state()
Detach this handle from its state, if any.
section_iteration_state()
True.
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
int_type pod_index_type
The plain old data index type.
~section_iteration_state()
Destructor.
void set_and_attach_evaluation_member(const scoped_index &xindex)
Sets eval_id to xindex, initializes local_id and eval, and attaches eval_mbr.
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...
int df() const
The dimension of the fiber space component.
void initialize_correction_set()
Initializes the set of evaluation member prototypes for which the discretization member order correct...
An auto_block with a no-initialization initialization policy.
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
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.