ug4
ug::MultiGridSubsetHandler Class Reference

Handles subsets on a per level basis. More...

#include <subset_handler_multi_grid.h>

+ Inheritance diagram for ug::MultiGridSubsetHandler:

Classes

struct  Subset
 

Public Member Functions

void assign_grid (MultiGrid &mg)
 
void assign_subset (Edge *elem, int subsetIndex)
 assigns an edge to a subset. More...
 
virtual void assign_subset (Edge *elem, int subsetIndex)=0
 
void assign_subset (Face *elem, int subsetIndex)
 assigns a face to a subset. More...
 
virtual void assign_subset (Face *elem, int subsetIndex)=0
 
virtual void assign_subset (GridObject *elem, int subsetIndex)
 
template<class TIterator >
void assign_subset (TIterator iterBegin, TIterator iterEnd, int subsetIndex)
 
void assign_subset (Vertex *elem, int subsetIndex)
 assigns a vertex to a subset. More...
 
virtual void assign_subset (Vertex *elem, int subsetIndex)=0
 
void assign_subset (Volume *elem, int subsetIndex)
 assigns a volume to a subset. More...
 
virtual void assign_subset (Volume *elem, int subsetIndex)=0
 
template<class TElem >
geometry_traits< TElem >::iterator begin (int subsetIndex, int level)
 returns the begin-iterator for the elements of type TElem in the given subset. More...
 
template<class TElem >
geometry_traits< TElem >::const_iterator begin (int subsetIndex, int level) const
 returns the begin-iterator for the elements of type TElem in the given subset. More...
 
template<class TElem >
void clear_subset_elements (int subsetIndex)
 removes all elements of type TElem from the specified subset. More...
 
template<class TElem >
void clear_subset_elements (int subsetIndex, int level)
 removes all elements of type TElem from the specified subset on the given level. More...
 
virtual bool contains_edges (int subsetIndex) const
 returns true if the subset contains edges More...
 
virtual bool contains_faces (int subsetIndex) const
 returns true if the subset contains faces More...
 
virtual bool contains_vertices (int subsetIndex) const
 collects all vertices that are in the given subset. More...
 
virtual bool contains_volumes (int subsetIndex) const
 returns true if the subset contains volumes More...
 
template<class TElem >
geometry_traits< TElem >::iterator end (int subsetIndex, int level)
 returns the end-iterator for the elements of type TElem in the given subset. More...
 
template<class TElem >
geometry_traits< TElem >::const_iterator end (int subsetIndex, int level) const
 returns the end-iterator for the elements of type TElem in the given subset. More...
 
GridObjectCollection get_grid_objects (int subsetIndex, int level) const
 returns a GridObjectCollection More...
 
GridObjectCollection get_grid_objects_in_level (int level) const
 returns a GridObjectCollection with multiple levels - each representing a subset. More...
 
GridObjectCollection get_grid_objects_in_subset (int subsetIndex) const
 returns a GridObjectCollection with multiple levels More...
 
template<class TGeomObj >
uint get_level (TGeomObj *obj) const
 returns the level in which an element is located More...
 
virtual void grid_to_be_destroyed (Grid *grid)
 perform cleanup More...
 
void level_required (int level)
 creates the required levels, if they do not yet exist More...
 
MultiGridmulti_grid ()
 
const MultiGridmulti_grid () const
 
 MultiGridSubsetHandler (const MultiGridSubsetHandler &sh)
 
 MultiGridSubsetHandler (MultiGrid &mg, uint supportedElements=SHE_ALL)
 
 MultiGridSubsetHandler (uint supportedElements=SHE_ALL)
 
template<class TElem >
uint num () const
 returns the total number of elements More...
 
template<class TElem >
uint num (int subsetIndex) const
 returns the number of elements in the given subset More...
 
template<class TElem >
uint num (int subsetIndex, int level) const
 returns the number of elements in the given subset on the given level More...
 
uint num_levels () const
 returns the number of levels More...
 
virtual ~MultiGridSubsetHandler ()
 
- Public Member Functions inherited from ug::ISubsetHandler
virtual void assign_subset (GridObject *elem, int subsetIndex)
 
template<class TIterator >
void assign_subset (TIterator iterBegin, TIterator iterEnd, int subsetIndex)
 
