ug4
Loading...
Searching...
No Matches
ug::Selector Class Reference

specialization of ISelector for a grid of class Grid. More...

#include <selector_grid.h>

+ Inheritance diagram for ug::Selector:

Classes

struct  traits
 The traits class holds some important types for each element-type. More...
 

Public Types

typedef ISelector BaseClass
 
typedef Grid grid_type
 
- Public Types inherited from ug::ISelector
enum  { DESELECTED = 0 , SELECTED = 1 }
 
typedef byte status_t
 

Public Member Functions

void assign_grid (Grid &grid)
 
void assign_grid (Grid *grid)
 
template<class TElem >
TElem * back ()
 returns the last selected element of the given type.
 
template<class TElem >
geometry_traits< TElem >::iterator begin ()
 
template<class TElem >
geometry_traits< TElem >::const_iterator begin () const
 
template<class TElem >
geometry_traits< TElem >::iterator begin (size_t)
 calls begin<TElem>();
 
virtual void clear ()
 
template<class TElem >
void clear ()
 
virtual bool contains_edges () const
 returns true if the selector contains edges
 
virtual bool contains_faces () const
 returns true if the selector contains faces
 
virtual bool contains_vertices () const
 returns true if the selector contains vertices
 
virtual bool contains_volumes () const
 returns true if the selector contains volumes
 
void disable_element_support (uint shElements)
 disable support for element-types.
 
EdgeIterator edges_begin ()
 
EdgeIterator edges_end ()
 
bool empty () const
 
template<class TElem >
bool empty () const
 
bool empty (size_t) const
 calls empty();
 
template<class TElem >
bool empty (size_t) const
 
void enable_element_support (uint shElements)
 enable support for element-types. Does not invalidate previous settings.
 
template<class TElem >
geometry_traits< TElem >::iterator end ()
 
template<class TElem >
geometry_traits< TElem >::const_iterator end () const
 
template<class TElem >
geometry_traits< TElem >::iterator end (size_t)
 calls end<TElem>();
 
FaceIterator faces_begin ()
 
FaceIterator faces_end ()
 
template<class TElem >
TElem * front ()
 returns the first selected element of the given type.
 
virtual GridObjectCollection get_grid_objects () const
 returns a geometric object collection, containing all selected objects
 
virtual void grid_to_be_destroyed (Grid *grid)
 
template<class TElem >
size_t num () const
 
size_t num () const
 
uint num (size_t) const
 calls num();
 
template<class TElem >
size_t num (size_t) const
 calls num<TElem>();
 
size_t num_levels () const
 always returns 1
 
 Selector (Grid &grid, uint supportedElements=SE_ALL)
 
 Selector (uint supportedElements=SE_ALL)
 
void set_supported_elements (uint shElements)
 set the type of elements that shall be handled by the Selector.
 
VertexIterator vertices_begin ()
 
VertexIterator vertices_end ()
 
VolumeIterator volumes_begin ()
 
VolumeIterator volumes_end ()
 
virtual ~Selector ()
 
- Public Member Functions inherited from ug::ISelector
bool autoselection_enabled ()
 
virtual void broadcast_selection_states (bool deselect=false, bool includeGhosts=false)
 broadcasts the current selection
 
void deselect (GridObject *elem)
 
template<class TElem >
void deselect (TElem *elem)
 
template<class TIterator >
void deselect (TIterator iterBegin, TIterator iterEnd)
 
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.
 
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.
 
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.
 
bool elements_are_supported (uint shElements) const
 returns true if the given element-types are supported.
 
virtual void elements_to_be_cleared (Grid *grid)
 
void enable_autoselection (bool bEnable)
 
void enable_selection_inheritance (bool bEnable)
 
void enable_strict_inheritance (bool bEnable)
 
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.
 
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.
 
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.
 
template<class TElem >
byte get_mark (TElem *elem) const
 returns the selection state of the specified elelent
 
Grid * grid () const
 
template<class TElem >
bool is_selected (TElem *elem) const
 returns true if an element is selected
 
 ISelector (Grid &grid, uint supportedElements=SE_ALL)
 
 ISelector (uint supportedElements=SE_ALL)
 
bool selection_inheritance_enabled ()
 
bool strict_inheritance_enabled ()
 
template<class TElem >
void unmark (TElem *elem)
 deselects an element
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
virtual ~ISelector ()
 
