ug4
|
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< SurfaceState > | ASurfaceState |
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_NONE > | SurfaceState |
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< MGSubsetHandler > | subset_handler () |
returns underlying subset handler More... | |
ConstSmartPtr< MGSubsetHandler > | subset_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 > | |
SurfaceState & | surface_state (TElem *elem) |
Private Attributes | |
MultiElementAttachmentAccessor< ASurfaceState > | m_aaSurfState |
bool | m_adaptiveMG |
ASurfaceState | m_aSurfState |
DistributedGridManager * | m_distGridMgr |
MultiGrid * | m_pMG |
SmartPtr< MGSubsetHandler > | m_spMGSH |
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.
typedef Flag<SurfaceConstants, byte, SS_NONE> ug::SurfaceView::SurfaceState |
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.
ug::SurfaceView::SurfaceView | ( | SmartPtr< MGSubsetHandler > | spMGSH, |
bool | adaptiveMG = true |
||
) |
References ug::Grid::attach_to_all_dv(), m_aaSurfState, m_aSurfState, m_pMG, refresh_surface_states(), and UG_ASSERT.
ug::SurfaceView::~SurfaceView | ( | ) |
References ug::Grid::detach_from_all(), m_aSurfState, and m_pMG.
|
private |
adjusts surface states in a parallel environment
References pcl::InterfaceCommunicator< TLayout >::communicate(), pcl::InterfaceCommunicator< TLayout >::exchange_data(), ug::INT_H_MASTER, ug::INT_H_SLAVE, ug::INT_V_MASTER, and ug::INT_V_SLAVE.
SurfaceView::traits< TElem >::iterator ug::SurfaceView::begin | ( | const GridLevel & | gl, |
SurfaceState | validStates | ||
) |
iterators of grid level
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::begin | ( | const GridLevel & | gl, |
SurfaceState | validStates | ||
) | const |
iterators of grid level
SurfaceView::traits< TElem >::iterator ug::SurfaceView::begin | ( | int | si, |
const GridLevel & | gl, | ||
SurfaceState | validStates | ||
) |
iterators of grid level
References UG_ASSERT.
Referenced by ug::ConstructGridOfSCV(), ug::ConstructGridOfSCVF(), ug::MarkAlongSurface(), ug::MarkAnisotropic(), ug::MarkAnisotropicOnlyX(), ug::MarkGlobal(), and ug::MarkSubsets().
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::begin | ( | int | si, |
const GridLevel & | gl, | ||
SurfaceState | validStates | ||
) | const |
iterators of grid level
References UG_ASSERT.
void ug::SurfaceView::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
References ALL, ug::CollectAssociated(), ug::MultiGrid::get_child(), ug::MultiGrid::get_parent(), is_contained(), m_pMG, ug::MultiGrid::num_children(), SHADOW_RIM_COPY, SURFACE, and SURFACE_RIM.
SurfaceView::traits< TElem >::iterator ug::SurfaceView::end | ( | const GridLevel & | gl, |
SurfaceState | validStates | ||
) |
iterators of grid level
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::end | ( | const GridLevel & | gl, |
SurfaceState | validStates | ||
) | const |
iterators of grid level
SurfaceView::traits< TElem >::iterator ug::SurfaceView::end | ( | int | si, |
const GridLevel & | gl, | ||
SurfaceState | validStates | ||
) |
iterators of grid level
References UG_ASSERT.
Referenced by ug::ConstructGridOfSCV(), ug::ConstructGridOfSCVF(), ug::MarkAlongSurface(), ug::MarkAnisotropic(), ug::MarkAnisotropicOnlyX(), ug::MarkGlobal(), and ug::MarkSubsets().
SurfaceView::traits< TElem >::const_iterator ug::SurfaceView::end | ( | int | si, |
const GridLevel & | gl, | ||
SurfaceState | validStates | ||
) | const |
iterators of grid level
References UG_ASSERT.
|
inline |
returns if multigrid is adaptive
References m_adaptiveMG.
|
inline |
returns if the element is contained in the surface view
References ug::Flag< TEnum, TStorageType, defaultValue >::contains(), ug::MultiGrid::get_level(), ug::GridLevel::ghosts(), is_ghost(), ug::GridLevel::level(), m_pMG, MG_SHADOW, MG_SURFACE_PURE, ug::Flag< TEnum, TStorageType, defaultValue >::partially_contains(), subset_handler(), surface_state(), ug::GridLevel::top(), and TREAT_TOP_LVL_SHADOWS_AS_SURFACE_PURE.
Referenced by ug::GridFunctionComponentSpace< TGridFunction >::add_distance_values(), ug::GridFunctionComponentSpace< TGridFunction >::add_norm_values(), collect_associated(), ug::CompositeConvCheck< TVector, TDomain >::extract_dof_indices(), ug::SurfaceView::SurfaceViewElementIterator< TElem >::increment(), ug::SurfaceView::ConstSurfaceViewElementIterator< TElem >::increment(), ug::DoFDistribution::reinit(), and ug::SelectNonShadowsAdjacentToShadowsOnLevel().
|
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().
|
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.
|
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
References MG_SHADOW_RIM, ug::Flag< TEnum, TStorageType, defaultValue >::partially_contains(), and surface_state().
Referenced by ug::SelectNonShadowsAdjacentToShadowsOnLevel().
|
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.
References ug::Flag< TEnum, TStorageType, defaultValue >::contains(), MG_SURFACE_RIM, and surface_state().
|
private |
References ug::DistributedGridManager::contains_status(), ug::ES_V_MASTER, and m_distGridMgr.
|
private |
|
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().
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().
|
private |
only call for elements of highest dimension
References ug::MultiGrid::begin(), ug::MultiGrid::end(), ug::MultiGrid::num_levels(), and ug::SetAttachmentValues().
|
inline |
returns underlying subset handler
References m_spMGSH.
Referenced by ug::ConstructGridOfSCV(), ug::ConstructGridOfSCVF(), ug::SurfaceView::ConstSurfaceViewElementIterator< TElem >::ConstSurfaceViewElementIterator(), is_contained(), ug::DoFDistribution::sum_dof_count(), surface_state(), and ug::SurfaceView::SurfaceViewElementIterator< TElem >::SurfaceViewElementIterator().
|
inline |
returns underlying subset handler
References m_spMGSH.
|
inlineprivate |
References m_aaSurfState.
|
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.
References m_aaSurfState.
SurfaceState ug::SurfaceView::surface_state | ( | TElem * | elem, |
const GridLevel & | gl | ||
) | const |
returns the surface states, when considered as part of grid level
Referenced by ug::AssignSubsetsBySurfaceViewState(), ug::ExchangeAndAdjustSideErrors(), is_contained(), is_shadowed(), is_shadowing(), ug::MarkAlongSurface(), ug::MarkForAdaption_GradientAverage(), ug::DoFDistribution::sum_dof_count(), and surface_state().
SurfaceView::SurfaceState ug::SurfaceView::surface_state | ( | TGeomObj * | obj, |
const GridLevel & | gl | ||
) | const |
|
private |
Referenced by surface_state(), and SurfaceView().
|
private |
Referenced by is_adaptive().
|
private |
Referenced by SurfaceView(), and ~SurfaceView().
|
private |
Referenced by is_ghost(), and is_vmaster().
|
private |
Referenced by collect_associated(), is_contained(), surface_state(), SurfaceView(), and ~SurfaceView().
|
private |
Referenced by subset_handler().