void clear ()
 
void clear_subset (int subsetIndex)
 
void clear_subsets ()
 
void disable_element_support (uint shElements)
 disable support for element-types. 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 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 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...
 
bool elements_are_supported (uint shElements) const
 returns true if the given element-types are supported. More...
 
virtual void elements_to_be_cleared (Grid *grid)
 
void enable_element_support (uint shElements)
 enable support for element-types. Does not invalidate previous settings. More...
 
void enable_strict_inheritance (bool bEnable)
 
void enable_subset_inheritance (bool bEnable)
 
void erase_subset (int subsetIndex)
 erases the subset at the given index. Assigns -1 to all entries. Moves all other subsets 1 index up. 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 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 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...
 
int get_default_subset_index ()
 
int get_subset_index (const char *name) const
 returns the index of the first subset with the given name. More...
 
int get_subset_index (Edge *elem) const
 
int get_subset_index (Face *elem) const
 
int get_subset_index (GridObject *elem) const
 
int get_subset_index (Vertex *elem) const
 
int get_subset_index (Volume *elem) const
 
const char * get_subset_name (int subsetIndex) const
 returns the name of a subset More...
 
Gridgrid () const
 returns a pointer to the grid on which the subset-handler works. More...
 
void insert_subset (int subsetIndex)
 inserts a subset at the given index. Moves all other subsets 1 index higher. More...
 
 ISubsetHandler (Grid &grid, uint supportedElements=SHE_ALL)
 pass a grid and an or-combination of SubsetHandlerElements to supportedElements. More...
 
 ISubsetHandler (uint supportedElements=SHE_ALL)
 pass an or-combination of SubsetHandlerElements to supportedElements. More...
 
void join_subsets (int targetSub, int sub1, int sub2, bool eraseUnusedSubs)
 Joins two subsets into a new one. Optionally erases the old subsets, if they are no longer used. More...
 
void move_subset (int indexFrom, int indexTo)
 Moves the subset from index From to index To. Moves all subsets between indexFrom+1 and indexTo in the opposite direction. More...
 
int num_subsets () const
 returns the number of subset-infos (return value is int, since SubsetIndices are of type int) More...
 
ISubsetHandleroperator= (const ISubsetHandler &sh)
 assigns subsets based on the subsets in the given subset-handler More...
 
void set_default_subset_index (int subsetIndex)
 
void set_default_subset_info (const SubsetInfo &defSI)
 sets the default subset-info. Used when initializing new subset-infos. More...
 
void set_subset_info (int subsetIndex, const SubsetInfo &subsetInfo)
 
void set_subset_name (const char *name, int subsetIndex)
 sets the name of a subset More...
 
void set_supported_elements (uint shElements)
 set the type of elements that shall be handled by the SubsetHandler. More...
 
bool strict_inheritance_enabled ()
 
SubsetInfosubset_info (int subsetIndex)
 
const SubsetInfosubset_info (int subsetIndex) const
 
bool subset_inheritance_enabled ()
 
void subset_required (int index)
 if the subset with the given index does not yet exist, it will be created. More...
 
void subset_required (int index) const
 throws an error if the given index is equal or higher than num_subsets. More...
 
void swap_subsets (int subsetIndex1, int subsetIndex2)
 Swaps the given subsets,. More...
 
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 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 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 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 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 ~ISubsetHandler ()
 
- 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
 enable subset-attachment support More...
 
typedef Grid::traits< Volume >::AttachedElementList AttachedVolumeList
 
typedef Grid::traits< Edge >::SectionContainer EdgeSectionContainer
 
typedef Grid::traits< Face >::SectionContainer FaceSectionContainer
 
typedef std::vector< SubsetVecLevelVec
 
typedef std::vector< Subset * > SubsetVec
 
typedef Grid::traits< Vertex >::SectionContainer VertexSectionContainer
 
typedef Grid::traits< Volume >::SectionContainer VolumeSectionContainer
 
- Protected Types inherited from ug::ISubsetHandler
typedef AInt ASubsetIndex
 
typedef Grid::traits< Edge >::AttachedElementList AttachedEdgeList
 
typedef Grid::traits< Face >::AttachedElementList AttachedFaceList
 
typedef Grid::traits< Vertex >::AttachedElementList AttachedVertexList
 enable subset-attachment support More...
 
