ug4
ug::HangingNodeRefiner_MultiGrid Class Reference

Specialization of ug::HangingNodeRefiner for ug::MultiGrid. More...

#include <hanging_node_refiner_multi_grid.h>

+ Inheritance diagram for ug::HangingNodeRefiner_MultiGrid:

Public Types

typedef HangingNodeRefinerBase< MGSelectorBaseClass
 
enum  HNodeCoarsenMarks {
  HNCM_FIRST = HNRM_MAX + 1 , HNCM_NO_NBRS , HNCM_NONE , HNCM_PARTIAL ,
  HNCM_REPLACE , HNCM_ALL , HNCM_INVALID , HNCM_UNKNOWN
}
 
- Public Types inherited from ug::HangingNodeRefinerBase< MGSelector >
enum  HNodeRefMarks
 
typedef MGSelector selector_t
 

Public Member Functions

virtual bool adaptivity_supported () const
 returns whether the refiner is able to perform adaptive refinement More...
 
virtual void assign_grid (MultiGrid &mg)
 
virtual bool coarsening_supported () const
 returns true, if the refiner supports coarsening. More...
 
virtual Gridget_associated_grid ()
 DEPRECIATED! Use grid(). Has to return the associated grid. Pure virtual. More...
 
virtual Gridgrid ()
 Returns the grid associated with the refiner. More...
 
virtual void grid_to_be_destroyed (Grid *grid)
 
 HangingNodeRefiner_MultiGrid (MultiGrid &mg, SPRefinementProjector projector=SPNULL)
 
 HangingNodeRefiner_MultiGrid (SPRefinementProjector projector=SPNULL)
 
virtual MultiGridmulti_grid ()
 
virtual ~HangingNodeRefiner_MultiGrid ()
 
- Public Member Functions inherited from ug::HangingNodeRefinerBase< MGSelector >
void add_ref_mark_adjuster (SPIRefMarkAdjuster adjuster)
 Add a refmark adjuster, which will be called while marks are adjusted during refinement / coarsening. More...
 
virtual void clear_marks ()
 clears all marks. Default implementation is empty More...
 
 HangingNodeRefinerBase (SPRefinementProjector projector=SPNULL)
 
void mark (const TIterator &iterBegin, const TIterator &iterEnd, RefinementMark refMark=RM_REFINE)
 marks all elements between iterBegin and iterEnd. More...
 
virtual bool mark (Edge *e, RefinementMark refMark=RM_REFINE)
 
virtual bool mark (Face *f, RefinementMark refMark=RM_REFINE)
 
virtual bool mark (GridObject *o, RefinementMark refMark=RM_REFINE)
 marks the specified geometric object More...
 
virtual bool mark (Vertex *v, RefinementMark refMark=RM_REFINE)
 Marks an element for refinement. Default implementation is empty. More...
 
virtual bool mark (Volume *v, RefinementMark refMark=RM_REFINE)
 
virtual void mark_neighborhood (size_t numIterations, RefinementMark refMark, bool sideNbrsOnly)
 Marks the neighborhood of the current selection. More...
 
bool marked_adaptive (TElem *elem) const
 
bool marked_coarsen (TElem *elem) const
 
bool marked_refine (Edge *elem) const
 
bool marked_refine (TElem *elem) const
 
bool marked_regular (TElem *elem) const
 
virtual bool save_marks_to_file (const char *filename)
 Writes the associated grid and marks to a file. Pure virtual. More...
 
virtual ~HangingNodeRefinerBase ()
 
void enable_node_dependency_order_1 (bool bEnable)
 enables or disables node-dependency-order-1. More...
 
bool node_dependency_order_1_enabled ()
 enables or disables node-dependency-order-1. More...
 
virtual bool mark (Vertex *v, RefinementMark refMark=RM_REFINE)
 Marks a element for refinement. More...
 
virtual bool mark (Edge *e, RefinementMark refMark=RM_REFINE)
 Marks a element for refinement. More...
 
virtual bool mark (Face *f, RefinementMark refMark=RM_REFINE)
 Marks a element for refinement. More...
 
virtual bool mark (Volume *v, RefinementMark refMark=RM_REFINE)
 Marks a element for refinement. More...
 
virtual RefinementMark get_mark (Vertex *v) const
 Returns the mark of a given element. More...
 
virtual RefinementMark get_mark (Edge *e) const
 Returns the mark of a given element. More...
 
virtual RefinementMark get_mark (Face *f) const
 Returns the mark of a given element. More...
 
virtual RefinementMark get_mark (Volume *v) const
 Returns the mark of a given element. More...
 
- Public Member Functions inherited from ug::IRefiner
bool coarsen ()
 Performs coarsening on the elements marked RM_COARSEN. More...
 
bool debugging_enabled () const
 
void enable_debugging (bool enable)
 
int get_local_edge_mark (Face *f, Edge *e) const
 returns the local mark of the specified edge of the given face More...
 
int get_local_edge_mark (Volume *vol, Edge *e) const
 returns the local mark of the specified edge of the given volume More...
 
int get_local_face_mark (Volume *vol, Face *f) const
 returns the local mark of the specified face of the given volume More...
 
virtual RefinementMark get_mark (GridObject *o) const
 returns the mark of the specified geometric object More...
 
 IRefiner (SPRefinementProjector projector=SPNULL)
 
virtual bool local_marks_supported () const
 returns true, if the refiner supports local marks. More...
 
