ug4
ug::SurfaceView Class Reference

Represents the surface view of a multi-grid hierarchy. More...

#include <surface_view.h>

Classes

class  ConstSurfaceViewElementIterator
 Const iterator to traverse the surface of a multi-grid hierarchy. More...
 
class  SurfaceViewElementIterator
 Iterator to traverse the surface of a multi-grid hierarchy. More...
 
struct  traits
 

Public Types

typedef Attachment< SurfaceStateASurfaceState
 
enum  SurfaceConstants {
  MG_SHADOW_PURE = 1 , MG_SURFACE_PURE = 1 << 1 , MG_SURFACE_RIM = 1 << 2 , MG_SHADOW_RIM_COPY = 1 << 3 ,
  MG_SHADOW_RIM_NONCOPY = 1 << 4 , MG_SHADOW_RIM = MG_SHADOW_RIM_COPY | MG_SHADOW_RIM_NONCOPY , MG_SHADOW = MG_SHADOW_RIM | MG_SHADOW_PURE , MG_SURFACE = MG_SURFACE_PURE | MG_SURFACE_RIM ,
  MG_ALL_BUT_SHADOW_COPY = MG_SURFACE | MG_SHADOW_RIM_NONCOPY , MG_ALL = MG_SURFACE | MG_SHADOW_RIM , TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE = 1 << 5 , SHADOW_PURE = MG_SHADOW_PURE | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE ,
  SURFACE_PURE = MG_SURFACE_PURE | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE , SURFACE_RIM = MG_SURFACE_RIM | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE , SHADOW_RIM_COPY = MG_SHADOW_RIM_COPY | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE , SHADOW_RIM_NONCOPY = MG_SHADOW_RIM_NONCOPY | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE ,
  SHADOW_RIM = MG_SHADOW_RIM | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE , SHADOW = MG_SHADOW | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE , SURFACE = MG_SURFACE | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE , ALL_BUT_SHADOW_COPY = MG_ALL_BUT_SHADOW_COPY | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE ,
  ALL = MG_ALL | TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE
}
 
typedef Flag< SurfaceConstants, byte, SS_NONESurfaceState
 

Public Member Functions

template<typename TElem , typename TBaseElem >
void collect_associated (std::vector< TBaseElem * > &vAssElem, TElem *elem, const GridLevel &gl, bool clearContainer=true) const
 returns the adjacent elements w.r.t. the grid level More...
 
bool is_adaptive () const
 returns if multigrid is adaptive More...
 
template<class TGeomObj >
bool is_contained (TGeomObj *obj, const GridLevel &gl, SurfaceState validStates=ALL) const
 returns if the element is contained in the surface view More...
 
template<class TGeomObj >
bool is_ghost (TGeomObj *obj) const
 returns if the element is ghost More...
 
template<class TGeomObj >
bool is_shadowed (TGeomObj *obj) const
 returns if the element is shadowed and thus not contained in the surface view More...
 
template<class TGeomObj >
bool is_shadowing (TGeomObj *obj) const
 returns true if the given element is a shadowing element More...
 
void refresh_surface_states ()
 refresh_surface_states must be called after a grid change More...
 
SmartPtr< MGSubsetHandlersubset_handler ()
 returns underlying subset handler More...
 
ConstSmartPtr< MGSubsetHandlersubset_handler () const
 returns underlying subset handler More...
 
template<class TElem >
SurfaceState surface_state (TElem *elem) const
 returns an or combination of current surface states More...
 
template<class TElem >
SurfaceState surface_state (TElem *elem, const GridLevel &gl) const
 returns the surface states, when considered as part of grid level More...
 
template<class TGeomObj >
SurfaceView::SurfaceState surface_state (TGeomObj *obj, const GridLevel &gl) const
 
 SurfaceView (SmartPtr< MGSubsetHandler > spMGSH, bool adaptiveMG=true)
 
 ~SurfaceView ()
 
template<class TElem >
traits< TElem >::iterator begin (int si, const GridLevel &gl, SurfaceState validStates)
 
template<class TElem >
traits< TElem >::iterator end (int si, const GridLevel &gl, SurfaceState validStates)
 
template<class TElem >
traits< TElem >::const_iterator begin (int si, const GridLevel &gl, SurfaceState validStates) const
 
template<class TElem >
traits< TElem >::const_iterator end (int si, const GridLevel &gl, SurfaceState validStates) const
 
template<class TElem >
traits< TElem >::iterator begin (const GridLevel &gl, SurfaceState validStates)
 
template<class TElem >
traits< TElem >::iterator end (const GridLevel &gl, SurfaceState validStates)
 
template<class TElem >
traits< TElem >::const_iterator begin (const GridLevel &gl, SurfaceState validStates) const
 
template<class TElem >
traits< TElem >::const_iterator end (const GridLevel &gl, SurfaceState validStates) const
 

Private Member Functions

template<class TElem >
void adjust_parallel_surface_states ()
 adjusts surface states in a parallel environment More...
 
template<class TElem >
bool is_local_surface_view_element (TElem *elem)
 returns true if the element is a surface element locally More...
 
