21 #include "SheafSystem/field_refinement_buffer.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/array_section_dof_map.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/postorder_iterator.h" 29 #include "SheafSystem/local_field_refiner.h" 30 #include "SheafSystem/section_evaluator.h" 31 #include "SheafSystem/sec_ed_invertible.h" 32 #include "SheafSystem/sec_vd.h" 49 invariance(target.same_evaluation());
63 fields::field_refinement_buffer::
64 field_refinement_buffer(
const field_vd& xsource,
71 coord_disc_ids(xcoord_disc_ids),
72 prop_disc_ids(xprop_disc_ids),
73 has_been_pushed(xtarget.base_space().host()->member_index_ub().pod()),
75 evaluation(xtarget.coordinates().schema().evaluation()),
76 coord_discretization(xtarget.coordinates().schema().discretization()),
77 prop_discretization(xtarget.property().schema().discretization()),
78 coord_dofs(xcoord_disc_ids.ub()*xtarget.dc()),
79 coord_value(xtarget.dc()),
80 prop_dofs(xprop_disc_ids.ub()*xtarget.dp()),
81 prop_value(xtarget.dp()),
82 source_prop_value(xsource.dp()),
83 local_coords(xtarget.db()),
84 local_coords2(xtarget.db()),
85 same_discretization(xtarget.same_discretization()),
89 parent_subzone_id(new int[xdepth_ub])
97 require(xsource.
dc() == xtarget.
dc());
98 require(xsource.
dp() == xtarget.
dp());
130 fields::field_refinement_buffer::
144 coord_dofs(xcoord_disc_ids.ub()*xtarget.dc()),
146 prop_dofs(xprop_disc_ids.ub()*xtarget.dp()),
188 while(!litr.is_done())
375 require(xrefiner != 0);
381 int lparent_depth =
depth - 1;
502 require(unexecutable(
"dofs have been gathered for this zone"));
596 ensure(unexecutable(
"coord dof map has enough capacity for the fiber associated with xdisc_id"));
623 ensure(unexecutable(
"coord dof map has enough capacity for the fiber associated with xdisc_id"));
632 fields::field_refinement_buffer::
633 field_refinement_buffer()
665 fields::field_refinement_buffer::
double chart_point_coord_type
The type of local coordinate in the base space; the scalar type for the local coordinate vector space...
A client handle for a subposet.
section_evaluator * coord_evaluator
The section evaluator for the coordinates section of the target.
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.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
section_evaluator ** parent_prop_evaluator
The property section evaluators for the parent zones.
virtual const chart_point_coord_type * local_coordinates_map(size_type xi) const =0
The affine map from the local coordinates of refined zone xi the the local coordinates of the parent ...
block< sec_vd_dof_type > * parent_prop_dofs
A buffer for property dofs of the parent zones.
scattered_insertion_index_space_handle * coord_disc_seq_id_space
The discretization sequence id space of the target coordinates.
A buffer for data which is used by both a local_field_refiner object and its associated field_refinem...
subposet & coord_discretization
The discretization subposet of the coordinate section of the target.
namespace_poset & name_space() const
The namespace this resides in.
Namespace for fields component of sheaf system.
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.
const block< scoped_index > & prop_disc_ids
A buffer for gathering the property discretization members for the current zone.
virtual size_type refined_zone_ct() const =0
The number of refined zones created by this.
int dc() const
The dimension of the coordinates (independent variable) space.
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
void put(int i, bool value)
Sets i-th member to value.
block< sec_vd_value_type > coord_value
A buffer for computing coordinates at a point.
~field_refinement_buffer()
Destructor; not virtual, this can not be used as a base class.
void property_at_coordinates(const vd_lite &xcoord, vd_lite &xprop) const
The value of the property at the given global coordinates.
Dperecated. Use postorder_itr. Specialization of the filtered depth-first iterator which exposes the ...
bool same_discretization
True if target property uses same discretization as target coordinates.
virtual dof_type value_at_coord(const dof_type xdofs[], size_type xdofs_ub, const dof_type xlocal_coords[], size_type xlocal_coords_ub) const
Value at a specified local_coordinate. Single component version.
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
block< sec_vd_dof_type > coord_dofs
A buffer for gathering coordinate dofs.
int depth_ub
The upper bound for the refinement depth.
void gather_property_dofs()
Gathers the property dofs from the target for the current zone.
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...
void reserve_coord_fiber(const scoped_index &xdisc_id)
Ensures the coordinate dofs have enough capacity for discretization id xdisc.
void gather_coordinate_dofs()
Gathers the coordinate dofs from the target for the current zone.
const bool NOT_STRICT
Iteration strictness control.
const bool DOWN
Iteration directions.
A contiguous tuple, contiguous fiber representation of the abstract map from section dof ids to secti...
scattered_insertion_index_space_handle * elements_id_space
The sequence id space used by the elements subposet.
subposet & vertices()
The subposet containing all the vertices, that is, the cells of dimension 0 (mutable version)...
pointer_type base() const
The underlying storage array.
void set_ct(size_type xct)
Sets ct() == xct.
An index within the external ("client") scope of a given id space.
void refine_prop_dofs(local_field_refiner *xrefiner)
Evaluates the property dofs of the target in the parent zone for any discretization members that have...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
A vd-valued property as a function of global coordinates.
sec_vd & property() const
The dependent variable of this field.
subposet & prop_discretization
The discretization subposet of the property section of the target.
const block< scoped_index > & coord_disc_ids
A buffer for gathering the coordinate discretization members for the current zone.
virtual void center(coord_type xresult[], size_type xresult_ub) const
The local coordinates at the center of the evaluator.
field_vd & target
The field being refined.
base_space_member & base_space() const
The base space of this field.
block< sec_vd_value_type > prop_value
A buffer for computing target property at a point.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
int * parent_subzone_id
The index of the current subzone of the parent zones.
A section of a fiber bundle with a d-dimensional vector space fiber.
scattered_insertion_index_space_handle * vertices_id_space
The sequence id space used by the vertices subposet.
block< sec_vd_value_type > source_prop_value
A buffer for computing source property at a point.
bool same_evaluation() const
True if the coordinates and property sections both use the same evaluation subposet.
const scattered_insertion_index_space_handle & id_space() const
The id space for the members of with this (const version).
section_evaluator * prop_evaluator
The section evaluator for the property section of the target.
An abstract refiner for a field over a local region (primitive cell) in the base space.
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
void evaluate_at_center()
Evaluates the property, the coordinates, and the source property at the center of the zone...
const index_space_handle & discretization_id_space() const
The id space for the discretization members in the down set of the base space of this (const version)...
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
void reserve_fiber(pod_index_type xdisc_id)
Ensures this has the capacity to store the fiber with discretization id xdisc_id. ...
int_type pod_index_type
The plain old data index type.
const field_vd & source
The reference field.
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
bool invariant() const
Class invariant.
void save_parent()
Saves the prop_dofs and prop_evaluator of the current zone into the parent buffers.
A handle for a scattered_insertion_index_space_state.
sec_ed_invertible & coordinates() const
The independent variable of this field.
subposet & evaluation
The evaluation subposet used by both the coordinates and property sections of the target...
bool state_is_read_accessible() const
True if this is attached and if the coordinates and property are accessible for read or access contro...
subposet & elements()
The subposet containing the elements or zones, that is, the cells of maximal dimension.
void reserve_prop_fiber(const scoped_index &xdisc_id)
Ensures the property dofs have enough capacity for discretization id xdisc.
block< chart_point_coord_type > local_coords
A buffer for the local coordinates of a point.
int dp() const
The dimension of the property (dependent variable) space.
void push_prop_dofs()
Pushes the source property dofs to the target for any discretization members that have not already be...
void extend_to(int xub)
Make the upper bound at least xub.
block< chart_point_coord_type > local_coords2
Another buffer for the local coordinates of a point.
base_space_poset * base_space
The current base space.
double sec_vd_dof_type
The type of degree of freedom in the section space.
virtual void local_coordinates(pod_index_type xindex, coord_type xresult[], size_type xresult_ub) const =0
The local coordinates of the dof with local index xindex.
scattered_insertion_index_space_handle * prop_disc_seq_id_space
The discretization sequence id space of the target coordinates.
block< sec_vd_dof_type > prop_dofs
A buffer for gathering property dofs.
virtual section_dof_map & dof_map(bool xrequire_write_access=false)
The map from client_ids to dof values for this poset member (mutable version)
zn_to_bool has_been_pushed
True if i-th member has been pused.
virtual bool contains(pod_type xid) const
True if this space contains id xid.
void evaluate_source_at_disc(size_type xi)
Evaluates the coordinates and the source property at the position of the xi-th (local indexing) prope...
int depth
The refinement depth of the current zone.