template<class TIterator >
void mark (const TIterator &iterBegin, const TIterator &iterEnd, RefinementMark refMark=RM_REFINE)
 marks all elements between iterBegin and iterEnd. More...
 
virtual bool mark (GridObject *o, RefinementMark refMark=RM_REFINE)
 marks the specified geometric object More...
 
void mark_neighborhood (size_t numIterations)
 marks the neighborhood of currently marked elements. More...
 
template<class TElem >
bool marked_closure (TElem *elem) const
 
template<class TElem >
bool marked_full (TElem *elem) const
 
template<class TElem >
bool marked_local (TElem *elem) const
 
size_t num_marked_edges ()
 returns the number of (globally) marked edges on all levels of the hierarchy More...
 
size_t num_marked_edges (std::vector< int > &numMarkedEdgesOut)
 returns the number of (globally) marked edges on all levels of the hierarchy More...
 
size_t num_marked_elements ()
 returns the number of (globally) marked grid-objects of highest dimension More...
 
size_t num_marked_elements (std::vector< int > &numMarkedElemsOut)
 returns the number of (globally) marked grid-objects of highest dimension More...
 
size_t num_marked_faces ()
 returns the number of (globally) marked faces on all levels of the hierarchy More...
 
size_t num_marked_faces (std::vector< int > &numMarkedFacesOut)
 returns the number of (globally) marked faces on all levels of the hierarchy More...
 
size_t num_marked_volumes ()
 returns the number of (globally) marked volumes on all levels of the hierarchy More...
 
size_t num_marked_volumes (std::vector< int > &numMarkedVolsOut)
 returns the number of (globally) marked volumes on all levels of the hierarchy More...
 
SPRefinementProjector projector ()
 
void refine ()
 Performs refinement on the marked elements. More...
 
void set_adjusted_marks_debug_filename (const char *filename)
 sets a filename to which adjusted marks are saved during refinement / coarsening More...
 
void set_projector (SPRefinementProjector projector)
 
virtual ~IRefiner ()
 
virtual void mark_local (Face *e, int mark)
 Marks a face or volume for local refinement. More...
 
virtual void mark_local (Volume *e, int mark)
 Marks a face or volume for local refinement. More...
 
virtual int get_local_mark (Face *e) const
 returns the local mark of the specified face or volume. More...
 
virtual int get_local_mark (Volume *e) const
 returns the local mark of the specified face or volume. More...
 
void adaption_begins ()
 notifies all listeners of the associated message-hub, that adaption begins / ends. More...
 
void adaption_ends ()
 notifies all listeners of the associated message-hub, that adaption begins / ends. More...
 
- Public Member Functions inherited from ug::GridObserver
virtual void elements_to_be_cleared (Grid *grid)
 
virtual ~GridObserver ()
 
virtual void vertex_created (Grid *grid, Vertex *vrt, GridObject *pParent=NULL, bool replacesParent=false)
 Notified whenever a new element of the given type is created in the given grid. More...
 
virtual void edge_created (Grid *grid, Edge *e, GridObject *pParent=NULL, bool replacesParent=false)
 Notified whenever a new element of the given type is created in the given grid. More...
 
virtual void face_created (Grid *grid, Face *f, GridObject *pParent=NULL, bool replacesParent=false)
 Notified whenever a new element of the given type is created in the given grid. More...
 
virtual void volume_created (Grid *grid, Volume *vol, GridObject *pParent=NULL, bool replacesParent=false)
 Notified whenever a new element of the given type is created in the given grid. More...
 
virtual void vertex_to_be_erased (Grid *grid, Vertex *vrt, Vertex *replacedBy=NULL)
 Notified whenever an element of the given type is erased from the given grid. More...
 
virtual void edge_to_be_erased (Grid *grid, Edge *e, Edge *replacedBy=NULL)
 Notified whenever an element of the given type is erased from the given grid. More...
 
virtual void face_to_be_erased (Grid *grid, Face *f, Face *replacedBy=NULL)
 Notified whenever an element of the given type is erased from the given grid. More...
 
virtual void volume_to_be_erased (Grid *grid, Volume *vol, Volume *replacedBy=NULL)
 Notified whenever an element of the given type is erased from the given grid. More...
 
virtual void vertices_to_be_merged (Grid *grid, Vertex *target, Vertex *elem1, Vertex *elem2)
 Notified when two elements of the same type are going to be merged. More...
 
virtual void edges_to_be_merged (Grid *grid, Edge *target, Edge *elem1, Edge *elem2)
 Notified when two elements of the same type are going to be merged. More...
 
virtual void faces_to_be_merged (Grid *grid, Face *target, Face *elem1, Face *elem2)
 Notified when two elements of the same type are going to be merged. More...
 
virtual void volumes_to_be_merged (Grid *grid, Volume *target, Volume *elem1, Volume *elem2)
 Notified when two elements of the same type are going to be merged. More...
 

Protected Member Functions

virtual void assign_hnode_marks ()
 
virtual void broadcast_marks_horizontally (bool vertices, bool edges, bool faces, bool allowDeselection=false)
 
virtual void broadcast_marks_vertically (bool vertices, bool edges, bool faces, bool volumes, bool allowDeselection=false)
 
virtual bool contains_edges ()
 called to check, whether another iteration of collect_objects_for_coarsen has to be performed. More...
 
virtual bool contains_faces ()
 allows to check whether a distributed grid contains faces More...
 