void select (GridObject *elem, byte status)
 selects an element
 
void select (GridObject *elem)
 selects an element
 
template<class TElem >
void select (TElem *elem, byte status)
 selects an element
 
template<class TElem >
void select (TElem *elem)
 selects an element
 
template<class TIterator >
void select (TIterator iterBegin, TIterator iterEnd, byte status=1)
 selects an element
 
template<class TElem >
void mark (TElem *elem)
 selects an element
 
template<class TElem >
void mark (TElem *elem, byte status)
 selects an element
 
byte get_selection_status (GridObject *elem) const
 returns the selection state of the specified elelent
 
byte get_selection_status (Vertex *vrt) const
 returns the selection state of the specified elelent
 
byte get_selection_status (Edge *edge) const
 returns the selection state of the specified elelent
 
byte get_selection_status (Face *face) const
 returns the selection state of the specified elelent
 
byte get_selection_status (Volume *vol) const
 returns the selection state of the specified elelent
 
- Public Member Functions inherited from ug::GridObserver
virtual ~GridObserver ()
 

Protected Types

typedef Grid::traits< Edge >::AttachedElementList AttachedEdgeList
 
typedef Grid::traits< Face >::AttachedElementList AttachedFaceList
 
typedef Grid::traits< Vertex >::AttachedElementList AttachedVertexList
 
typedef Grid::traits< Volume >::AttachedElementList AttachedVolumeList
 
typedef Grid::traits< Edge >::SectionContainer EdgeSectionContainer
 
typedef Grid::traits< Face >::SectionContainer FaceSectionContainer
 
typedef Grid::traits< Vertex >::SectionContainer VertexSectionContainer
 
typedef Grid::traits< Volume >::SectionContainer VolumeSectionContainer
 
- Protected Types inherited from ug::ISelector
typedef Grid::traits< Edge >::AttachedElementList AttachedEdgeList
 
typedef Grid::traits< Face >::AttachedElementList AttachedFaceList
 
typedef Grid::traits< Vertex >::AttachedElementList AttachedVertexList
 
typedef Grid::traits< Volume >::AttachedElementList AttachedVolumeList
 
typedef Attachment< unsigned char > AUChar
 
typedef Grid::traits< Edge >::SectionContainer EdgeSectionContainer
 
typedef Grid::traits< Face >::SectionContainer FaceSectionContainer
 
typedef Grid::traits< Vertex >::SectionContainer VertexSectionContainer
 
typedef Grid::traits< Volume >::SectionContainer VolumeSectionContainer
 

Protected Member Functions

virtual void add_to_list (Edge *elem)
 
virtual void add_to_list (Face *elem)
 
virtual void add_to_list (Vertex *elem)
 
virtual void add_to_list (Volume *elem)
 
void clear_lists ()
 
virtual void erase_from_list (Edge *elem)
 
virtual void erase_from_list (Face *elem)
 
virtual void erase_from_list (Vertex *elem)
 
virtual void erase_from_list (Volume *elem)
 
template<class TElem >
int get_section_index () const
 
template<class TElem >
Grid::traits< TElem >::SectionContainer & section_container ()
 returns the section container for the given type, subset and level
 
template<class TElem >
const Grid::traits< TElem >::SectionContainer & section_container () const
 returns the const section container for the given type, subset and level
 
VertexSectionContainer::iterator get_iterator (Vertex *o)
 returns the iterator at which the given element lies in the section container
 
EdgeSectionContainer::iterator get_iterator (Edge *o)
 returns the iterator at which the given element lies in the section container
 
FaceSectionContainer::iterator get_iterator (Face *o)
 returns the iterator at which the given element lies in the section container
 
VolumeSectionContainer::iterator get_iterator (Volume *o)
 returns the iterator at which the given element lies in the section container
 
- Protected Member Functions inherited from ug::ISelector
void disable_element_support (uint shElements)
 disable support for element-types.
 
template<class TElem >
void elems_to_be_merged (Grid *grid, TElem *target, TElem *elem1, TElem *elem2)
 helper for GridObserver callbacks.
 
void enable_element_support (uint shElements)
 enable support for element-types. Does not invalidate previous settings.
 
void mark_deselected (Edge *elem)
 
void mark_deselected (Face *elem)
 