template<class TElem >
bool is_vmaster (TElem *elem) const
 
template<class TElem >
void mark_shadowing (bool markSides=false)
 
template<class TElem , class TSide >
void mark_sides_as_surface_or_shadow (TElem *elem, byte surfaceState=MG_SURFACE_PURE)
 recursively marks sides and sides of sides as surface or shadow More...
 
template<class TElem >
void refresh_surface_states ()
 only call for elements of highest dimension More...
 
template<class TElem >
SurfaceStatesurface_state (TElem *elem)
 

Private Attributes

MultiElementAttachmentAccessor< ASurfaceStatem_aaSurfState
 
bool m_adaptiveMG
 
ASurfaceState m_aSurfState
 
DistributedGridManagerm_distGridMgr
 
MultiGridm_pMG
 
SmartPtr< MGSubsetHandlerm_spMGSH
 

Detailed Description

Represents the surface view of a multi-grid hierarchy.

The surface of a multi-grid hierarchy consists of all elements, which do not have children. The surface view allows to iterate over the subsets of such a surface. The surface_begin(...) and surface_end(...) methods even allow to ignore all levels above a specified level, resulting in a new surface-view in which only surface elements up to the specified level and the elements in the specified level are regarded as surface-view-elements.

Member Typedef Documentation

◆ ASurfaceState

◆ SurfaceState

Member Enumeration Documentation

◆ SurfaceConstants

Byte-Constants, that identify the SurfaceState of an grid-object.

Every grid-object is in exactly one SurfaceState. In addition some combinations of the states are named for an easier usage.

IMPORTANT: The order of the byte-flags is currently crucial. Do not change them. See ComPol_GatherSurfaceStates.

Enumerator
MG_SHADOW_PURE 

full-covered (inner)

MG_SURFACE_PURE 

surface, i.e., without children (inner)

MG_SURFACE_RIM 

surface, i.e., without children (at rim)

MG_SHADOW_RIM_COPY 

covered (at rim) with identical child

MG_SHADOW_RIM_NONCOPY 

covered (at rim) with non-identical child(ren)

MG_SHADOW_RIM 

all rim-shadows

MG_SHADOW 

all shadows

MG_SURFACE 

all surface

MG_ALL_BUT_SHADOW_COPY 

surface + rim-non-copy-shadows

MG_ALL 

all (except pure-shadow)

TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE 
SHADOW_PURE 

pseudo-state

SURFACE_PURE 
SURFACE_RIM 
SHADOW_RIM_COPY 
SHADOW_RIM_NONCOPY 
SHADOW_RIM 
SHADOW 
SURFACE 
ALL_BUT_SHADOW_COPY 
ALL 

Constructor & Destructor Documentation

◆ SurfaceView()

ug::SurfaceView::SurfaceView ( SmartPtr< MGSubsetHandler spMGSH,
bool  adaptiveMG = true 
)

◆ ~SurfaceView()

ug::SurfaceView::~SurfaceView ( )

Member Function Documentation

◆ adjust_parallel_surface_states()

template<class TElem >
void ug::SurfaceView::adjust_parallel_surface_states
private

◆ begin() [1/4]

template<class TElem >
SurfaceView::traits< TElem >::iterator ug::SurfaceView::begin ( const GridLevel gl,
SurfaceState  validStates 
)

iterators of grid level

◆ begin() [2/4]

template<class TElem >
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::begin ( const GridLevel gl,
SurfaceState  validStates 
) const

iterators of grid level

◆ begin() [3/4]

template<class TElem >
SurfaceView::traits< TElem >::iterator ug::SurfaceView::begin ( int  si,
const GridLevel gl,
SurfaceState  validStates 
)

◆ begin() [4/4]

template<class TElem >
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::begin ( int  si,
const GridLevel gl,
SurfaceState  validStates 
) const

iterators of grid level

References UG_ASSERT.

◆ collect_associated()

template<typename TElem , typename TBaseElem >
void ug::SurfaceView::collect_associated ( std::vector< TBaseElem * > &  vAssElem,
TElem *  elem,
const GridLevel gl,
bool  clearContainer = true 
) const

◆ end() [1/4]

template<class TElem >
SurfaceView::traits< TElem >::iterator ug::SurfaceView::end ( const GridLevel gl,
SurfaceState  validStates 
)

iterators of grid level

◆ end() [2/4]

template<class TElem >
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::end ( const GridLevel gl,
SurfaceState  validStates 
) const

iterators of grid level

◆ end() [3/4]

template<class TElem >
SurfaceView::traits< TElem >::iterator ug::SurfaceView::end ( int  si,
const GridLevel gl,
SurfaceState  validStates 
)

◆ end() [4/4]

template<class TElem >
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::end ( int  si,
const GridLevel gl,
SurfaceState  validStates 
) const

iterators of grid level

References UG_ASSERT.

◆ is_adaptive()

bool ug::SurfaceView::is_adaptive ( ) const
inline

returns if multigrid is adaptive

References m_adaptiveMG.

◆ is_contained()

◆ is_ghost()

template<class TGeomObj >
bool ug::SurfaceView::is_ghost ( TGeomObj *  obj) const
inline