virtual bool contains_volumes ()
 allows to check whether a distributed grid contains volumes More...
 
virtual void copy_marks_to_vmasters (bool vertices, bool edges, bool faces, bool volumes)
 
virtual void copy_marks_to_vslaves (bool vertices, bool edges, bool faces, bool volumes)
 
void debug_save (ISelector &sel, const char *filename)
 temporary method, which will be removed when debugging is done. More...
 
virtual void num_marked_edges_local (std::vector< int > &numMarkedEdgesOut)
 returns the number of (globally) marked edges on this level of the hierarchy More...
 
template<class TElem >
void num_marked_elems (std::vector< int > &numMarkedElemsOut)
 
virtual void num_marked_faces_local (std::vector< int > &numMarkedFacesOut)
 returns the number of (globally) marked faces on this level of the hierarchy More...
 
virtual void num_marked_volumes_local (std::vector< int > &numMarkedVolsOut)
 returns the number of (globally) marked volumes on this level of the hierarchy More...
 
virtual bool one_proc_true (bool localProcTrue)
 
virtual bool perform_coarsening ()
 performs coarsening on the elements marked with RM_COARSEN. More...
 
virtual void post_coarsen ()
 called after elements have been removed in coarsening More...
 
virtual void pre_coarsen ()
 called before elements are removed in coarsening More...
 
virtual void pre_refine ()
 creates required vertices in higher levels. More...
 
virtual bool refinement_is_allowed (Edge *elem)
 a callback that allows to deny refinement of special edges More...
 
virtual bool refinement_is_allowed (Face *elem)
 a callback that allows to deny refinement of special faces More...
 
virtual bool refinement_is_allowed (Vertex *elem)
 a callback that allows to deny refinement of special vertices More...
 
virtual bool refinement_is_allowed (Volume *elem)
 a callback that allows to deny refinement of special volumes More...
 
void save_coarsen_marks_to_file (ISelector &sel, const char *filename)
 
void set_grid (MultiGrid *mg)
 performs registration and deregistration at a grid. More...
 
virtual void process_constraining_edge (ConstrainingEdge *cge)
 calls base implementation and replaces cge with a normal edge. More...
 
virtual void refine_edge_with_normal_vertex (Edge *e, Vertex **newCornerVrts=NULL)
 calls base implementation and replaces cge with a normal edge. More...
 
virtual void refine_edge_with_hanging_vertex (Edge *e, Vertex **newCornerVrts=NULL)
 calls base implementation and replaces cge with a normal edge. More...
 
virtual void refine_face_with_normal_vertex (Face *f, Vertex **newCornerVrts=NULL)
 calls base implementation and replaces cge with a normal edge. More...
 
virtual void refine_face_with_hanging_vertex (Face *f, Vertex **newCornerVrts=NULL)
 calls base implementation and replaces cge with a normal edge. More...
 
virtual void refine_volume_with_normal_vertex (Volume *v, Vertex **newVolumeVrts=NULL)
 calls base implementation and replaces cge with a normal edge. More...
 
virtual Vertexget_center_vertex (Edge *e)
 Returns the vertex associated with the edge. More...
 
virtual void set_center_vertex (Edge *e, Vertex *v)
 Associates a vertex with the edge. More...
 
virtual Vertexget_center_vertex (Face *f)
 Returns the vertex associated with the face. More...
 
virtual void set_center_vertex (Face *f, Vertex *v)
 Associates a vertex with the face. More...
 
template<class TElem >
void collect_child_corners (std::vector< Vertex * > &cornersOut, TElem *elem)
 collects corner vertices and fills them into the associated vector More...
 
virtual void restrict_selection_to_surface_coarsen_elements ()
 Makes sure that only surface elements are marked and that only coarsen marks are used. More...
 
virtual void restrict_selection_to_coarsen_families ()
 Deselects all elements which have an unselected sibling. More...
 
template<class TElem >
void restrict_selection_to_surface_coarsen_elements ()
 Deselects all non-surface elements and all elements not marked with RM_COARSEN. More...
 
template<class TElem >
void restrict_selection_to_coarsen_families ()
 Only complete families (all siblings are selected) may be coarsened. More...
 
virtual void collect_objects_for_coarsen (bool scheduleCoarseningBeginsMessage=false)
 adjusts the selection marks to those specified in HNodeCoarsenMarks. More...
 
- Protected Member Functions inherited from ug::HangingNodeRefinerBase< MGSelector >
void add_hmark (TElem *elem, HNodeRefMarks mark)
 
bool adjusting_ref_marks () const
 
virtual void collect_objects_for_refine ()
 marks unmarked elements that have to be refined due to marked neighbors. More...
 
virtual bool continue_collect_objects_for_refine (bool continueRequired)
 
MGSelectorget_refmark_selector ()
 returns the selector which is internally used to mark elements. More...
 
bool is_marked (Edge *e)
 
bool is_marked (Face *f)
 
bool is_marked (Vertex *v)
 
bool is_marked (Volume *v)
 
bool marked_to_constrained (TElem *elem) const
 
bool marked_to_constraining (TElem *elem) const
 
bool marked_to_normal (TElem *elem) const
 
void perform_refinement ()
 performs refinement on the marked elements. More...
 
virtual void post_refine ()
 
bool remove_coarsen_marks ()
 removes coarsen marks from the selection More...
 
void remove_hmark (TElem *elem, uint mark)
 
