ug4
ug::PeriodicBoundaryManager Class Reference

#include <periodic_boundary_manager.h>

+ Inheritance diagram for ug::PeriodicBoundaryManager:

Classes

class  Group
 

Public Types

enum  PeriodicStatus { P_SLAVE , P_SLAVE_MASTER_UNKNOWN , P_MASTER , P_NOT_PERIODIC }
 

Public Member Functions

bool check_periodicity (const GridObjectCollection &goc1, const GridObjectCollection &goc2, ISubsetHandler *sh=NULL)
 checks that all elements of given gocs are periodic (called after identification) 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 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...
 
Gridget_grid () const
 
template<>
Grid::AttachmentAccessor< Vertex, Attachment< PeriodicBoundaryManager::Group< Vertex > * > > & get_group_accessor ()
 
template<>
const Grid::AttachmentAccessor< Vertex, Attachment< PeriodicBoundaryManager::Group< Vertex > * > > & get_group_accessor () const
 
template<>
Grid::AttachmentAccessor< Vertex, Attachment< PeriodicBoundaryManager::PeriodicStatus > > & get_periodic_status_accessor ()
 
template<>
const Grid::AttachmentAccessor< Vertex, Attachment< PeriodicBoundaryManager::PeriodicStatus > > & get_periodic_status_accessor () const
 
virtual void grid_to_be_destroyed (Grid *grid)
 grid observation methods More...
 
template<class TElem >
void identify (TElem *e1, TElem *e2, IIdentifier &i)
 
template<class TElem >
bool is_master (TElem *) const
 
template<class TElem >
bool is_periodic (TElem *e) const
 
template<class TElem >
bool is_slave (TElem *) const
 
template<class TElem >
TElem * master (TElem *e) const
 
 PeriodicBoundaryManager ()
 
template<class TElem >
void print_identification () const
 
void set_grid (Grid *g)
 
template<class TElem >
Group< TElem >::SlaveContainer * slaves (TElem *e) const
 
void validity_check ()
 
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...
 
 ~PeriodicBoundaryManager ()
 
- Public Member Functions inherited from ug::GridObserver
virtual void elements_to_be_cleared (Grid *grid)
 
virtual ~GridObserver ()
 
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 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 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 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...
 
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...
 

Protected Member Functions

template<class TElem , class TIterator >
void check_elements_periodicity (TIterator begin, TIterator end, typename Group< TElem >::unique_pairs &s, ISubsetHandler *sh)
 
template<class TElem >
Grid::AttachmentAccessor< TElem, Attachment< Group< TElem > * > > & get_group_accessor ()
 
template<class TElem >
const Grid::AttachmentAccessor< TElem, Attachment< Group< TElem > * > > & get_group_accessor () const
 
template<class TElem >
Grid::AttachmentAccessor< TElem, Attachment< PeriodicStatus > > & get_periodic_status_accessor ()
 
template<class TElem >
const Grid::AttachmentAccessor< TElem, Attachment< PeriodicStatus > > & get_periodic_status_accessor () const
 
template<class TElem >
Group< TElem > * group (TElem *e) const
 
template<class TElem , class TParent >
void handle_creation (TElem *e, TParent *pParent)
 handles creation of element type More...
 
template<class TElem >
void handle_creation_cast_wrapper (TElem *e, GridObject *parent, bool replacesParent)
 casts parent pointer to exact type before calling handle_creation More...
 
template<class TElem >
void handle_deletion (TElem *e, TElem *replacedBy)
 handles deletion of element type More...
 
template<class TElem >
void make_master (Group< TElem > *g, TElem *e)
 
template<class TElem >
void make_slave (Group< TElem > *g, TElem *e)
 make element e slave of group g More...
 
template<class TElem >
void merge_groups (Group< TElem > *g0, Group< TElem > *g1)
 
 PeriodicBoundaryManager (const PeriodicBoundaryManager &)
 
template<class TElem >
void remove_group (Group< TElem > *g)
 
template<class TElem >
bool remove_slave (TElem *slave)
 
template<class TElem >
void replace_parent (TElem *e, TElem *pParent)
 replaces all group occurrances of pParent by the specified elem More...
 
template<class TElem >
void set_group (Group< TElem > *g, TElem *e)
 
template<class TElem >
void validity_check ()
 