void mark_deselected (Vertex *elem)
 
void mark_deselected (Volume *elem)
 
void mark_selected (Edge *elem, byte status)
 
void mark_selected (Face *elem, byte status)
 
void mark_selected (Vertex *elem, byte status)
 
void mark_selected (Volume *elem, byte status)
 
void set_grid (Grid *grid)
 performs grid registration / deregistration and initialisation of the observer.
 
void set_supported_elements (uint shElements)
 set the type of elements that shall be handled by the SubsetHandler.
 

Protected Attributes

EdgeSectionContainer m_edges
 
FaceSectionContainer m_faces
 
VertexSectionContainer m_vertices
 Copy Constructor not yet implemented!
 
VolumeSectionContainer m_volumes
 
- Protected Attributes inherited from ug::ISelector
Grid::AttachmentAccessor< Edge, AUChar > m_aaSelEDGE
 
Grid::AttachmentAccessor< Face, AUChar > m_aaSelFACE
 
Grid::AttachmentAccessor< Volume, AUChar > m_aaSelVOL
 
Grid::AttachmentAccessor< Vertex, AUChar > m_aaSelVRT
 
AUChar m_aSelected
 
bool m_bAutoselectionEnabled
 
bool m_bSelectionInheritanceEnabled
 
bool m_bStrictInheritanceEnabled
 
pcl::InterfaceCommunicator< EdgeLayout > m_icomEDGE
 
pcl::InterfaceCommunicator< FaceLayout > m_icomFACE
 
pcl::InterfaceCommunicator< VolumeLayout > m_icomVOL
 
pcl::InterfaceCommunicator< VertexLayout > m_icomVRT
 
Grid * m_pGrid
 
uint m_supportedElements
 

Private Member Functions

 Selector (const Selector &sel)
 

Detailed Description

specialization of ISelector for a grid of class Grid.

A selector is a useful class, that allows the user to mark elements of a grid as selected or deselected. The selection status is maintained even if new elements are created or old ones deleted. Features like autoselection and selection_inheritance allow users to follow the creation and removal of elements in all kind of algorithms.

Please note that the selector has to be registered at a grid before it may be used. You may register it using the constructor or the method assign_grid.

This is a specialization of ISelector for the Grid class.

The following methods are the most used:

  • select, deselect, is_selected (see ISelector)
  • begin, end, num, clear.

You may specify the element-type on which begin, end, num and clear operate via a template parameter:

Grid g;
Selector sel(g);
// ... create elements and select some
// number of selected vertices
int nSelVrts = sel.num<Vertex>();
// number of selected triangles
int nSelTris = sel.num<Triangle>();
// iteration over all faces
for(FaceIterator iter = sel.begin<Face>();
iter != sel.end<Face>(); ++iter){
// ...
}
Faces are 2-dimensional objects.
Definition grid_base_objects.h:510
Manages the elements of a grid and their interconnection.
Definition grid.h:132
specialization of ISelector for a grid of class Grid.
Definition selector_grid.h:96
the most simple form of a face
Definition grid_objects_2d.h:174
Base-class for all vertex-types.
Definition grid_base_objects.h:231
ElementStorage< Face >::SectionContainer::iterator FaceIterator
Definition grid_base_object_traits.h:79

Member Typedef Documentation

◆ AttachedEdgeList

typedef Grid::traits<Edge>::AttachedElementList ug::ISelector::AttachedEdgeList
protected

◆ AttachedFaceList

typedef Grid::traits<Face>::AttachedElementList ug::ISelector::AttachedFaceList
protected

◆ AttachedVertexList

typedef Grid::traits<Vertex>::AttachedElementList ug::ISelector::AttachedVertexList
protected

◆ AttachedVolumeList

typedef Grid::traits<Volume>::AttachedElementList ug::ISelector::AttachedVolumeList
protected

◆ BaseClass

◆ EdgeSectionContainer

typedef Grid::traits<Edge>::SectionContainer ug::ISelector::EdgeSectionContainer
protected

◆ FaceSectionContainer

typedef Grid::traits<Face>::SectionContainer ug::ISelector::FaceSectionContainer
protected

◆ grid_type

◆ VertexSectionContainer

typedef Grid::traits<Vertex>::SectionContainer ug::ISelector::VertexSectionContainer
protected

◆ VolumeSectionContainer

