21 #include "SheafSystem/edge_centered_polygon_refiner.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/base_space_poset.h" 25 #include "SheafSystem/bilinear_2d.h" 26 #include "SheafSystem/block.impl.h" 27 #include "SheafSystem/error_message.h" 28 #include "SheafSystem/field_refinement_buffer.h" 29 #include "SheafSystem/index_space_iterator.h" 30 #include "SheafSystem/integrable_section_evaluator.h" 31 #include "SheafSystem/linear_2d.h" 32 #include "SheafSystem/sec_ed_invertible.h" 33 #include "SheafSystem/std_algorithm.h" 34 #include "SheafSystem/std_iostream.h" 35 #include "SheafSystem/field_vd.h" 63 ensure(&
policy() == &xpolicy);
304 lcoord_disc_seq_id_space->
push_back(le_ctr);
334 lelements_id_space->
remove(lzone_id,
true);
396 if(lquad_evaluator != 0)
411 #ifdef DIAGNOSTIC_OUTPUT 531 assertion(lc_itr.
hub_pod() == ledge_begin.
pod());
547 if(lother_end == ledge_end.
pod())
592 ensure(unexecutable(xbase.contains_cover_link(result, BOTTOM_INDEX)));
619 int lzone_depth = lbase->refinement_depth(lzone_id);
620 int lnew_depth = lzone_depth + 1;
633 scoped_index lvertex_id(lbase->member_hub_id_space(
false));
655 lbase->clear_cover(
LOWER, lzone_id);
657 lbase->release_cover_id_space_iterator(lc_itr);
665 bool lunrefined = (lbase->refinement_depth(l_id) < lnew_depth);
669 assertion(lunrefined);
678 bool lprev_unrefined = lunrefined;
681 scoped_index ledge_ctr(lbase->member_hub_id_space(
false));
686 int ldepth = lbase->refinement_depth(l_id);
687 lunrefined = (ldepth < lnew_depth);
689 if(lunrefined && lprev_unrefined)
699 vertex_list_type::iterator ledge_ctr_pos =
_vertex_list.insert(litr, ledge_ctr);
708 if(ldepth <= lnew_depth)
725 lprev_unrefined = lunrefined;
748 #ifdef DIAGNOSTIC_OUTPUT 753 cout <<
"vertex buffer:\t ";
755 cout << endl << endl;
786 ensure(result.
ct() > 1);
807 int lzone_depth = lbase->refinement_depth(lzone_id);
808 int lnew_depth = lzone_depth + 1;
828 lnew_zone = lbase->member_id(
create_zone(*lbase, lnew_depth),
false);
833 lbase->new_link(lzone_id, lnew_zone);
842 size_type lv_first = lfirst_vertex_index[i];
843 vertex_list_type::iterator litr =
_vertex_pos[lv_first];
850 size_type lv_last = lfirst_vertex_index[i+1];
851 vertex_list_type::iterator llast_vertex_pos =
_vertex_pos[lv_last];
855 while(litr != llast_vertex_pos)
858 lbase->new_link(lnew_zone, *litr);
868 assertion(litr == llast_vertex_pos);
870 lbase->new_link(lnew_zone, *litr);
880 #ifdef DIAGNOSTIC_OUTPUT 882 cout <<
"zone: " << setw(6) << lnew_zone;
883 cout <<
" lower cover: ";
884 cover_set_state& lnew_zone_cvr = lbase->lower_cover(lnew_zone);
885 copy(lnew_zone_cvr.begin(),
887 ostream_iterator<scoped_index>(cout,
" "));
1052 require(xother != 0);
block< vertex_list_type::iterator > _vertex_pos
The position in _vertex_list of ids of the vertices in the currnet refinement.
vertex_list_type _vertex_list
List for processing vertices.
virtual bool invariant() const
Class invariant.
A client handle for a subposet.
section_evaluator * coord_evaluator
The section evaluator for the coordinates section of the target.
virtual void refine_base_space(field_refinement_buffer &xbuffer)
Refines the base space or the target.
void insert_cover_member(pod_index_type xother_mbr_hub_id, bool xlower, pod_index_type xmbr_hub_id)
Inserts hub id xother_mbr_hub id in the lower (xlower true) or upper (xlower false) cover set of the ...
virtual ~edge_centered_polygon_refiner()
Destructor.
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.
An abstract iterator over the ids of an id space.
index_space_iterator & get_cover_id_space_iterator(bool xlower, pod_index_type xmbr_hub_id) const
Allocates an iterator for the lower (xlower true) or upper (xlower false) cover id space of the membe...
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...
Namespace for fields component of sheaf system.
int refinement_depth(pod_index_type xmbr_hub_id) const
The refinement depth of the member with hub id xmbr_hub_id.
An abstract field refiner that subdivides a polygon by introducing new vertices into the centers of t...
virtual size_type refined_zone_ct() const =0
The number of refined zones created by this.
virtual const block< size_type > & first_vertex_index() const =0
The index in _vertex_pos of the first vertex of each new zone; contains number of zones + 1 because f...
size_type remove(const scoped_index &xid, bool update_extrema)
Removes the equivalence associated with xid.hub_pod(). synonym for remove_hub(xid.hub_pod(), xupdate_extrema). Returns the number of entries actually removed, either 0 or 1.
pod_index_type create_vertex(base_space_poset &xbase, int xdepth)
Creates a new vertex at depth xdepth.
pod_index_type create_edge_center(base_space_poset &xbase, const scoped_index &xzone_id, int xdepth, const scoped_index &xprev_mbr_id, const scoped_index &xmbr_id)
Creates a new edge center vextex and puts it in _new_point_ids[xid].
edge_centered_polygon_refiner()
Default constructor; disabled.
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
void make_new_zones(field_refinement_buffer &xbuffer)
Make the new zones in the refinement.
block< bool > _is_new_vertex
True if i-th member is a new vertex.
size_type refined_vertex_ct() const
The number of boundary vertices with refinement depth <= refined zone depth; does not include center ...
block< sec_vd_value_type > coord_value
A buffer for computing coordinates at a point.
void invalidate()
Make this id invalid.
virtual void next()=0
Makes id() the next id in the iteration.
block< scoped_index > _vertex_ids
The ids of the vertices in boundary <= new refinement depth.
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.
bool same_scope(const scoped_index &xother) const
True if and only if this is in the same id space as xother.
virtual void reset()=0
Restarts the iteration.
const field_refinement_policy & policy() const
The refinement policy for this refiner.
Abstract base class with useful features for all objects.
virtual int db() const
The base dimension; the dimension of the local coordinates (independent variable).
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 push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
bool is_done() const
True if iteration is finished.
scoped_index zone_id
The id of the current zone.
void pop_back()
Remove item at the back.
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 edge_center(pod_index_type xi, coord_type xresult[], size_type xresult_ub) const
The local cordinates of the xi-th edge.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
An abstract policy that determines the conditions under which a zone should be refined.
virtual void insert_member(pod_index_type xmbr_hub_id)
Inserts the member of host() with hub id xmbr_hub_id.
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access=true) const
True if some version of this poset contains poset member with hub id xmbr_hub_id. ...
void edge_center(pod_index_type xi, coord_type xresult[], size_type xresult_ub) const
The local cordinates of the xi-th edge.
const bool UPPER
Selector for upper cover.
void insert(pod_type xid, const scoped_index &xhub_id)
Make id xid in this id space equivalent to xhub_id in the hub id space. synonym for insert(xid...
virtual edge_centered_polygon_refiner * clone() const =0
Virtual constructor, creates a new instance of the same type as this.
virtual void center(coord_type xresult[], size_type xresult_ub) const
The local coordinates at the center of the evaluator.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
field_vd & target
The field being refined.
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.
const hub_index_space_handle & member_hub_id_space(bool xauto_access) const
The member hub id space.
scattered_insertion_index_space_handle * vertices_id_space
The sequence id space used by the vertices subposet.
const bool LOWER
Selector for lower cover.
void reserve_vertex_buffers()
Reserves space in vertex buffers.
virtual size_type unrefined_vertex_ct() const =0
The number of vertices with refinement depth <= unrefined zone depth.
An abstract refiner for a field over a local region (primitive cell) in the base space.
bool invariant_check() const
True if invariant checking is enabled.
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
A section evaluator using linear interpolation over a triangular 2D domain.
virtual void remove_member(pod_index_type xmbr_hub_id)
Removes the member of host() with hub id xmbr_hub_id.
int_type pod_index_type
The plain old data index type.
virtual void refine_coordinates(field_refinement_buffer &xbuffer)
Refines the coordinates of the target.
A handle for a scattered_insertion_index_space_state.
sec_ed_invertible & coordinates() const
The independent variable of this field.
void push_back(const scoped_index &xhub_id)
Make the next id in this space equivalent to xhub_id in the hub id space. synonym for push_back(xhub_...
subposet & elements()
The subposet containing the elements or zones, that is, the cells of maximal dimension.
virtual edge_centered_polygon_refiner & operator=(const local_field_refiner &xother)
Assignment operator.
block< chart_point_coord_type > local_coords
A buffer for the local coordinates of a point.
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...
pod_index_type create_zone(base_space_poset &xbase, int xdepth)
Creates a new quadrangle in base space xbase, with refinement depth xdepth.
size_type edge_ct() const
The number of edges in the zone.
scoped_index _zone_ctr_id
The id of the new vertex in the center of the zone.
virtual bool invariant() const
Class invariant.
void make_new_vertices(field_refinement_buffer &xbuffer)
Makes new vertices in edge centers as needed and builds the list of vertices in the boundary of the z...
base_space_poset * base_space
The current base space.
double sec_vd_dof_type
The type of degree of freedom in the section space.
bool in_jim_edit_mode() const
True if editing jims and jim order relation is allowed.
virtual bool is_zone_centered_refiner() const =0
True if this adds a vertex at the center of the zone.
An auto_block with a no-initialization initialization policy.
A section evaluator using bilinear interpolation over a square 2D domain.
bool is_same_type(const any *other) const
True if other is the same type as this.
void enable_invariant_check() const
Enable invariant checking.
virtual void modify_crg(field_refinement_buffer &xbuffer)
Modifies the cover relation graph of the base space.
block< scoped_index > _refined_zone_ids
The member ids of the zones created by the most recent execution of refine().
void release_cover_id_space_iterator(index_space_iterator &xcover_itr) const
Returns xcover_itr to the pool of id space iterators.
pod_type hub_pod() const
The current unglued hub id in the iteration. synonym for unglued_hub_pod().
void modify_subposets(field_refinement_buffer &xbuffer)
Modifies subposets in the base space.