typedef Grid::traits< Volume >::AttachedElementList AttachedVolumeList
 
typedef Grid::traits< Edge >::SectionContainer EdgeSectionContainer
 
typedef Grid::traits< Face >::SectionContainer FaceSectionContainer
 
typedef std::vector< SubsetInfoSubsetInfoVec
 
typedef Grid::traits< Vertex >::SectionContainer VertexSectionContainer
 
typedef Grid::traits< Volume >::SectionContainer VolumeSectionContainer
 

Protected Member Functions

void add_level ()
 
void add_required_subset_lists (int maxIndex)
 add a subset More...
 
void add_subset_to_all_levels ()
 increases m_numSubsets. More...
 
template<class TElem >
void assign_subset_impl (TElem *elem, int subsetIndex)
 this method is called by ISubsetHandler when attachment_support has been enabled. More...
 
template<class TElem >
void change_elem_subset_indices (int indOld, int indNew)
 helper for change_subset_indices More...
 
void change_subset_indices (int indOld, int indNew)
 changes the subset-indices of all elements int the subset. More...
 
void cleanup ()
 
void clear_subset_lists (int index)
 clears the element lists in the given subset. Does not alter any indices. More...
 
template<class TElem >
size_t collect_subset_elements_impl (std::vector< TElem * > &elemsOut, int subsetIndex) const
 helper for collect_subset_elements More...
 
void detach_data ()
 detaches all attached data. More...
 
virtual void erase_subset_lists ()
 erases the subsets. Doesn't alter any indices. More...
 
void erase_subset_lists (int index)
 erases the subset but does not touch the subset-indices. More...
 
void erase_subset_lists_impl ()
 non-virtual implementation of erase_subset_lists. Callable from destructor More...
 
virtual void join_subset_lists (int target, int src1, int src2)
 join the subset-lists but do not touch the subset-indices. More...
 
void level_required (int level) const
 Throws an error if the required level does not yet exist. More...
 
void move_subset_lists (int indexFrom, int indexTo)
 moves the subset but does not touch the subset-indices. More...
 
void multigrid_changed (const GridMessage_MultiGridChanged &gm)
 callback for multigrid messages More...
 
Subsetnew_subset ()
 creates a new subset. Caller is responsible for deletion More...
 
uint num_subsets_in_list () const
 returns the number of subsets in the local list More...
 
template<class TElem >
Grid::traits< TElem >::SectionContainersection_container (int si, int lvl)
 returns the section container for the given type, subset and level More...
 
template<class TElem >
const Grid::traits< TElem >::SectionContainersection_container (int si, int lvl) const
 returns the const section container for the given type, subset and level More...
 
Subsetsubset (int si, int level)
 returns the subset with index si on the given level More...
 
const Subsetsubset (int si, int level) const
 
void swap_subset_lists (int ind1, int ind2)
 swaps the subsets but does not touch the subset-indices. More...
 
VertexSectionContainer::iterator get_list_iterator (Vertex *o)
 returns the iterator at which the given element lies in the section container More...
 
EdgeSectionContainer::iterator get_list_iterator (Edge *o)
 returns the iterator at which the given element lies in the section container More...
 
FaceSectionContainer::iterator get_list_iterator (Face *o)
 returns the iterator at which the given element lies in the section container More...
 
VolumeSectionContainer::iterator get_list_iterator (Volume *o)
 returns the iterator at which the given element lies in the section container More...
 
- Protected Member Functions inherited from ug::ISubsetHandler
void alter_subset_index (Edge *e, int subsetIndex)
 
void alter_subset_index (Face *f, int subsetIndex)
 
void alter_subset_index (Vertex *v, int subsetIndex)
 
void alter_subset_index (Volume *v, int subsetIndex)
 
void assign_subset_handler (const ISubsetHandler &sh)
 selects elements based on the selection in the srcHandler More...
 
void create_required_subsets (int index)
 creates all required infos (and pipes) up to the given index. More...
 
template<class TElem >
void elems_to_be_merged (Grid *grid, TElem *target, TElem *elem1, TElem *elem2)
 helper for GridObserver callbacks. More...
 
void reset_subset_indices (uint shElements=SHE_ALL)
 sets the subset-indices of all elements of m_pGrid to -1. More...
 