Protected Attributes

Grid::AttachmentAccessor< Edge, Attachment< Group< Edge > * > > m_aaGroupEDG
 
Grid::AttachmentAccessor< Face, Attachment< Group< Face > * > > m_aaGroupFCE
 
Grid::AttachmentAccessor< Vertex, Attachment< Group< Vertex > * > > m_aaGroupVRT
 store subset handler of domain to lookup element subset ids More...
 
Grid::AttachmentAccessor< Edge, Attachment< PeriodicStatus > > m_aaPeriodicStatusEDG
 
Grid::AttachmentAccessor< Face, Attachment< PeriodicStatus > > m_aaPeriodicStatusFCE
 
Grid::AttachmentAccessor< Vertex, Attachment< PeriodicStatus > > m_aaPeriodicStatusVRT
 attachment accessors for PeriodicStatus More...
 
MultiGridm_pGrid
 grid instance we operate on More...
 

Member Enumeration Documentation

◆ PeriodicStatus

Enumerator
P_SLAVE 
P_SLAVE_MASTER_UNKNOWN 
P_MASTER 
P_NOT_PERIODIC 

Constructor & Destructor Documentation

◆ PeriodicBoundaryManager() [1/2]

ug::PeriodicBoundaryManager::PeriodicBoundaryManager ( )

◆ ~PeriodicBoundaryManager()

ug::PeriodicBoundaryManager::~PeriodicBoundaryManager ( )

References set_grid().

◆ PeriodicBoundaryManager() [2/2]

ug::PeriodicBoundaryManager::PeriodicBoundaryManager ( const PeriodicBoundaryManager )
inlineprotected

sets the identifier instance to use for subset index si

Parameters
iidentifier pointer
si

Member Function Documentation

◆ check_elements_periodicity()

template<class TElem , class TIterator >
void ug::PeriodicBoundaryManager::check_elements_periodicity ( TIterator  begin,
TIterator  end,
typename Group< TElem >::unique_pairs &  s,
ISubsetHandler sh 
)
protected

◆ check_periodicity()

bool ug::PeriodicBoundaryManager::check_periodicity ( const GridObjectCollection goc1,
const GridObjectCollection goc2,
ISubsetHandler sh = NULL 
)

checks that all elements of given gocs are periodic (called after identification)

performs following checks on all elements in goc1 and goc2

  1. all elements given are periodic
  2. masters of groups are valid (master pointer of group valid + have at least one child)
  3. no duplicate master, slave pairs exists 4.

References ug::GridObjectCollection::begin(), ug::GridObjectCollection::end(), ug::GridObjectCollection::num_levels(), and UG_ASSERT.

Referenced by ug::IdentifySubsets().

◆ edge_created()

void ug::PeriodicBoundaryManager::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 handle_creation_cast_wrapper().

◆ edge_to_be_erased()

void ug::PeriodicBoundaryManager::edge_to_be_erased ( Grid grid,
Edge e,
Edge replacedBy = NULL 
)
virtual

Notified whenever an element of the given type is erased from the given grid.

Erase callbacks are called in reverse order in which the GridObservers were registered at the given grid.

if replacedBy != NULL the erased object is only replaced by another grid object of the same base type. This usually happens when constraining objects are replaced by regular objects in refinements. (E.g. a constraining edge by become a regular Edge; note that both objects are of type Edge*).

Reimplemented from ug::GridObserver.

References handle_deletion().

◆ face_created()

void ug::PeriodicBoundaryManager::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 handle_creation_cast_wrapper().

◆ face_to_be_erased()

void ug::PeriodicBoundaryManager::face_to_be_erased ( Grid grid,
Face f,
Face replacedBy = NULL 
)
virtual

Notified whenever an element of the given type is erased from the given grid.

Erase callbacks are called in reverse order in which the GridObservers were registered at the given grid.

if replacedBy != NULL the erased object is only replaced by another grid object of the same base type. This usually happens when constraining objects are replaced by regular objects in refinements. (E.g. a constraining edge by become a regular Edge; note that both objects are of type Edge*).

Reimplemented from ug::GridObserver.

References handle_deletion().

◆ get_grid()

Grid * ug::PeriodicBoundaryManager::get_grid ( ) const

References m_pGrid.

Referenced by check_elements_periodicity().