typedef Grid::traits<Volume>::SectionContainer ug::ISelector::VolumeSectionContainer
protected

Constructor & Destructor Documentation

◆ Selector() [1/3]

ug::Selector::Selector ( uint  supportedElements = SE_ALL)

◆ Selector() [2/3]

ug::Selector::Selector ( Grid &  grid,
uint  supportedElements = SE_ALL 
)

◆ ~Selector()

◆ Selector() [3/3]

ug::Selector::Selector ( const Selector &  sel)
inlineprivate

Member Function Documentation

◆ add_to_list() [1/4]

void ug::Selector::add_to_list ( Edge *  elem)
protectedvirtual

◆ add_to_list() [2/4]

void ug::Selector::add_to_list ( Face *  elem)
protectedvirtual

◆ add_to_list() [3/4]

void ug::Selector::add_to_list ( Vertex *  elem)
protectedvirtual

◆ add_to_list() [4/4]

void ug::Selector::add_to_list ( Volume *  elem)
protectedvirtual

◆ assign_grid() [1/2]

◆ assign_grid() [2/2]

◆ back()

template<class TElem >
TElem * ug::Selector::back ( )

returns the last selected element of the given type.

Make sure that elements of the given type exist! Behaviour is undefined, if not.

◆ begin() [1/3]

◆ begin() [2/3]

template<class TElem >
geometry_traits< TElem >::const_iterator ug::Selector::begin ( ) const
inline

◆ begin() [3/3]

template<class TElem >
geometry_traits< TElem >::iterator ug::Selector::begin ( size_t  )
inline

◆ clear() [1/2]

◆ clear() [2/2]

template<class TElem >
void ug::Selector::clear ( )
inlinevirtual

◆ clear_lists()

void ug::Selector::clear_lists ( )
protected

Referenced by grid_to_be_destroyed().

◆ contains_edges()

virtual bool ug::Selector::contains_edges ( ) const
inlinevirtual

returns true if the selector contains edges

Implements ug::ISelector.

◆ contains_faces()

virtual bool ug::Selector::contains_faces ( ) const
inlinevirtual

returns true if the selector contains faces

Implements ug::ISelector.

◆ contains_vertices()

virtual bool ug::Selector::contains_vertices ( ) const
inlinevirtual

returns true if the selector contains vertices

Implements ug::ISelector.

◆ contains_volumes()

virtual bool ug::Selector::contains_volumes ( ) const
inlinevirtual

returns true if the selector contains volumes

Implements ug::ISelector.

◆ disable_element_support()

void ug::Selector::disable_element_support ( uint  shElements)

disable support for element-types.

pass an or-combination of constants enumerated in SelectorElements.

References ug::ISelector::disable_element_support(), ug::ISelector::elements_are_supported(), ug::SE_EDGE, ug::SE_FACE, ug::SE_VERTEX, and ug::SE_VOLUME.

Referenced by assign_grid(), and set_supported_elements().

◆ edges_begin()

◆ edges_end()

◆ empty() [1/4]

◆ empty() [2/4]

template<class TElem >
bool ug::Selector::empty ( ) const
inline

◆ empty() [3/4]

bool ug::Selector::empty ( size_t  ) const
inline

calls empty();

References empty().

◆ empty() [4/4]

template<class TElem >
bool ug::Selector::empty ( size_t  ) const
inline

◆ enable_element_support()

void ug::Selector::enable_element_support ( uint  shElements)

enable support for element-types. Does not invalidate previous settings.

pass an or-combination of constants enumerated in SelectorElements.

References ug::ISelector::elements_are_supported(), ug::ISelector::enable_element_support(), ug::Grid::get_attachment_pipe(), ug::ISelector::m_pGrid, ug::SE_EDGE, ug::SE_FACE, ug::SE_VERTEX, and ug::SE_VOLUME.

Referenced by assign_grid(), and set_supported_elements().

◆ end() [1/3]

◆ end() [2/3]

template<class TElem >
geometry_traits< TElem >::const_iterator ug::Selector::end ( ) const
inline

◆ end() [3/3]

template<class TElem >
geometry_traits< TElem >::iterator ug::Selector::end ( size_t  )
inline

calls end<TElem>();

◆ erase_from_list() [1/4]

void ug::Selector::erase_from_list ( Edge *  elem)
protectedvirtual