void set_grid (Grid *grid)
 set the grid on which the subset-handler shall work. More...
 
void subset_assigned (Edge *e, int subsetIndex)
 
void subset_assigned (Face *f, int subsetIndex)
 
void subset_assigned (Vertex *v, int subsetIndex)
 
void subset_assigned (Volume *v, int subsetIndex)
 

Protected Attributes

AttachedEdgeList::AEntry m_aSharedEntryEDGE
 
AttachedFaceList::AEntry m_aSharedEntryFACE
 
AttachedVolumeList::AEntry m_aSharedEntryVOL
 
AttachedVertexList::AEntry m_aSharedEntryVRT
 
MessageHub::SPCallbackId m_callbackId
 
LevelVec m_levels
 
int m_numSubsets
 
MultiGridm_pMG
 
- Protected Attributes inherited from ug::ISubsetHandler
Grid::EdgeAttachmentAccessor< ASubsetIndexm_aaSubsetIndexEDGE
 
Grid::FaceAttachmentAccessor< ASubsetIndexm_aaSubsetIndexFACE
 
Grid::VolumeAttachmentAccessor< ASubsetIndexm_aaSubsetIndexVOL
 
Grid::VertexAttachmentAccessor< ASubsetIndexm_aaSubsetIndexVRT
 
ASubsetIndex m_aSubsetIndex
 
bool m_bStrictInheritanceEnabled
 
bool m_bSubsetInheritanceEnabled
 
int m_defaultSubsetIndex
 
SubsetInfo m_defaultSubsetInfo
 
Gridm_pGrid
 
SubsetInfoVec m_subsetInfos
 
uint m_supportedElements
 

Detailed Description

Handles subsets on a per level basis.

The MultiGridSubsetHandler is a specialization of ISubsetHandler for MultiGrids. It allows to access elements given a subset-index and a level index.

Note that the number of levels in the MultiGridSubsetHandler always matches the number of levels in the associated multigrid. This is guaranteed through a callback mechanism.

Member Typedef Documentation

◆ AttachedEdgeList

◆ AttachedFaceList

◆ AttachedVertexList

enable subset-attachment support

if subset-attachments are enabled you may attach data to the elements of a subset. This is useful if you want to store different data in the elements of different subsets. returns true if subset-attachments are enabled. attach with unspecified default value. Pass either Vertex, Edge, Face or Volume as TGeomObjClass. attach with specified default value Pass either Vertex, Edge, Face or Volume as TGeomObjClass. Pass either Vertex, Edge, Face or Volume as TGeomObjClass. returns the attachment data container for elements of type TGeomObj for the given subset. Use the data-container with care! You should never clear or resize it.

Valid types for TGeomObj are Vertex, Edge, Face and Volume. call it like this (let sh be an instance of ISubsetHandler): sh.get_attachment_data_container<Vertex>(aSomeAttachment, someSubsetIndex);

◆ AttachedVolumeList

◆ EdgeSectionContainer

◆ FaceSectionContainer

◆ LevelVec

typedef std::vector<SubsetVec> ug::MultiGridSubsetHandler::LevelVec
protected

◆ SubsetVec

typedef std::vector<Subset*> ug::MultiGridSubsetHandler::SubsetVec
protected

◆ VertexSectionContainer

◆ VolumeSectionContainer

Constructor & Destructor Documentation

◆ MultiGridSubsetHandler() [1/3]

ug::MultiGridSubsetHandler::MultiGridSubsetHandler ( uint  supportedElements = SHE_ALL)

References m_numSubsets, and m_pMG.

◆ MultiGridSubsetHandler() [2/3]

ug::MultiGridSubsetHandler::MultiGridSubsetHandler ( MultiGrid mg,
uint  supportedElements = SHE_ALL 
)

References assign_grid(), m_numSubsets, and m_pMG.

◆ MultiGridSubsetHandler() [3/3]

ug::MultiGridSubsetHandler::MultiGridSubsetHandler ( const MultiGridSubsetHandler sh)

WARNING: Don't call the copy-constructor from derived classes, Since it calls virtual methods.

References assign_grid(), ug::ISubsetHandler::assign_subset_handler(), and m_pMG.

◆ ~MultiGridSubsetHandler()

