ug4
|
Allows to mark elements. More...
#include <bool_marker.h>
Public Member Functions | |
void | assign_grid (Grid &g) |
Assign the grid on which the marker shall operate. More... | |
void | assign_grid (Grid *g) |
Assign the grid on which the marker shall operate. More... | |
BoolMarker () | |
BoolMarker (Grid &g) | |
void | clear () |
Sets all marks to false. O(n). More... | |
bool | default_mark () |
returns the default mark. 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 | 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 | 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 | 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... | |
Grid * | grid () |
virtual void | grid_to_be_destroyed (Grid *grid) |
derived from GridObserver More... | |
bool | is_marked (Edge *e) const |
bool | is_marked (Face *e) const |
bool | is_marked (GridObject *e) const |
bool | is_marked (Vertex *e) const |
bool | is_marked (Volume *e) const |
void | mark (Edge *e, bool mark=true) |
void | mark (Face *e, bool mark=true) |
template<class TIter > | |
void | mark (TIter begin, TIter end, bool mark=true) |
void | mark (Vertex *e, bool mark=true) |
void | mark (Volume *e, bool mark=true) |
void | set_default_mark (bool mark) |
set the mark which is applied when a new element is created More... | |
void | unmark (Edge *e) |
void | unmark (Face *e) |
template<class TIter > | |
void | unmark (TIter begin, TIter end) |
void | unmark (Vertex *e) |
void | unmark (Volume *e) |
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 | 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 | 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 | 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... | |
virtual | ~BoolMarker () |
void | enable_mark_inheritance (bool enable) |
if enabled, marks are passed from parents on to their children More... | |
bool | mark_inheritance_enabeld () |
if enabled, marks are passed from parents on to their children More... | |
void | enable_strict_inheritance (bool enable) |
bool | strict_inheritance_enabled () |
Public Member Functions inherited from ug::GridObserver | |
virtual void | elements_to_be_cleared (Grid *grid) |
virtual | ~GridObserver () |
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... | |
Protected Attributes | |
Grid::AttachmentAccessor< Edge, ABool > | m_aaMarkEDGE |
Grid::AttachmentAccessor< Face, ABool > | m_aaMarkFACE |
Grid::AttachmentAccessor< Volume, ABool > | m_aaMarkVOL |
Grid::AttachmentAccessor< Vertex, ABool > | m_aaMarkVRT |
ABool | m_aBool |
bool | m_defaultMark |
bool | m_markInheritanceEnabled |
Grid * | m_pGrid |
bool | m_strictInheritanceEnabled |
Allows to mark elements.
This class allows to mark elements of a grid. The BoolMarker associates a bool with each element. Note that clearing the marks has a runtime complexity of O(n). If you need marks for repeatedly called local algorithms you may want to use Grid::mark instead, which has a clear_marks method with runtime complexity of O(1).
Note that methods like mark, unmark, is_marked, clear, ... may only be invoked, if a grid was assigned through either assign_grid or through the constructor.
Marks can be passed to children, when an element is refined. You have to enable mark inheritance in order to activate this behavior (use enable_mark_inheritance). Mark inheritance is enabled by default.
Allow to restrict marking to vertices, edges, faces or volumes
Add is_marked, mark, unmark for GridObject
Refactor to template <class T> Marker.
ug::BoolMarker::BoolMarker | ( | ) |
ug::BoolMarker::BoolMarker | ( | Grid & | g | ) |
References assign_grid().
|
virtual |
References assign_grid().
|
inline |
Assign the grid on which the marker shall operate.
References assign_grid().
Referenced by assign_grid().
void ug::BoolMarker::assign_grid | ( | Grid * | g | ) |
Assign the grid on which the marker shall operate.
NULL is a valid argument and sets the marker into an unassigned state. The marker may only be used, if it is associated with a grid instance.
References ug::Grid::attach_to_all(), ug::Grid::detach_from_all(), m_aaMarkEDGE, m_aaMarkFACE, m_aaMarkVOL, m_aaMarkVRT, m_aBool, m_pGrid, ug::OT_EDGE_OBSERVER, ug::OT_FACE_OBSERVER, ug::OT_GRID_OBSERVER, ug::OT_VERTEX_OBSERVER, ug::OT_VOLUME_OBSERVER, ug::Grid::register_observer(), and ug::Grid::unregister_observer().
Referenced by ug::GlobalFracturedMediaRefiner::assign_grid(), BoolMarker(), grid_to_be_destroyed(), and ~BoolMarker().
void ug::BoolMarker::clear | ( | ) |
Sets all marks to false. O(n).
References ug::Grid::begin(), ug::Grid::end(), m_pGrid, and unmark().
Referenced by ug::GlobalFracturedMediaRefiner::assign_elem_and_side_marks().
|
inline |
returns the default mark.
References m_defaultMark.
Referenced by edge_created(), face_created(), vertex_created(), and volume_created().
|
virtual |
Notified whenever a new element of the given type is created in the given grid.
Creation callbacks are called in the order in which the GridObservers were registered at the given grid.
If replacesParent is true, then pParent is of the same base type as the created object (e.g. in case of edge_created, the parent is an Edge*). This case usually appears, when a contraining object is replaced by a regular grid object if the same base type during refinement. The method is called with replacesParent == true by Grid::create_and_replace methods.
Please note: If replacesParent == true, then a call to OBJECT_to_be_erased(grid, pParent, obj) will follow (OBJECT and obj are pseudonyms for the concrete type).
Reimplemented from ug::GridObserver.
References ug::GridObject::base_object_id(), default_mark(), ug::EDGE, is_marked(), mark(), mark_inheritance_enabeld(), and strict_inheritance_enabled().
|
virtual |
Notified when two elements of the same type are going to be merged.
Note that this method is invoked by Grid::objects_will_be_merged, which is called from outside the grid class. Implementors of algorithms in which objects are merged are thus responsible to call Grid::objects_will_be_merged.
This callback is called in addition to ..._created and ..._to_be_erased callbacks and should thus only be used if small adjustments have to be made during a merge.
Note that target may be identical to elem1 or elem2.
Reimplemented from ug::GridObserver.
References is_marked(), mark(), and boost::target().
|
inline |
if enabled, marks are passed from parents on to their children
References m_markInheritanceEnabled.
|
inline |
restricts mark inheritance so that new elements derive their selection status only from parents with the same base-type. Disabled by default. NOTE: strict inheritance only has an effect if selection inheritance is enabled.
References m_strictInheritanceEnabled.
|
virtual |
Notified whenever a new element of the given type is created in the given grid.
Creation callbacks are called in the order in which the GridObservers were registered at the given grid.
If replacesParent is true, then pParent is of the same base type as the created object (e.g. in case of edge_created, the parent is an Edge*). This case usually appears, when a contraining object is replaced by a regular grid object if the same base type during refinement. The method is called with replacesParent == true by Grid::create_and_replace methods.
Please note: If replacesParent == true, then a call to OBJECT_to_be_erased(grid, pParent, obj) will follow (OBJECT and obj are pseudonyms for the concrete type).
Reimplemented from ug::GridObserver.
References ug::GridObject::base_object_id(), default_mark(), ug::FACE, is_marked(), mark(), mark_inheritance_enabeld(), and strict_inheritance_enabled().
|
virtual |
Notified when two elements of the same type are going to be merged.
Note that this method is invoked by Grid::objects_will_be_merged, which is called from outside the grid class. Implementors of algorithms in which objects are merged are thus responsible to call Grid::objects_will_be_merged.
This callback is called in addition to ..._created and ..._to_be_erased callbacks and should thus only be used if small adjustments have to be made during a merge.
Note that target may be identical to elem1 or elem2.
Reimplemented from ug::GridObserver.
References is_marked(), mark(), and boost::target().
|
inline |
References m_pGrid.
Referenced by ug::SelectNonShadowsAdjacentToShadowsOnLevel().
|
virtual |
|
inline |
References m_aaMarkEDGE, and m_pGrid.
|
inline |
References m_aaMarkFACE, and m_pGrid.
bool ug::BoolMarker::is_marked | ( | GridObject * | e | ) | const |
References ug::GridObject::base_object_id(), ug::EDGE, ug::FACE, ug::VERTEX, and ug::VOLUME.
Referenced by ug::GlobalFracturedMediaRefiner::assign_elem_and_side_marks(), ug::ComPol_BoolMarker_AddMarks< TLayout >::collect(), ug::ComPol_BoolMarker_RemoveMarks< TLayout >::collect(), edge_created(), edges_to_be_merged(), face_created(), faces_to_be_merged(), ug::GlobalFracturedMediaRefiner::mark_sides_of_marked_top_level_elements(), ug::GlobalFracturedMediaRefiner::num_marked(), ug::GlobalFracturedMediaRefiner::perform_refinement(), ug::GlobalFracturedMediaRefiner::save_marks_to_file(), vertex_created(), vertices_to_be_merged(), volume_created(), and volumes_to_be_merged().
|
inline |
References m_aaMarkVRT, and m_pGrid.
|
inline |
References m_aaMarkVOL, and m_pGrid.
|
inline |
References m_aaMarkEDGE, m_pGrid, and mark().
Referenced by mark().
|
inline |
References m_aaMarkFACE, m_pGrid, and mark().
Referenced by mark().
|
inline |
References mark().
|
inline |
References m_aaMarkVRT, m_pGrid, and mark().
Referenced by ug::GlobalFracturedMediaRefiner::adjust_marks(), ug::GlobalFracturedMediaRefiner::assign_elem_and_side_marks(), edge_created(), edges_to_be_merged(), ug::ComPol_BoolMarker_AddMarks< TLayout >::extract(), face_created(), faces_to_be_merged(), mark(), ug::GlobalFracturedMediaRefiner::mark_sides_of_marked_top_level_elements(), ug::MarkAllElemsForAssemblyButHSlaves(), ug::SelectNonShadowsAdjacentToShadowsOnLevel(), set_default_mark(), unmark(), vertex_created(), vertices_to_be_merged(), volume_created(), and volumes_to_be_merged().
|
inline |
References m_aaMarkVOL, m_pGrid, and mark().
Referenced by mark().
|
inline |
if enabled, marks are passed from parents on to their children
References m_markInheritanceEnabled.
Referenced by edge_created(), face_created(), vertex_created(), and volume_created().
|
inline |
set the mark which is applied when a new element is created
By default the default-mark is set to false. Note that the default mark only has an effect on child elements, if mark-inheritance is disabled.
mark | this mark is set to new elements on creation. |
References m_defaultMark, and mark().
|
inline |
restricts mark inheritance so that new elements derive their selection status only from parents with the same base-type. Disabled by default. NOTE: strict inheritance only has an effect if selection inheritance is enabled.
References m_strictInheritanceEnabled.
Referenced by edge_created(), face_created(), vertex_created(), and volume_created().
|
inline |
References mark().
|
inline |
References mark().
Referenced by clear(), ug::ComPol_BoolMarker_RemoveMarks< TLayout >::extract(), and ug::MarkAllElemsForAssemblyButHSlaves().
|
virtual |
Notified whenever a new element of the given type is created in the given grid.
Creation callbacks are called in the order in which the GridObservers were registered at the given grid.
If replacesParent is true, then pParent is of the same base type as the created object (e.g. in case of edge_created, the parent is an Edge*). This case usually appears, when a contraining object is replaced by a regular grid object if the same base type during refinement. The method is called with replacesParent == true by Grid::create_and_replace methods.
Please note: If replacesParent == true, then a call to OBJECT_to_be_erased(grid, pParent, obj) will follow (OBJECT and obj are pseudonyms for the concrete type).
Reimplemented from ug::GridObserver.
References ug::GridObject::base_object_id(), default_mark(), is_marked(), mark(), mark_inheritance_enabeld(), strict_inheritance_enabled(), and ug::VERTEX.
|
virtual |
Notified when two elements of the same type are going to be merged.
Note that this method is invoked by Grid::objects_will_be_merged, which is called from outside the grid class. Implementors of algorithms in which objects are merged are thus responsible to call Grid::objects_will_be_merged.
This callback is called in addition to ..._created and ..._to_be_erased callbacks and should thus only be used if small adjustments have to be made during a merge.
Note that target may be identical to elem1 or elem2.
Reimplemented from ug::GridObserver.
References is_marked(), mark(), and boost::target().
|
virtual |
Notified whenever a new element of the given type is created in the given grid.
Creation callbacks are called in the order in which the GridObservers were registered at the given grid.
If replacesParent is true, then pParent is of the same base type as the created object (e.g. in case of edge_created, the parent is an Edge*). This case usually appears, when a contraining object is replaced by a regular grid object if the same base type during refinement. The method is called with replacesParent == true by Grid::create_and_replace methods.
Please note: If replacesParent == true, then a call to OBJECT_to_be_erased(grid, pParent, obj) will follow (OBJECT and obj are pseudonyms for the concrete type).
Reimplemented from ug::GridObserver.
References ug::GridObject::base_object_id(), default_mark(), is_marked(), mark(), mark_inheritance_enabeld(), strict_inheritance_enabled(), and ug::VOLUME.
|
virtual |
Notified when two elements of the same type are going to be merged.
Note that this method is invoked by Grid::objects_will_be_merged, which is called from outside the grid class. Implementors of algorithms in which objects are merged are thus responsible to call Grid::objects_will_be_merged.
This callback is called in addition to ..._created and ..._to_be_erased callbacks and should thus only be used if small adjustments have to be made during a merge.
Note that target may be identical to elem1 or elem2.
Reimplemented from ug::GridObserver.
References is_marked(), mark(), and boost::target().
|
protected |
Referenced by assign_grid(), is_marked(), and mark().
|
protected |
Referenced by assign_grid(), is_marked(), and mark().
|
protected |
Referenced by assign_grid(), is_marked(), and mark().
|
protected |
Referenced by assign_grid(), is_marked(), and mark().
|
protected |
Referenced by assign_grid().
|
protected |
Referenced by default_mark(), and set_default_mark().
|
protected |
Referenced by enable_mark_inheritance(), and mark_inheritance_enabeld().
|
protected |
Referenced by assign_grid(), clear(), grid(), is_marked(), and mark().
|
protected |
Referenced by enable_strict_inheritance(), and strict_inheritance_enabled().