void set_grid (typename TSelector::grid_type *grid)
 performs registration and deregistration at a grid. More...
 
virtual void process_constrained_vertex (ConstrainedVertex *cdv)
 called to refine the specified element. More...
 
virtual void process_constrained_edge (ConstrainedEdge *cde)
 called to refine the specified element. More...
 
virtual void process_constrained_face (ConstrainedFace *cdf)
 called to refine the specified element. More...
 
virtual void process_constraining_face (ConstrainingFace *cgf)
 called to refine the specified element. More...
 
- Protected Member Functions inherited from ug::IRefiner
void set_message_hub (SPMessageHub msgHub)
 sets the message hub. More...
 

Private Attributes

MultiGridm_pMG
 

Additional Inherited Members

- Protected Types inherited from ug::HangingNodeRefinerBase< MGSelector >
typedef TSelector::template traits< Edge >::iterator sel_edge_iter
 
typedef TSelector::template traits< Face >::iterator sel_face_iter
 
typedef TSelector::template traits< Volume >::iterator sel_vol_iter
 
typedef TSelector::template traits< Vertex >::iterator sel_vrt_iter
 
- Protected Attributes inherited from ug::HangingNodeRefinerBase< MGSelector >
std::vector< SPIRefMarkAdjusterm_refMarkAdjusters
 
MGSelector m_selMarkedElements
 
- Protected Attributes inherited from ug::IRefiner
bool m_adaptionIsActive
 
std::string m_adjustedMarksDebugFilename
 
bool m_debuggingEnabled
 
SPMessageHub m_messageHub
 
int m_msgIdAdaption
 
SPRefinementProjector m_projector
 

Detailed Description

Specialization of ug::HangingNodeRefiner for ug::MultiGrid.

This class should be used, if hanging node refinement shall be applied on a hierarchical grid (ug::MultiGrid).

New elements will be constructed one level above their parent elements.

HangingNodeRefiner_MultiGrid supports coarsening. Please note that coarsening presumably has not yet reached its final implementation and behavior may thus change in future revisions. In the current implementation, refinement marks are removed during coarsening and coarsening marks are removed during refinement. In order to use coarsening and refinement on thus should first mark all elements which shall be coarsened, perform coarsening, then mark all elements will shall be refined and perform refinement (or vice versa).

Take a look at ug::HangingNodeRefinerBase for a more in-depth documentation.

Todo:
: Avoid the removal of refinement marks during coarsening and of coarsening marks during refinement.
See also
ug::HangingNodeRefinerBase, ug::HangingNodeRefiner_Grid

Member Typedef Documentation

◆ BaseClass

Member Enumeration Documentation

◆ HNodeCoarsenMarks

Enumerator
HNCM_FIRST 
HNCM_NO_NBRS 
HNCM_NONE 
HNCM_PARTIAL 
HNCM_REPLACE 
HNCM_ALL 
HNCM_INVALID 
HNCM_UNKNOWN 

Constructor & Destructor Documentation

◆ HangingNodeRefiner_MultiGrid() [1/2]

ug::HangingNodeRefiner_MultiGrid::HangingNodeRefiner_MultiGrid ( SPRefinementProjector  projector = SPNULL)

◆ HangingNodeRefiner_MultiGrid() [2/2]

ug::HangingNodeRefiner_MultiGrid::HangingNodeRefiner_MultiGrid ( MultiGrid mg,
SPRefinementProjector  projector = SPNULL 
)

◆ ~HangingNodeRefiner_MultiGrid()

ug::HangingNodeRefiner_MultiGrid::~HangingNodeRefiner_MultiGrid ( )
virtual

References set_grid().

Member Function Documentation

◆ adaptivity_supported()

virtual bool ug::HangingNodeRefiner_MultiGrid::adaptivity_supported ( ) const
inlinevirtual

returns whether the refiner is able to perform adaptive refinement

pure virtual!

Implements ug::IRefiner.

◆ assign_grid()

void ug::HangingNodeRefiner_MultiGrid::assign_grid ( MultiGrid mg)
virtual

Reimplemented in ug::AdaptiveRegularRefiner_MultiGrid.

References set_grid().

◆ assign_hnode_marks()

void ug::HangingNodeRefiner_MultiGrid::assign_hnode_marks ( )
protectedvirtual

This callback is called during execution of the refine() method after collect_objects_for_refine has returned. It is responsible to mark elements for hnode refinement. That means all elements on which a hanging node or constrained children shall be created have to be marked using mark_for_hnode_refinement during this method. The default implementation performs this marking for all local elements. Make sure to not mark any new elements for refinement during this method.

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References ug::HangingNodeRefinerBase< MGSelector >::add_hmark(), ug::HangingNodeRefinerBase< MGSelector >::assign_hnode_marks(), ug::Grid::associated_elements(), ug::MultiGrid::begin(), ug::MultiGrid::end(), ug::MultiGrid::get_child_edge(), ug::HangingNodeRefinerBase< MGSelector >::HNRM_TO_CONSTRAINING, m_pMG, ug::HangingNodeRefinerBase< MGSelector >::marked_refine(), ug::MultiGrid::num_child_edges(), ug::MultiGrid::num_child_faces(), refinement_is_allowed(), and ug::PointerConstArray< TPtr >::size().

Referenced by ug::ParallelHangingNodeRefiner_MultiGrid::assign_hnode_marks().

◆ broadcast_marks_horizontally()