ug::MultiGridSubsetHandler::~MultiGridSubsetHandler ( )
virtual

Member Function Documentation

◆ add_level()

void ug::MultiGridSubsetHandler::add_level ( )
protected

References m_levels, new_subset(), and num_subsets_in_list().

Referenced by level_required().

◆ add_required_subset_lists()

void ug::MultiGridSubsetHandler::add_required_subset_lists ( int  maxIndex)
protectedvirtual

add a subset

Implements ug::ISubsetHandler.

References add_subset_to_all_levels(), and num_subsets_in_list().

◆ add_subset_to_all_levels()

void ug::MultiGridSubsetHandler::add_subset_to_all_levels ( )
protected

increases m_numSubsets.

References m_levels, m_numSubsets, and new_subset().

Referenced by add_required_subset_lists().

◆ assign_grid()

◆ assign_subset() [1/10]

void ug::MultiGridSubsetHandler::assign_subset ( Edge elem,
int  subsetIndex 
)
virtual

assigns an edge to a subset.

If the subset doesn't already exist, it will be created.

Implements ug::ISubsetHandler.

References assign_subset_impl(), ug::ISubsetHandler::elements_are_supported(), and ug::SHE_EDGE.

◆ assign_subset() [2/10]

virtual void ug::ISubsetHandler::assign_subset

The implementation in a derived class should store the element in a list and call subset_assigned with the iterators position and the subset-index. The iterator can later be retrieved with get_list_iterator(...). The index can be retrieved with get_subset_index(...).

◆ assign_subset() [3/10]

void ug::MultiGridSubsetHandler::assign_subset ( Face elem,
int  subsetIndex 
)
virtual

assigns a face to a subset.

If the subset doesn't already exist, it will be created.

Implements ug::ISubsetHandler.

References assign_subset_impl(), ug::ISubsetHandler::elements_are_supported(), and ug::SHE_FACE.

◆ assign_subset() [4/10]

virtual void ug::ISubsetHandler::assign_subset

The implementation in a derived class should store the element in a list and call subset_assigned with the iterators position and the subset-index. The iterator can later be retrieved with get_list_iterator(...). The index can be retrieved with get_subset_index(...).

◆ assign_subset() [5/10]

void ug::ISubsetHandler::assign_subset

Forwards the call to the assign_subset method for the specific type (e.g. Vertex, Edge, Face, Volume).

◆ assign_subset() [6/10]

template<class TIterator >
void ug::ISubsetHandler::assign_subset ( class TIterator  )

◆ assign_subset() [7/10]

void ug::MultiGridSubsetHandler::assign_subset ( Vertex elem,
int  subsetIndex 
)
virtual

assigns a vertex to a subset.

If the subset doesn't already exist, it will be created.

Implements ug::ISubsetHandler.

References assign_subset_impl(), ug::ISubsetHandler::elements_are_supported(), and ug::SHE_VERTEX.

Referenced by ug::AssignSubset_VerticesInCube(), ug::AssignSubset_VerticesInSphere(), and ug::InitLinearManifoldSubsetHandler().

◆ assign_subset() [8/10]

virtual void ug::ISubsetHandler::assign_subset

The implementation in a derived class should store the element in a list and call subset_assigned with the iterators position and the subset-index. The iterator can later be retrieved with get_list_iterator(...). The index can be retrieved with get_subset_index(...).

◆ assign_subset() [9/10]

void ug::MultiGridSubsetHandler::assign_subset ( Volume elem,
int  subsetIndex 
)
virtual

assigns a volume to a subset.

If the subset doesn't already exist, it will be created.

Implements ug::ISubsetHandler.

References assign_subset_impl(), ug::ISubsetHandler::elements_are_supported(), and ug::SHE_VOLUME.

◆ assign_subset() [10/10]

virtual void ug::ISubsetHandler::assign_subset

The implementation in a derived class should store the element in a list and call subset_assigned with the iterators position and the subset-index. The iterator can later be retrieved with get_list_iterator(...). The index can be retrieved with get_subset_index(...).

◆ assign_subset_impl()

template<class TElem >
void ug::MultiGridSubsetHandler::assign_subset_impl ( TElem *  elem,
int  subsetIndex 
)
protected

this method is called by ISubsetHandler when attachment_support has been enabled.