◆ erase_from_list() [2/4]

void ug::Selector::erase_from_list ( Face *  elem)
protectedvirtual

◆ erase_from_list() [3/4]

void ug::Selector::erase_from_list ( Vertex *  elem)
protectedvirtual

◆ erase_from_list() [4/4]

void ug::Selector::erase_from_list ( Volume *  elem)
protectedvirtual

◆ faces_begin()

◆ faces_end()

◆ front()

template<class TElem >
TElem * ug::Selector::front ( )

returns the first selected element of the given type.

Make sure that elements of the given type exist! Behaviour is undefined, if not.

◆ get_grid_objects()

GridObjectCollection ug::Selector::get_grid_objects ( ) const
virtual

returns a geometric object collection, containing all selected objects

Implements ug::ISelector.

References m_edges, m_faces, m_vertices, and m_volumes.

Referenced by ug::AllGatherGrid(), ug::BroadcastGrid(), ug::GatherGrid(), ug::Refine(), and ug::ProjectionHandler::refinement_begins().

◆ get_iterator() [1/4]

EdgeSectionContainer::iterator ug::Selector::get_iterator ( Edge *  o)
inlineprotected

returns the iterator at which the given element lies in the section container

This method may only be called if the element is indeed selected

◆ get_iterator() [2/4]

FaceSectionContainer::iterator ug::Selector::get_iterator ( Face *  o)
inlineprotected

returns the iterator at which the given element lies in the section container

This method may only be called if the element is indeed selected

◆ get_iterator() [3/4]

VertexSectionContainer::iterator ug::Selector::get_iterator ( Vertex *  o)
inlineprotected

returns the iterator at which the given element lies in the section container

This method may only be called if the element is indeed selected

Referenced by erase_from_list(), erase_from_list(), erase_from_list(), and erase_from_list().

◆ get_iterator() [4/4]

VolumeSectionContainer::iterator ug::Selector::get_iterator ( Volume *  o)
inlineprotected

returns the iterator at which the given element lies in the section container

This method may only be called if the element is indeed selected

◆ get_section_index()

template<class TElem >
int ug::Selector::get_section_index ( ) const
inlineprotected

◆ grid_to_be_destroyed()

void ug::Selector::grid_to_be_destroyed ( Grid *  grid)
virtual

◆ num() [1/4]

template<class TElem >
size_t ug::Selector::num ( ) const
inline

◆ num() [2/4]

size_t ug::Selector::num ( ) const
inline

◆ num() [3/4]

uint ug::Selector::num ( size_t  ) const
inline

calls num();

References num().

◆ num() [4/4]

template<class TElem >
size_t ug::Selector::num ( size_t  ) const
inline

calls num<TElem>();

◆ num_levels()

size_t ug::Selector::num_levels ( ) const
inline

always returns 1

Referenced by ug::GetNeighborhood().

◆ section_container() [1/2]

template<class TElem >
Grid::traits< TElem >::SectionContainer & ug::Selector::section_container ( )
inlineprotected

returns the section container for the given type, subset and level

References m_edges, m_faces, m_vertices, m_volumes, and section_container().

Referenced by section_container(), and section_container().

◆ section_container() [2/2]

template<class TElem >
const Grid::traits< TElem >::SectionContainer & ug::Selector::section_container ( ) const
inlineprotected

returns the const section container for the given type, subset and level

References m_edges, m_faces, m_vertices, m_volumes, and section_container().

◆ set_supported_elements()

void ug::Selector::set_supported_elements ( uint  shElements)

set the type of elements that shall be handled by the Selector.

Pass an or-combination of constants enumerated in SelectorElements.

See also
Selector::enable_element_support

References disable_element_support(), enable_element_support(), and ug::ISelector::m_supportedElements.

◆ vertices_begin()

◆ vertices_end()

◆ volumes_begin()

◆ volumes_end()

Member Data Documentation

◆ m_edges

EdgeSectionContainer ug::Selector::m_edges
protected

◆ m_faces

FaceSectionContainer ug::Selector::m_faces
protected

◆ m_vertices

VertexSectionContainer ug::Selector::m_vertices
protected

Copy Constructor not yet implemented!

Referenced by get_grid_objects(), section_container(), and section_container().

◆ m_volumes

VolumeSectionContainer ug::Selector::m_volumes
protected

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