virtual void ug::HangingNodeRefiner_MultiGrid::broadcast_marks_horizontally ( bool  vertices,
bool  edges,
bool  faces,
bool  allowDeselection = false 
)
inlineprotectedvirtual

This callback is called during execution of the coarsen() method after collect_objects_for_coarsen is done. It is responsible to mark elements for hnode coarsening. That means all elements on which a hanging node or constrained children shall be created have to be marked using mark_for_hnode_refinement during this method. The default implementation performs this marking for all local elements.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

Referenced by collect_objects_for_coarsen().

◆ broadcast_marks_vertically()

virtual void ug::HangingNodeRefiner_MultiGrid::broadcast_marks_vertically ( bool  vertices,
bool  edges,
bool  faces,
bool  volumes,
bool  allowDeselection = false 
)
inlineprotectedvirtual

◆ coarsening_supported()

virtual bool ug::HangingNodeRefiner_MultiGrid::coarsening_supported ( ) const
inlinevirtual

returns true, if the refiner supports coarsening.

pure virtual!

Implements ug::IRefiner.

◆ collect_child_corners()

template<class TElem >
void ug::HangingNodeRefiner_MultiGrid::collect_child_corners ( std::vector< Vertex * > &  cornersOut,
TElem *  elem 
)
inlineprotected

collects corner vertices and fills them into the associated vector

The size of cornersOut is automatically adjusted. The i-th element of corners out will contain the child vertex of the i-th vertex of elem.

References ug::MultiGrid::get_child_vertex(), and m_pMG.

Referenced by refine_edge_with_hanging_vertex(), refine_edge_with_normal_vertex(), refine_face_with_hanging_vertex(), refine_face_with_normal_vertex(), and refine_volume_with_normal_vertex().

◆ collect_objects_for_coarsen()

void ug::HangingNodeRefiner_MultiGrid::collect_objects_for_coarsen ( bool  scheduleCoarseningBeginsMessage = false)
protectedvirtual

adjusts the selection marks to those specified in HNodeCoarsenMarks.

This method does not alter the selection itself, it only alters the selection-mark, associated with each selected element. It neither selects nor deselects any elements. It iterates over all selected elements of the given type and assigns one of the marks, depending on how many associated elements of the next higher dimension are selected. Note that this method should only be called for vertices, edges and faces. It does not make sense to call it for volumes. Applies marks like RM_COARSEN_CONSTRAINING or RM_COARSEN_UNCONSTRAIN This method should first be called for Face, then for Edge, then for Vertex. deselect coarsen families, which are adjacent to unselected constraining elements If at least one family was deselected, this method returns true. called by the coarsen method in order to adjust the selection to valid elements. This method is responsible to mark all elements that shall be coarsened. Only sub-surface elements may be coarsened. If a sub-surface element has a side, which is not a sub-surface element, then the element may not be coarsened. If scheduleCoarseningBeginsMessage is set to true, the method will schedule a GridMessage_Adaption message which indicates that coarsening begins.

References ug::Grid::associated_elements(), ug::MGSelector::begin(), broadcast_marks_horizontally(), broadcast_marks_vertically(), ug::MGSelector::clear(), contains_edges(), contains_faces(), contains_volumes(), ug::ContinuousDebugSave(), copy_marks_to_vmasters(), copy_marks_to_vslaves(), debug_save(), ug::IRefiner::debugging_enabled(), ug::ISelector::deselect(), ug::DeselectFamily(), ug::MGSelector::end(), ug::MultiGrid::get_child_vertex(), ug::MGSelector::get_grid_objects(), ug::MultiGrid::get_parent(), ug::HangingNodeRefinerBase< MGSelector >::get_refmark_selector(), ug::ISelector::get_selection_status(), ug::GMAT_HNODE_COARSENING_BEGINS, HNCM_ALL, HNCM_INVALID, HNCM_NO_NBRS, HNCM_NONE, HNCM_PARTIAL, HNCM_REPLACE, HNCM_UNKNOWN, ug::GridObject::is_constrained(), ug::ISelector::is_selected(), ug::IRefiner::m_messageHub, m_pMG, ug::HangingNodeRefinerBase< MGSelector >::m_selMarkedElements, one_proc_true(), PROFILE_FUNC, restrict_selection_to_coarsen_families(), restrict_selection_to_surface_coarsen_elements(), ug::ISelector::select(), ug::SelectAssociatedEdges(), ug::SelectAssociatedFaces(), ug::SelectAssociatedVertices(), and ug::PointerConstArray< TPtr >::size().

Referenced by perform_coarsening().

◆ contains_edges()

virtual bool ug::HangingNodeRefiner_MultiGrid::contains_edges ( )
inlineprotectedvirtual

called to check, whether another iteration of collect_objects_for_coarsen has to be performed.

This method is especially useful if coarsening shall be applied in a parallel environment. Each process calls this method and basses a boolean, which indicates if it requires the continuation of collect_objects_for_coarsen. If one process does require continuation, then all processes have to continue. The default implementation simply returns the local status. called during collect_objects_for_coarsen when coarsen-marks shall be distributed This method is especially useful if coarsening shall be applied in a parallel environment. A derived class can implement this method to schedule communication. The default implementation does nothing. allows to check whether a distributed grid contains edges The default implementation returns whether the local grid contains edges.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References m_pMG, and ug::MultiGrid::num().

Referenced by collect_objects_for_coarsen().