a helper method for the public assign_subset methods.

References ug::MultiGrid::get_level(), get_list_iterator(), ug::ISubsetHandler::get_subset_index(), level_required(), ug::ISubsetHandler::m_pGrid, m_pMG, ug::ISubsetHandler::subset_assigned(), and ug::ISubsetHandler::subset_required().

Referenced by assign_subset().

◆ begin() [1/2]

template<class TElem >
geometry_traits< TElem >::iterator ug::MultiGridSubsetHandler::begin ( int  subsetIndex,
int  level 
)

◆ begin() [2/2]

template<class TElem >
geometry_traits< TElem >::const_iterator ug::MultiGridSubsetHandler::begin ( int  subsetIndex,
int  level 
) const

returns the begin-iterator for the elements of type TElem in the given subset.

e.g. begin<Triangle>(0) Please note that in the const version level < num_levels() has to hold true.

References num_levels(), num_subsets_in_list(), and UG_ASSERT.

◆ change_elem_subset_indices()

template<class TElem >
void ug::MultiGridSubsetHandler::change_elem_subset_indices ( int  indOld,
int  indNew 
)
protected

helper for change_subset_indices

References ug::ISubsetHandler::alter_subset_index(), and m_levels.

◆ change_subset_indices()

void ug::MultiGridSubsetHandler::change_subset_indices ( int  indOld,
int  indNew 
)
protectedvirtual

changes the subset-indices of all elements int the subset.

WARNING: subsets are not automatically changed accordingly. After termination Subset-Indices and Subset-Infos/iterators are asynchronous. Make sure to change subset-infos and iterators accordingly.

Implements ug::ISubsetHandler.

References ug::ISubsetHandler::elements_are_supported(), ug::ISubsetHandler::m_pGrid, ug::SHE_EDGE, ug::SHE_FACE, ug::SHE_VERTEX, and ug::SHE_VOLUME.

◆ cleanup()

void ug::MultiGridSubsetHandler::cleanup ( )
protected

◆ clear_subset_elements() [1/2]

template<class TElem >
void ug::MultiGridSubsetHandler::clear_subset_elements ( int  subsetIndex)

removes all elements of type TElem from the specified subset.

References num_levels().

◆ clear_subset_elements() [2/2]

template<class TElem >
void ug::MultiGridSubsetHandler::clear_subset_elements ( int  subsetIndex,
int  level 
)

removes all elements of type TElem from the specified subset on the given level.

References ug::ISubsetHandler::alter_subset_index(), ug::SectionContainer< TValue, TContainer >::erase(), ug::ISubsetHandler::m_pGrid, and num_subsets_in_list().

◆ clear_subset_lists()

void ug::MultiGridSubsetHandler::clear_subset_lists ( int  index)
protectedvirtual

clears the element lists in the given subset. Does not alter any indices.

Implements ug::ISubsetHandler.

References m_levels, and ug::ISubsetHandler::m_pGrid.

Referenced by join_subset_lists().

◆ collect_subset_elements_impl()

template<class TElem >
size_t ug::MultiGridSubsetHandler::collect_subset_elements_impl ( std::vector< TElem * > &  elemsOut,
int  subsetIndex 
) const
protected

helper for collect_subset_elements

◆ contains_edges()

virtual bool ug::MultiGridSubsetHandler::contains_edges ( int  subsetIndex) const
inlinevirtual

returns true if the subset contains edges

Implements ug::ISubsetHandler.

◆ contains_faces()

virtual bool ug::MultiGridSubsetHandler::contains_faces ( int  subsetIndex) const
inlinevirtual

returns true if the subset contains faces

Implements ug::ISubsetHandler.

◆ contains_vertices()

virtual bool ug::MultiGridSubsetHandler::contains_vertices ( int  subsetIndex) const
inlinevirtual

collects all vertices that are in the given subset.

Please consider using begin and end methods instead. If subset -1 is specified, the method has compexity O(n), where n is the number of vertices in the underlying grid.

