ug4
ug::BoolMarker Class Reference

Allows to mark elements. More...

#include <bool_marker.h>

+ Inheritance diagram for ug::BoolMarker:

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...
 
Gridgrid ()
 
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, ABoolm_aaMarkEDGE
 
Grid::AttachmentAccessor< Face, ABoolm_aaMarkFACE
 
Grid::AttachmentAccessor< Volume, ABoolm_aaMarkVOL
 
Grid::AttachmentAccessor< Vertex, ABoolm_aaMarkVRT
 
ABool m_aBool
 
bool m_defaultMark
 
bool m_markInheritanceEnabled
 
Gridm_pGrid
 
bool m_strictInheritanceEnabled
 

Detailed Description

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.

Todo:

Allow to restrict marking to vertices, edges, faces or volumes

Add is_marked, mark, unmark for GridObject

Refactor to template <class T> Marker.

Constructor & Destructor Documentation

◆ BoolMarker() [1/2]

ug::BoolMarker::BoolMarker ( )

◆ BoolMarker() [2/2]

ug::BoolMarker::BoolMarker ( Grid g)

References assign_grid().

◆ ~BoolMarker()

ug::BoolMarker::~BoolMarker ( )
virtual

References assign_grid().

Member Function Documentation

◆ assign_grid() [1/2]

void ug::BoolMarker::assign_grid ( Grid g)
inline

Assign the grid on which the marker shall operate.

References assign_grid().

Referenced by assign_grid().

◆ assign_grid() [2/2]

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().

◆ clear()

void ug::BoolMarker::clear ( )

◆ default_mark()

bool ug::BoolMarker::default_mark ( )
inline

returns the default mark.

References m_defaultMark.

Referenced by edge_created(), face_created(), vertex_created(), and volume_created().

◆ edge_created()

void ug::BoolMarker::edge_created ( Grid grid,
Edge e,
GridObject pParent = NULL,
bool  replacesParent = false 
)
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().

◆ edges_to_be_merged()

void ug::BoolMarker::edges_to_be_merged ( Grid grid,
Edge target,
Edge elem1,
Edge elem2 
)
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().

◆ enable_mark_inheritance()

void ug::BoolMarker::enable_mark_inheritance ( bool  enable)
inline

if enabled, marks are passed from parents on to their children

References m_markInheritanceEnabled.

◆ enable_strict_inheritance()

void ug::BoolMarker::enable_strict_inheritance ( bool  enable)
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.

◆ face_created()

void ug::BoolMarker::face_created ( Grid grid,
Face f,
GridObject pParent = NULL,
bool  replacesParent = false 
)
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().

◆ faces_to_be_merged()

void ug::BoolMarker::faces_to_be_merged ( Grid grid,
Face target,
Face elem1,
Face elem2 
)
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().

◆ grid()

Grid* ug::BoolMarker::grid ( )
inline

◆ grid_to_be_destroyed()

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

derived from GridObserver

Reimplemented from ug::GridObserver.

References assign_grid().

◆ is_marked() [1/5]

bool ug::BoolMarker::is_marked ( Edge e) const
inline

References m_aaMarkEDGE, and m_pGrid.

◆ is_marked() [2/5]

bool ug::BoolMarker::is_marked ( Face e) const
inline

References m_aaMarkFACE, and m_pGrid.

◆ is_marked() [3/5]

◆ is_marked() [4/5]

bool ug::BoolMarker::is_marked ( Vertex e) const
inline

References m_aaMarkVRT, and m_pGrid.

◆ is_marked() [5/5]

bool ug::BoolMarker::is_marked ( Volume e) const
inline

References m_aaMarkVOL, and m_pGrid.

◆ mark() [1/5]

void ug::BoolMarker::mark ( Edge e,
bool  mark = true 
)
inline

References m_aaMarkEDGE, m_pGrid, and mark().

Referenced by mark().

◆ mark() [2/5]

void ug::BoolMarker::mark ( Face e,
bool  mark = true 
)
inline

References m_aaMarkFACE, m_pGrid, and mark().

Referenced by mark().

◆ mark() [3/5]

template<class TIter >
void ug::BoolMarker::mark ( TIter  begin,
TIter  end,
bool  mark = true 
)
inline

References mark().

◆ mark() [4/5]

◆ mark() [5/5]

void ug::BoolMarker::mark ( Volume e,
bool  mark = true 
)
inline

References m_aaMarkVOL, m_pGrid, and mark().

Referenced by mark().

◆ mark_inheritance_enabeld()

bool ug::BoolMarker::mark_inheritance_enabeld ( )
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().

◆ set_default_mark()

void ug::BoolMarker::set_default_mark ( bool  mark)
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.

Parameters
markthis mark is set to new elements on creation.

References m_defaultMark, and mark().

◆ strict_inheritance_enabled()

bool ug::BoolMarker::strict_inheritance_enabled ( )
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().

◆ unmark() [1/5]

void ug::BoolMarker::unmark ( Edge e)
inline

References mark().

◆ unmark() [2/5]

void ug::BoolMarker::unmark ( Face e)
inline

References mark().

◆ unmark() [3/5]

template<class TIter >
void ug::BoolMarker::unmark ( TIter  begin,
TIter  end 
)
inline

References mark().

◆ unmark() [4/5]

void ug::BoolMarker::unmark ( Vertex e)
inline

◆ unmark() [5/5]

void ug::BoolMarker::unmark ( Volume e)
inline

References mark().

◆ vertex_created()

void ug::BoolMarker::vertex_created ( Grid grid,
Vertex vrt,
GridObject pParent = NULL,
bool  replacesParent = false 
)
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.

◆ vertices_to_be_merged()

void ug::BoolMarker::vertices_to_be_merged ( Grid grid,
Vertex target,
Vertex elem1,
Vertex elem2 
)
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().

◆ volume_created()

void ug::BoolMarker::volume_created ( Grid grid,
Volume vol,
GridObject pParent = NULL,
bool  replacesParent = false 
)
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.

◆ volumes_to_be_merged()

void ug::BoolMarker::volumes_to_be_merged ( Grid grid,
Volume target,
Volume elem1,
Volume elem2 
)
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().

Member Data Documentation

◆ m_aaMarkEDGE

Grid::AttachmentAccessor<Edge, ABool> ug::BoolMarker::m_aaMarkEDGE
protected

Referenced by assign_grid(), is_marked(), and mark().

◆ m_aaMarkFACE

Grid::AttachmentAccessor<Face, ABool> ug::BoolMarker::m_aaMarkFACE
protected

Referenced by assign_grid(), is_marked(), and mark().

◆ m_aaMarkVOL

Grid::AttachmentAccessor<Volume, ABool> ug::BoolMarker::m_aaMarkVOL
protected

Referenced by assign_grid(), is_marked(), and mark().

◆ m_aaMarkVRT

Grid::AttachmentAccessor<Vertex, ABool> ug::BoolMarker::m_aaMarkVRT
protected

Referenced by assign_grid(), is_marked(), and mark().

◆ m_aBool

ABool ug::BoolMarker::m_aBool
protected

Referenced by assign_grid().

◆ m_defaultMark

bool ug::BoolMarker::m_defaultMark
protected

Referenced by default_mark(), and set_default_mark().

◆ m_markInheritanceEnabled

bool ug::BoolMarker::m_markInheritanceEnabled
protected

◆ m_pGrid

Grid* ug::BoolMarker::m_pGrid
protected

Referenced by assign_grid(), clear(), grid(), is_marked(), and mark().

◆ m_strictInheritanceEnabled

bool ug::BoolMarker::m_strictInheritanceEnabled
protected

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