◆ get_group_accessor() [1/4]

template<>
Grid::AttachmentAccessor< Face, Attachment< PeriodicBoundaryManager::Group< Face > * > > & ug::PeriodicBoundaryManager::get_group_accessor ( )

References m_aaGroupVRT.

◆ get_group_accessor() [2/4]

template<class TElem >
Grid::AttachmentAccessor<TElem, Attachment<Group<TElem>* > >& ug::PeriodicBoundaryManager::get_group_accessor ( )
protected

◆ get_group_accessor() [3/4]

template<>
const Grid::AttachmentAccessor< Volume, Attachment< PeriodicBoundaryManager::Group< Volume > * > > & ug::PeriodicBoundaryManager::get_group_accessor ( ) const

References m_aaGroupVRT.

◆ get_group_accessor() [4/4]

template<class TElem >
const Grid::AttachmentAccessor<TElem, Attachment<Group<TElem>* > >& ug::PeriodicBoundaryManager::get_group_accessor ( ) const
protected

◆ get_periodic_status_accessor() [1/4]

template<>
Grid::AttachmentAccessor< Volume, Attachment< PeriodicBoundaryManager::PeriodicStatus > > & ug::PeriodicBoundaryManager::get_periodic_status_accessor ( )

References m_aaPeriodicStatusVRT.

◆ get_periodic_status_accessor() [2/4]

template<class TElem >
Grid::AttachmentAccessor<TElem, Attachment<PeriodicStatus> >& ug::PeriodicBoundaryManager::get_periodic_status_accessor ( )
protected

◆ get_periodic_status_accessor() [3/4]

template<>
const Grid::AttachmentAccessor< Volume, Attachment< PeriodicBoundaryManager::PeriodicStatus > > & ug::PeriodicBoundaryManager::get_periodic_status_accessor ( ) const

References m_aaPeriodicStatusVRT.

◆ get_periodic_status_accessor() [4/4]

template<class TElem >
const Grid::AttachmentAccessor<TElem, Attachment<PeriodicStatus> >& ug::PeriodicBoundaryManager::get_periodic_status_accessor ( ) const
protected

◆ grid_to_be_destroyed()

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

grid observation methods

delete groups

Reimplemented from ug::GridObserver.

References ug::MultiGrid::begin(), ug::MultiGrid::end(), is_master(), m_aaGroupEDG, m_aaGroupFCE, m_aaGroupVRT, m_pGrid, and set_grid().

◆ group()

template<class TElem >
PeriodicBoundaryManager::Group< TElem > * ug::PeriodicBoundaryManager::group ( TElem *  e) const
protected

◆ handle_creation()

◆ handle_creation_cast_wrapper()

template<class TElem >
void ug::PeriodicBoundaryManager::handle_creation_cast_wrapper ( TElem *  e,
GridObject parent,
bool  replacesParent 
)
protected

casts parent pointer to exact type before calling handle_creation

References ug::GridObject::base_object_id(), ug::EDGE, ug::FACE, handle_creation(), replace_parent(), UG_THROW, ug::VERTEX, and ug::VOLUME.

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

◆ handle_deletion()

template<class TElem >
void ug::PeriodicBoundaryManager::handle_deletion ( TElem *  e,
TElem *  replacedBy 
)
protected

◆ identify()

template<class TElem >
void ug::PeriodicBoundaryManager::identify ( TElem *  e1,
TElem *  e2,
IIdentifier i 
)

ATTENTION: method assumes, that e1 and e2 are matching! identifies element e1 with e2. If element type has sides, it will recursively ascend to the lowest dimension type (vertex) and identifies them.

Parameters
e1
e2
iidentifier to use to perform geometrical matching of elements

References ug::Grid::associated_elements(), group(), m_pGrid, make_slave(), master(), ug::IIdentifier::match(), merge_groups(), set_group(), and UG_THROW.

Referenced by ug::IdentifySubsets().

◆ is_master()

template<class TElem >
bool ug::PeriodicBoundaryManager::is_master ( TElem *  e) const

◆ is_periodic()

◆ is_slave()

◆ make_master()

template<class TElem >
void ug::PeriodicBoundaryManager::make_master ( Group< TElem > *  g,
TElem *  e 
)
protected

◆ make_slave()