◆ contains_faces()

virtual bool ug::HangingNodeRefiner_MultiGrid::contains_faces ( )
inlineprotectedvirtual

allows to check whether a distributed grid contains faces

The default implementation returns whether the local grid contains faces.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References m_pMG, and ug::MultiGrid::num().

Referenced by collect_objects_for_coarsen().

◆ contains_volumes()

virtual bool ug::HangingNodeRefiner_MultiGrid::contains_volumes ( )
inlineprotectedvirtual

allows to check whether a distributed grid contains volumes

The default implementation returns whether the local grid contains volumes.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References m_pMG, and ug::MultiGrid::num().

Referenced by collect_objects_for_coarsen().

◆ copy_marks_to_vmasters()

virtual void ug::HangingNodeRefiner_MultiGrid::copy_marks_to_vmasters ( bool  vertices,
bool  edges,
bool  faces,
bool  volumes 
)
inlineprotectedvirtual

◆ copy_marks_to_vslaves()

virtual void ug::HangingNodeRefiner_MultiGrid::copy_marks_to_vslaves ( bool  vertices,
bool  edges,
bool  faces,
bool  volumes 
)
inlineprotectedvirtual

◆ debug_save()

void ug::HangingNodeRefiner_MultiGrid::debug_save ( ISelector sel,
const char *  filename 
)
protected

temporary method, which will be removed when debugging is done.

References ug::IRefiner::debugging_enabled(), pcl::ProcRank(), and save_coarsen_marks_to_file().

Referenced by collect_objects_for_coarsen(), and perform_coarsening().

◆ get_associated_grid()

virtual Grid* ug::HangingNodeRefiner_MultiGrid::get_associated_grid ( )
inlinevirtual

DEPRECIATED! Use grid(). Has to return the associated grid. Pure virtual.

Implements ug::IRefiner.

References m_pMG.

◆ get_center_vertex() [1/2]

Vertex * ug::HangingNodeRefiner_MultiGrid::get_center_vertex ( Edge e)
protectedvirtual

Returns the vertex associated with the edge.

Implements ug::HangingNodeRefinerBase< MGSelector >.

References ug::MultiGrid::get_child_vertex(), and m_pMG.

Referenced by process_constraining_edge().

◆ get_center_vertex() [2/2]

Vertex * ug::HangingNodeRefiner_MultiGrid::get_center_vertex ( Face f)
protectedvirtual

Returns the vertex associated with the face.

Implements ug::HangingNodeRefinerBase< MGSelector >.

References ug::MultiGrid::get_child_vertex(), and m_pMG.

◆ grid()

virtual Grid* ug::HangingNodeRefiner_MultiGrid::grid ( )
inlinevirtual

Returns the grid associated with the refiner.

Pure virtual. Specify this method in derived classes!

Implements ug::IRefiner.

References m_pMG.

◆ grid_to_be_destroyed()

void ug::HangingNodeRefiner_MultiGrid::grid_to_be_destroyed ( Grid grid)
virtual

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

References set_grid().

◆ multi_grid()

◆ num_marked_edges_local()

void ug::HangingNodeRefiner_MultiGrid::num_marked_edges_local ( std::vector< int > &  numMarkedEdgesOut)
protectedvirtual

returns the number of (globally) marked edges on this level of the hierarchy

Implements ug::IRefiner.

◆ num_marked_elems()

template<class TElem >
void ug::HangingNodeRefiner_MultiGrid::num_marked_elems ( std::vector< int > &  numMarkedElemsOut)
protected

◆ num_marked_faces_local()

void ug::HangingNodeRefiner_MultiGrid::num_marked_faces_local ( std::vector< int > &  numMarkedFacesOut)
protectedvirtual

returns the number of (globally) marked faces on this level of the hierarchy

Implements ug::IRefiner.

◆ num_marked_volumes_local()

void ug::HangingNodeRefiner_MultiGrid::num_marked_volumes_local ( std::vector< int > &  numMarkedVolsOut)
protectedvirtual

returns the number of (globally) marked volumes on this level of the hierarchy

Implements ug::IRefiner.

◆ one_proc_true()

virtual bool ug::HangingNodeRefiner_MultiGrid::one_proc_true ( bool  localProcTrue)
inlineprotectedvirtual

◆ perform_coarsening()

bool ug::HangingNodeRefiner_MultiGrid::perform_coarsening ( )
protectedvirtual

performs coarsening on the elements marked with RM_COARSEN.

The grid's message hub is informed using a "GridAdaption" message, passing an instance of GridMessage_Adapation, with values GMAT_HNODE_COARSENING_BEGINS and GMAT_HNODE_COARSENING_ENDS. See lib_grid/lib_grid_messages.h for more details.

automatically adjusts the selection so that only valid coarsening operations are executed. Not that refinement marks are removed in this process.

During a coarsening step only elements from the surface layer are removed. If not all children of a sub-surface element are marked, then the marks are ignored.

Note that coarsen in contrary to refine is conservative. While refine extends the selection to construct a valid grid, coarsen shrinks the selection. On could think of implementing an alternative non conservative coarsen approach. However, the conservative one is the one mostly used in adaptive multigrid methods and was thus chosen here.

coarsen returns false, if no elements have been coarsened, true if at least one has been coarsened.

Reimplemented from ug::IRefiner.

Reimplemented in ug::AdaptiveRegularRefiner_MultiGrid.