Returns
number of collected elements.
See also
begin, end collects all edges that are in the given subset. Please consider using begin and end methods instead. If subset -1 is specified, the method has compexity O(n), where n is the number of edges in the underlying grid.
Returns
number of collected elements.
See also
begin, end collects all faces that are in the given subset. Please consider using begin and end methods instead. If subset -1 is specified, the method has compexity O(n), where n is the number of faces in the underlying grid.
Returns
number of collected elements.
See also
begin, end collects all volumes that are in the given subset. Please consider using begin and end methods instead. If subset -1 is specified, the method has compexity O(n), where n is the number of volumes in the underlying grid.
Returns
number of collected elements.
See also
begin, end returns true if the subset contains vertices

Implements ug::ISubsetHandler.

◆ contains_volumes()

virtual bool ug::MultiGridSubsetHandler::contains_volumes ( int  subsetIndex) const
inlinevirtual

returns true if the subset contains volumes

Implements ug::ISubsetHandler.

◆ detach_data()

◆ end() [1/2]

template<class TElem >
geometry_traits< TElem >::iterator ug::MultiGridSubsetHandler::end ( int  subsetIndex,
int  level 
)

◆ end() [2/2]

template<class TElem >
geometry_traits< TElem >::const_iterator ug::MultiGridSubsetHandler::end ( int  subsetIndex,
int  level 
) const

returns the end-iterator for the elements of type TElem in the given subset.

e.g. end<Triangle>(0) Please note that in the const version level < num_levels() has to hold true.

References num_levels(), num_subsets_in_list(), and UG_ASSERT.

◆ erase_subset_lists() [1/2]

void ug::MultiGridSubsetHandler::erase_subset_lists ( )
protectedvirtual

erases the subsets. Doesn't alter any indices.

Implements ug::ISubsetHandler.

References erase_subset_lists_impl().

◆ erase_subset_lists() [2/2]

void ug::MultiGridSubsetHandler::erase_subset_lists ( int  index)
protectedvirtual

erases the subset but does not touch the subset-indices.

Implements ug::ISubsetHandler.

References m_levels, m_numSubsets, and num_subsets_in_list().

◆ erase_subset_lists_impl()

void ug::MultiGridSubsetHandler::erase_subset_lists_impl ( )
protected

non-virtual implementation of erase_subset_lists. Callable from destructor

References m_levels, and m_numSubsets.

Referenced by cleanup(), erase_subset_lists(), and ~MultiGridSubsetHandler().

◆ get_grid_objects()

GridObjectCollection ug::MultiGridSubsetHandler::get_grid_objects ( int  subsetIndex,
int  level 
) const

returns a GridObjectCollection

the returned GridObjectCollection hold the elements of the specified subset on the given level.

References level_required(), m_levels, and ug::ISubsetHandler::subset_required().

◆ get_grid_objects_in_level()

GridObjectCollection ug::MultiGridSubsetHandler::get_grid_objects_in_level ( int  level) const

returns a GridObjectCollection with multiple levels - each representing a subset.

the returned GridObjectCollection hold the elements of the specified level, each level of the collection represents a subset.

References ug::GridObjectCollection::add_level(), level_required(), m_levels, and num_subsets_in_list().

◆ get_grid_objects_in_subset()

GridObjectCollection ug::MultiGridSubsetHandler::get_grid_objects_in_subset ( int  subsetIndex) const
virtual

returns a GridObjectCollection with multiple levels

the returned GridObjectCollection hold the elements of the specified subset.

Implements ug::ISubsetHandler.

References ug::GridObjectCollection::add_level(), m_levels, and ug::ISubsetHandler::subset_required().

◆ get_level()

template<class TGeomObj >
uint ug::MultiGridSubsetHandler::get_level ( TGeomObj *  obj) const
inline

◆ get_list_iterator() [1/4]

EdgeSectionContainer::iterator ug::MultiGridSubsetHandler::get_list_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 in a subset != -1.

◆ get_list_iterator() [2/4]

FaceSectionContainer::iterator ug::MultiGridSubsetHandler::get_list_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 in a subset != -1.

◆ get_list_iterator() [3/4]

VertexSectionContainer::iterator ug::MultiGridSubsetHandler::get_list_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 in a subset != -1.

Referenced by assign_subset_impl().

◆ get_list_iterator() [4/4]

VolumeSectionContainer::iterator ug::MultiGridSubsetHandler::get_list_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 in a subset != -1.

◆ grid_to_be_destroyed()

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

◆ join_subset_lists()