template<class TElem >
void ug::PeriodicBoundaryManager::make_slave ( Group< TElem > *  g,
TElem *  e 
)
protected

◆ master()

◆ merge_groups()

template<class TElem >
void ug::PeriodicBoundaryManager::merge_groups ( Group< TElem > *  g0,
Group< TElem > *  g1 
)
protected

◆ print_identification()

◆ remove_group()

template<class TElem >
void ug::PeriodicBoundaryManager::remove_group ( Group< TElem > *  g)
protected

◆ remove_slave()

template<class TElem >
bool ug::PeriodicBoundaryManager::remove_slave ( TElem *  slave)
protected

◆ replace_parent()

template<class TElem >
void ug::PeriodicBoundaryManager::replace_parent ( TElem *  e,
TElem *  pParent 
)
protected

replaces all group occurrances of pParent by the specified elem

TParent should be only of type Vertex, Edge, Face. Volumes are not meant to be periodic.

If replacesParent is true, e is meant to replace pParent

References group(), is_master(), is_slave(), ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master, set_group(), and slaves().

Referenced by handle_creation_cast_wrapper().

◆ set_grid()

◆ set_group()

template<class TElem >
void ug::PeriodicBoundaryManager::set_group ( Group< TElem > *  g,
TElem *  e 
)
protected

◆ slaves()

◆ validity_check() [1/2]

void ug::PeriodicBoundaryManager::validity_check ( )

makes sure that all master/slave identifications are correct and that no unconnected masters or slaves exist. This method iterates over all elements of the grid and is thus rather expensive.

◆ validity_check() [2/2]

template<class elem_t >
void ug::PeriodicBoundaryManager::validity_check
protected

◆ vertex_created()

void ug::PeriodicBoundaryManager::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 handle_creation_cast_wrapper().

◆ vertex_to_be_erased()

void ug::PeriodicBoundaryManager::vertex_to_be_erased ( Grid grid,
Vertex vrt,
Vertex replacedBy = NULL 
)
virtual

Notified whenever an element of the given type is erased from the given grid.

Erase callbacks are called in reverse order in which the GridObservers were registered at the given grid.

if replacedBy != NULL the erased object is only replaced by another grid object of the same base type. This usually happens when constraining objects are replaced by regular objects in refinements. (E.g. a constraining edge by become a regular Edge; note that both objects are of type Edge*).

Reimplemented from ug::GridObserver.

References handle_deletion().

Member Data Documentation

◆ m_aaGroupEDG

Grid::AttachmentAccessor<Edge, Attachment<Group<Edge>* > > ug::PeriodicBoundaryManager::m_aaGroupEDG
protected

Referenced by grid_to_be_destroyed(), and set_grid().

◆ m_aaGroupFCE

Grid::AttachmentAccessor<Face, Attachment<Group<Face>* > > ug::PeriodicBoundaryManager::m_aaGroupFCE
protected

Referenced by grid_to_be_destroyed(), and set_grid().

◆ m_aaGroupVRT

Grid::AttachmentAccessor<Vertex, Attachment<Group<Vertex>* > > ug::PeriodicBoundaryManager::m_aaGroupVRT
protected

store subset handler of domain to lookup element subset ids

identifier mapping to subset indices stores IIdentifier pointers to subset index position to look them up in constant time. attachment accessors for Groups

Referenced by get_group_accessor(), grid_to_be_destroyed(), and set_grid().

◆ m_aaPeriodicStatusEDG

Grid::AttachmentAccessor<Edge, Attachment<PeriodicStatus> > ug::PeriodicBoundaryManager::m_aaPeriodicStatusEDG
protected

Referenced by set_grid().

◆ m_aaPeriodicStatusFCE

Grid::AttachmentAccessor<Face, Attachment<PeriodicStatus> > ug::PeriodicBoundaryManager::m_aaPeriodicStatusFCE
protected

Referenced by set_grid().

◆ m_aaPeriodicStatusVRT

Grid::AttachmentAccessor<Vertex, Attachment<PeriodicStatus> > ug::PeriodicBoundaryManager::m_aaPeriodicStatusVRT
protected

attachment accessors for PeriodicStatus

Referenced by get_periodic_status_accessor(), and set_grid().

◆ m_pGrid

MultiGrid* ug::PeriodicBoundaryManager::m_pGrid
protected

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