References ug::ConstrainingEdge::add_constrained_object(), ug::ConstrainingFace::add_constrained_object(), ug::GridObject::base_object_id(), ug::MGSelector::begin(), ug::HangingNodeRefinerBase< MGSelector >::clear_marks(), collect_objects_for_coarsen(), ug::ConstrainingEdge::constrained_vertex(), ug::ConstrainingFace::constrained_vertex(), ug::Grid::create_and_replace(), debug_save(), ug::IRefiner::debugging_enabled(), ug::ISelector::deselect(), ug::EDGE, ug::ElementDebugInfo(), ug::MGSelector::end(), ug::Grid::erase(), ug::FACE, ug::MultiGrid::get_child(), ug::MultiGrid::get_parent(), ug::HangingNodeRefinerBase< MGSelector >::get_refmark_selector(), ug::ISelector::get_selection_status(), ug::GMAT_HNODE_COARSENING_ENDS, HNCM_ALL, HNCM_PARTIAL, HNCM_REPLACE, ug::GridObject::is_constrained(), ug::GridObject::is_constraining(), ug::IRefiner::m_adjustedMarksDebugFilename, ug::IRefiner::m_messageHub, m_pMG, ug::MultiGrid::num_children(), ug::ConstrainingEdge::num_constrained_vertices(), ug::ConstrainingFace::num_constrained_vertices(), ug::ParallelLayoutDebugSave(), ug::MultiGrid::parent_type(), post_coarsen(), pre_coarsen(), PROFILE_FUNC, ug::Face::reference_object_id(), ug::RM_COARSEN, ug::ROID_QUADRILATERAL, ug::ROID_TRIANGLE, save_coarsen_marks_to_file(), ug::ConstrainedVertex::set_constraining_object(), ug::ConstrainedEdge::set_constraining_object(), ug::ConstrainedFace::set_constraining_object(), ug::ConstrainedVertex::set_local_coordinate_1(), ug::ConstrainedVertex::set_local_coordinates(), ug::ConstrainedVertex::set_parent_base_object_id(), ug::ConstrainedEdge::set_parent_base_object_id(), ug::ConstrainedFace::set_parent_base_object_id(), UG_ASSERT, UG_THROW, and ug::VOLUME.

Referenced by ug::AdaptiveRegularRefiner_MultiGrid::perform_coarsening().

◆ post_coarsen()

virtual void ug::HangingNodeRefiner_MultiGrid::post_coarsen ( )
inlineprotectedvirtual

called after elements have been removed in coarsening

Default implementation is emtpy

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

Referenced by perform_coarsening(), and ug::ParallelHangingNodeRefiner_MultiGrid::post_coarsen().

◆ pre_coarsen()

virtual void ug::HangingNodeRefiner_MultiGrid::pre_coarsen ( )
inlineprotectedvirtual

called before elements are removed in coarsening

Default implementation is emtpy

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

Referenced by perform_coarsening(), and ug::ParallelHangingNodeRefiner_MultiGrid::pre_coarsen().

◆ pre_refine()

◆ process_constraining_edge()

void ug::HangingNodeRefiner_MultiGrid::process_constraining_edge ( ConstrainingEdge cge)
protectedvirtual

calls base implementation and replaces cge with a normal edge.

Calls the base implementation and passes the mg-child vertices as newCornerVrts. If newCornerVrts were passed to this method, they are ignored.

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

References ug::Grid::create_and_replace(), get_center_vertex(), m_pMG, ug::HangingNodeRefinerBase< MGSelector >::marked_to_normal(), ug::HangingNodeRefinerBase< MGSelector >::process_constraining_edge(), set_center_vertex(), and UG_ASSERT.

◆ refine_edge_with_hanging_vertex()

void ug::HangingNodeRefiner_MultiGrid::refine_edge_with_hanging_vertex ( Edge e,
Vertex **  newCornerVrts = NULL 
)
protectedvirtual

calls base implementation and replaces cge with a normal edge.

Calls the base implementation and passes the mg-child vertices as newCornerVrts. If newCornerVrts were passed to this method, they are ignored.

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

References collect_child_corners(), and ug::HangingNodeRefinerBase< MGSelector >::refine_edge_with_hanging_vertex().

◆ refine_edge_with_normal_vertex()

void ug::HangingNodeRefiner_MultiGrid::refine_edge_with_normal_vertex ( Edge e,
Vertex **  newCornerVrts = NULL 
)
protectedvirtual

calls base implementation and replaces cge with a normal edge.

Calls the base implementation and passes the mg-child vertices as newCornerVrts. If newCornerVrts were passed to this method, they are ignored.

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

References collect_child_corners(), and ug::HangingNodeRefinerBase< MGSelector >::refine_edge_with_normal_vertex().

◆ refine_face_with_hanging_vertex()

void ug::HangingNodeRefiner_MultiGrid::refine_face_with_hanging_vertex ( Face f,
Vertex **  newCornerVrts = NULL 
)
protectedvirtual

calls base implementation and replaces cge with a normal edge.

Calls the base implementation and passes the mg-child vertices as newCornerVrts. If newCornerVrts were passed to this method, they are ignored.

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

References collect_child_corners(), and ug::HangingNodeRefinerBase< MGSelector >::refine_face_with_hanging_vertex().

◆ refine_face_with_normal_vertex()

void ug::HangingNodeRefiner_MultiGrid::refine_face_with_normal_vertex ( Face f,
Vertex **  newCornerVrts = NULL 
)
protectedvirtual