void ug::MultiGridSubsetHandler::join_subset_lists ( int  target,
int  src1,
int  src2 
)
protectedvirtual

◆ level_required() [1/2]

void ug::MultiGridSubsetHandler::level_required ( int  level)
inline

creates the required levels, if they do not yet exist

References add_level(), and m_levels.

Referenced by assign_grid(), assign_subset_impl(), begin(), end(), get_grid_objects(), get_grid_objects_in_level(), and multigrid_changed().

◆ level_required() [2/2]

void ug::MultiGridSubsetHandler::level_required ( int  level) const
inlineprotected

Throws an error if the required level does not yet exist.

References num_levels(), and UG_THROW.

◆ move_subset_lists()

void ug::MultiGridSubsetHandler::move_subset_lists ( int  indexFrom,
int  indexTo 
)
protectedvirtual

moves the subset but does not touch the subset-indices.

Implements ug::ISubsetHandler.

References m_levels.

◆ multi_grid() [1/2]

MultiGrid* ug::MultiGridSubsetHandler::multi_grid ( )
inline

◆ multi_grid() [2/2]

const MultiGrid* ug::MultiGridSubsetHandler::multi_grid ( ) const
inline

◆ multigrid_changed()

void ug::MultiGridSubsetHandler::multigrid_changed ( const GridMessage_MultiGridChanged gm)
protected

◆ new_subset()

◆ num() [1/3]

template<class TElem >
uint ug::MultiGridSubsetHandler::num

returns the total number of elements

References num_subsets_in_list().

Referenced by ug::CreateSurfaceView(), and ug::SubsetIsRegularGrid().

◆ num() [2/3]

template<class TElem >
uint ug::MultiGridSubsetHandler::num ( int  subsetIndex) const

returns the number of elements in the given subset

References m_levels, and num_subsets_in_list().

◆ num() [3/3]

template<class TElem >
uint ug::MultiGridSubsetHandler::num ( int  subsetIndex,
int  level 
) const

returns the number of elements in the given subset on the given level

References num_levels(), and num_subsets_in_list().

◆ num_levels()

◆ num_subsets_in_list()

uint ug::MultiGridSubsetHandler::num_subsets_in_list ( ) const
inlineprotected

◆ section_container() [1/2]

template<class TElem >
Grid::traits< TElem >::SectionContainer & ug::MultiGridSubsetHandler::section_container ( int  si,
int  lvl 
)
inlineprotected

◆ section_container() [2/2]

template<class TElem >
const Grid::traits< TElem >::SectionContainer & ug::MultiGridSubsetHandler::section_container ( int  si,
int  lvl 
) const
inlineprotected

◆ subset() [1/2]

Subset* ug::MultiGridSubsetHandler::subset ( int  si,
int  level 
)
inlineprotected

returns the subset with index si on the given level

Referenced by section_container().

◆ subset() [2/2]

const Subset* ug::MultiGridSubsetHandler::subset ( int  si,
int  level 
) const
inlineprotected

◆ swap_subset_lists()

void ug::MultiGridSubsetHandler::swap_subset_lists ( int  ind1,
int  ind2 
)
protectedvirtual

swaps the subsets but does not touch the subset-indices.

Implements ug::ISubsetHandler.

References m_levels.

Member Data Documentation

◆ m_aSharedEntryEDGE

AttachedEdgeList::AEntry ug::MultiGridSubsetHandler::m_aSharedEntryEDGE
protected

◆ m_aSharedEntryFACE

AttachedFaceList::AEntry ug::MultiGridSubsetHandler::m_aSharedEntryFACE
protected

◆ m_aSharedEntryVOL

AttachedVolumeList::AEntry ug::MultiGridSubsetHandler::m_aSharedEntryVOL
protected

◆ m_aSharedEntryVRT

AttachedVertexList::AEntry ug::MultiGridSubsetHandler::m_aSharedEntryVRT
protected

◆ m_callbackId

MessageHub::SPCallbackId ug::MultiGridSubsetHandler::m_callbackId
protected

Referenced by assign_grid(), and cleanup().

◆ m_levels

◆ m_numSubsets

int ug::MultiGridSubsetHandler::m_numSubsets
protected

◆ m_pMG

MultiGrid* ug::MultiGridSubsetHandler::m_pMG
protected

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