returns if the element is ghost

ghost elements are vertical masters that are in no other interfaces.

References ug::DistributedGridManager::is_ghost(), and m_distGridMgr.

Referenced by is_contained(), and surface_state().

◆ is_local_surface_view_element()

template<class TElem >
bool ug::SurfaceView::is_local_surface_view_element ( TElem *  elem)
private

returns true if the element is a surface element locally

This method disregards possible copies of the given element on other processes. The method is used during surface-state computation in refresh_surface_states. The method returns false if the given element has children or if it is contained in a vertical master interface.

◆ is_shadowed()

template<class TGeomObj >
bool ug::SurfaceView::is_shadowed ( TGeomObj *  obj) const
inline

returns if the element is shadowed and thus not contained in the surface view

A shadowed element has a child and at least one adjacent element which is a surface element

See also
SurfaceView::is_surface_element, SurfaceView::is_shadowing

References MG_SHADOW_RIM, ug::Flag< TEnum, TStorageType, defaultValue >::partially_contains(), and surface_state().

Referenced by ug::SelectNonShadowsAdjacentToShadowsOnLevel().

◆ is_shadowing()

template<class TGeomObj >
bool ug::SurfaceView::is_shadowing ( TGeomObj *  obj) const
inline

returns true if the given element is a shadowing element

An element is considered to be shadowing if it is the child of a shadowed element. Not that in a distributed grid, this can be true even if the element has no parent on the local process.

See also
SurfaceView::is_shadowed, SurfaceView::is_surface_element

References ug::Flag< TEnum, TStorageType, defaultValue >::contains(), MG_SURFACE_RIM, and surface_state().

◆ is_vmaster()

template<class TElem >
bool ug::SurfaceView::is_vmaster ( TElem *  elem) const
private

◆ mark_shadowing()

template<class TElem >
void ug::SurfaceView::mark_shadowing ( bool  markSides = false)
private

◆ mark_sides_as_surface_or_shadow()

template<class TElem , class TSide >
void ug::SurfaceView::mark_sides_as_surface_or_shadow ( TElem *  elem,
byte  surfaceState = MG_SURFACE_PURE 
)
private

recursively marks sides and sides of sides as surface or shadow

This method is used during refresh_surface_states to assign surface states to sides of surface elements. Make sure that all elements in lower levels have already been processed!

References ug::PeriodicBoundaryManager::is_periodic(), ug::PeriodicBoundaryManager::master(), s, ug::PointerConstArray< TPtr >::size(), and ug::PeriodicBoundaryManager::slaves().

◆ refresh_surface_states() [1/2]

void ug::SurfaceView::refresh_surface_states ( )

refresh_surface_states must be called after a grid change

References pcl::ProcessCommunicator::allreduce(), ug::EDGE, ug::FACE, PCL_RO_MAX, ug::VERTEX, and ug::VOLUME.

Referenced by SurfaceView().

◆ refresh_surface_states() [2/2]

template<class TElem >
void ug::SurfaceView::refresh_surface_states
private

only call for elements of highest dimension

References ug::MultiGrid::begin(), ug::MultiGrid::end(), ug::MultiGrid::num_levels(), and ug::SetAttachmentValues().

◆ subset_handler() [1/2]

◆ subset_handler() [2/2]

ConstSmartPtr< MGSubsetHandler > ug::SurfaceView::subset_handler ( ) const
inline

returns underlying subset handler

References m_spMGSH.

◆ surface_state() [1/4]

template<class TElem >
SurfaceState& ug::SurfaceView::surface_state ( TElem *  elem)
inlineprivate

References m_aaSurfState.

◆ surface_state() [2/4]

template<class TElem >
SurfaceState ug::SurfaceView::surface_state ( TElem *  elem) const
inline

returns an or combination of current surface states

Please use the methods is_surface_element, is_shadowed and is_shadowing instead of this method. The only reason it is publicly accessible is for debugging reasons.

Note
a protected non-const version exists, which returns a reference to the state.

References m_aaSurfState.

◆ surface_state() [3/4]

template<class TElem >
SurfaceState ug::SurfaceView::surface_state ( TElem *  elem,
const GridLevel gl 
) const

◆ surface_state() [4/4]

Member Data Documentation

◆ m_aaSurfState

MultiElementAttachmentAccessor<ASurfaceState> ug::SurfaceView::m_aaSurfState
private

Referenced by surface_state(), and SurfaceView().

◆ m_adaptiveMG

bool ug::SurfaceView::m_adaptiveMG
private

Referenced by is_adaptive().

◆ m_aSurfState

ASurfaceState ug::SurfaceView::m_aSurfState
private

Referenced by SurfaceView(), and ~SurfaceView().

◆ m_distGridMgr

DistributedGridManager* ug::SurfaceView::m_distGridMgr
private

Referenced by is_ghost(), and is_vmaster().

◆ m_pMG

MultiGrid* ug::SurfaceView::m_pMG
private

◆ m_spMGSH

SmartPtr<MGSubsetHandler> ug::SurfaceView::m_spMGSH
private

Referenced by subset_handler().


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