calls base implementation and replaces cge with a normal edge.

Calls the base implementation and passes the mg-child vertices as newCornerVrts. If newCornerVrts were passed to this method, they are ignored.

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

References collect_child_corners(), and ug::HangingNodeRefinerBase< MGSelector >::refine_face_with_normal_vertex().

◆ refine_volume_with_normal_vertex()

void ug::HangingNodeRefiner_MultiGrid::refine_volume_with_normal_vertex ( Volume v,
Vertex **  newVolumeVrts = NULL 
)
protectedvirtual

calls base implementation and replaces cge with a normal edge.

Calls the base implementation and passes the mg-child vertices as newCornerVrts. If newCornerVrts were passed to this method, they are ignored.

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

References collect_child_corners(), and ug::HangingNodeRefinerBase< MGSelector >::refine_volume_with_normal_vertex().

◆ refinement_is_allowed() [1/4]

bool ug::HangingNodeRefiner_MultiGrid::refinement_is_allowed ( Edge elem)
protectedvirtual

a callback that allows to deny refinement of special edges

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References ug::MultiGrid::has_children(), ug::GridObject::is_constraining(), and m_pMG.

◆ refinement_is_allowed() [2/4]

bool ug::HangingNodeRefiner_MultiGrid::refinement_is_allowed ( Face elem)
protectedvirtual

a callback that allows to deny refinement of special faces

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References ug::MultiGrid::has_children(), ug::GridObject::is_constraining(), and m_pMG.

◆ refinement_is_allowed() [3/4]

bool ug::HangingNodeRefiner_MultiGrid::refinement_is_allowed ( Vertex elem)
protectedvirtual

a callback that allows to deny refinement of special vertices

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References ug::MultiGrid::has_children(), and m_pMG.

Referenced by assign_hnode_marks(), pre_refine(), and ug::ParallelHangingNodeRefiner_MultiGrid::refinement_is_allowed().

◆ refinement_is_allowed() [4/4]

bool ug::HangingNodeRefiner_MultiGrid::refinement_is_allowed ( Volume elem)
protectedvirtual

a callback that allows to deny refinement of special volumes

Reimplemented from ug::HangingNodeRefinerBase< MGSelector >.

Reimplemented in ug::ParallelHangingNodeRefiner_MultiGrid.

References ug::MultiGrid::has_children(), and m_pMG.

◆ restrict_selection_to_coarsen_families() [1/2]

void ug::HangingNodeRefiner_MultiGrid::restrict_selection_to_coarsen_families ( )
protectedvirtual

Deselects all elements which have an unselected sibling.

Siblings are elements who share the same parent. Calls the overloaded template implementation for the four base element types. this method is called after to restrict_selection_to_surface_coarsen_elements.

Referenced by collect_objects_for_coarsen().

◆ restrict_selection_to_coarsen_families() [2/2]

template<class TElem >
void ug::HangingNodeRefiner_MultiGrid::restrict_selection_to_coarsen_families
protected

◆ restrict_selection_to_surface_coarsen_elements() [1/2]

void ug::HangingNodeRefiner_MultiGrid::restrict_selection_to_surface_coarsen_elements ( )
protectedvirtual

Makes sure that only surface elements are marked and that only coarsen marks are used.

calls the overloaded template implementation for the four base element types. this method is called prior to restrict_selection_to_coarsen_families.

Referenced by collect_objects_for_coarsen().

◆ restrict_selection_to_surface_coarsen_elements() [2/2]

template<class TElem >
void ug::HangingNodeRefiner_MultiGrid::restrict_selection_to_surface_coarsen_elements
protected

◆ save_coarsen_marks_to_file()

void ug::HangingNodeRefiner_MultiGrid::save_coarsen_marks_to_file ( ISelector sel,
const char *  filename 
)
protected

◆ set_center_vertex() [1/2]

void ug::HangingNodeRefiner_MultiGrid::set_center_vertex ( Edge e,
Vertex v 
)
protectedvirtual

Associates a vertex with the edge.

Implements ug::HangingNodeRefinerBase< MGSelector >.

References ug::MultiGrid::get_child_vertex(), m_pMG, and UG_ASSERT.

Referenced by process_constraining_edge().

◆ set_center_vertex() [2/2]

void ug::HangingNodeRefiner_MultiGrid::set_center_vertex ( Face f,
Vertex v 
)
protectedvirtual

Associates a vertex with the face.

Implements ug::HangingNodeRefinerBase< MGSelector >.

References ug::MultiGrid::get_child_vertex(), m_pMG, and UG_ASSERT.

◆ set_grid()

void ug::HangingNodeRefiner_MultiGrid::set_grid ( MultiGrid mg)
protected

performs registration and deregistration at a grid.

Initializes all grid related variables. call set_grid(NULL) to unregister the observer from a grid.

Please note that though the base grid features a set_grid method, it is not declared virtual. This is because we want to call it during construction and destruction.

References m_pMG, and ug::HangingNodeRefinerBase< MGSelector >::set_grid().

Referenced by assign_grid(), grid_to_be_destroyed(), HangingNodeRefiner_MultiGrid(), ug::AdaptiveRegularRefiner_MultiGrid::set_grid(), and ~HangingNodeRefiner_MultiGrid().

Member Data Documentation

◆ m_pMG


The documentation for this class was generated from the following files: