ug4
|
#include <periodic_boundary_manager.h>
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... | |
Grid * | get_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... | |
MultiGrid * | m_pGrid |
grid instance we operate on More... | |
ug::PeriodicBoundaryManager::PeriodicBoundaryManager | ( | ) |
ug::PeriodicBoundaryManager::~PeriodicBoundaryManager | ( | ) |
References set_grid().
|
inlineprotected |
sets the identifier instance to use for subset index si
i | identifier pointer |
si |
|
protected |
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
References ug::GridObjectCollection::begin(), ug::GridObjectCollection::end(), ug::GridObjectCollection::num_levels(), and UG_ASSERT.
Referenced by ug::IdentifySubsets().
|
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().
|
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().
|
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().
|
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().
Grid * ug::PeriodicBoundaryManager::get_grid | ( | ) | const |
References m_pGrid.
Referenced by check_elements_periodicity().
Grid::AttachmentAccessor< Face, Attachment< PeriodicBoundaryManager::Group< Face > * > > & ug::PeriodicBoundaryManager::get_group_accessor | ( | ) |
References m_aaGroupVRT.
|
protected |
const Grid::AttachmentAccessor< Volume, Attachment< PeriodicBoundaryManager::Group< Volume > * > > & ug::PeriodicBoundaryManager::get_group_accessor | ( | ) | const |
References m_aaGroupVRT.
|
protected |
Grid::AttachmentAccessor< Volume, Attachment< PeriodicBoundaryManager::PeriodicStatus > > & ug::PeriodicBoundaryManager::get_periodic_status_accessor | ( | ) |
References m_aaPeriodicStatusVRT.
|
protected |
const Grid::AttachmentAccessor< Volume, Attachment< PeriodicBoundaryManager::PeriodicStatus > > & ug::PeriodicBoundaryManager::get_periodic_status_accessor | ( | ) | const |
References m_aaPeriodicStatusVRT.
|
protected |
|
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().
|
protected |
References UG_ASSERT.
Referenced by handle_creation(), handle_deletion(), identify(), make_slave(), master(), print_identification(), remove_slave(), replace_parent(), and slaves().
|
protected |
handles creation of element type
References ug::Grid::associated_elements(), ug::Grid::begin_marking(), ug::Grid::end_marking(), ug::MultiGrid::get_child(), ug::PeriodicBoundaryManager::Group< TElem, Container >::get_slaves(), group(), ug::Grid::is_marked(), is_periodic(), ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master, m_pGrid, make_slave(), ug::Grid::mark(), ug::MultiGrid::num_children(), P_SLAVE_MASTER_UNKNOWN, set_group(), ug::PointerConstArray< TPtr >::size(), slaves(), UG_ASSERT, and ug::VERTEX.
Referenced by handle_creation_cast_wrapper().
|
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().
|
protected |
handles deletion of element type
References group(), is_master(), is_periodic(), is_slave(), make_master(), remove_group(), remove_slave(), UG_ASSERT, and UG_THROW.
Referenced by edge_to_be_erased(), face_to_be_erased(), and vertex_to_be_erased().
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.
e1 | |
e2 | |
i | identifier 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().
bool ug::PeriodicBoundaryManager::is_master | ( | TElem * | e | ) | const |
References P_MASTER.
Referenced by ug::DoFDistribution::add(), ug::ElementDebugInfo_IMPL(), grid_to_be_destroyed(), handle_deletion(), ug::mark_if_periodic(), and replace_parent().
bool ug::PeriodicBoundaryManager::is_periodic | ( | TElem * | e | ) | const |
References P_NOT_PERIODIC, and UG_THROW.
Referenced by ug::HangingNodeRefinerBase< TSelector >::add_hmark(), check_elements_periodicity(), handle_creation(), handle_deletion(), ug::mark_if_periodic(), ug::SurfaceView::mark_sides_as_surface_or_shadow(), and ug::HangingNodeRefinerBase< TSelector >::remove_hmark().
bool ug::PeriodicBoundaryManager::is_slave | ( | TElem * | e | ) | const |
References p, P_SLAVE, and P_SLAVE_MASTER_UNKNOWN.
Referenced by ug::DoFDistribution::add(), ug::ElementDebugInfo_IMPL(), handle_deletion(), ug::AssembledMultiGridCycle< TDomain, TAlgebra >::init_index_mappings(), ug::PeriodicAttachmentAccessor< TElem, TAttachment >::operator[](), replace_parent(), and ug::SubtractValueFromComponent().
|
protected |
References ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master.
Referenced by handle_deletion().
|
protected |
make element e slave of group g
References ug::PeriodicBoundaryManager::Group< TElem, Container >::add_slave(), ug::MultiGrid::get_level(), group(), ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master, m_pGrid, remove_slave(), set_group(), UG_ASSERT, UG_LOG, and UG_THROW.
Referenced by handle_creation(), and identify().
TElem * ug::PeriodicBoundaryManager::master | ( | TElem * | e | ) | const |
References group().
Referenced by ug::HangingNodeRefinerBase< TSelector >::add_hmark(), check_elements_periodicity(), ug::ElementDebugInfo_IMPL(), identify(), ug::mark_if_periodic(), ug::SurfaceView::mark_sides_as_surface_or_shadow(), ug::PeriodicAttachmentAccessor< TElem, TAttachment >::operator[](), print_identification(), and ug::HangingNodeRefinerBase< TSelector >::remove_hmark().
|
protected |
merges g1 in g0 and deletes g1 afterwards
References ug::PeriodicBoundaryManager::Group< TElem, Container >::add_slave(), ug::PeriodicBoundaryManager::Group< TElem, Container >::get_slaves(), ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master, set_group(), and UG_ASSERT.
Referenced by identify().
void ug::PeriodicBoundaryManager::print_identification |
References ug::MultiGrid::begin(), ug::MultiGrid::end(), ug::MultiGrid::get_level(), ug::PeriodicBoundaryManager::Group< TElem, Container >::get_slaves(), ug::GetGridObjectCenter(), group(), ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master, m_pGrid, master(), UG_ASSERT, and UG_LOG.
Referenced by ug::bridge::periodicBoundary::print_all_identifications().
|
protected |
References ug::PeriodicBoundaryManager::Group< TElem, Container >::get_slaves(), ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master, s, and UG_ASSERT.
Referenced by handle_deletion(), and remove_slave().
|
protected |
References ug::find(), group(), remove_group(), s, slaves(), and UG_LOGN.
Referenced by handle_deletion(), and make_slave().
|
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().
void ug::PeriodicBoundaryManager::set_grid | ( | Grid * | g | ) |
References ug::Grid::attach_to_edges_dv(), ug::Grid::attach_to_faces_dv(), ug::Grid::attach_to_vertices_dv(), ug::Grid::detach_from_edges(), ug::Grid::detach_from_faces(), ug::Grid::detach_from_vertices(), m_aaGroupEDG, m_aaGroupFCE, m_aaGroupVRT, m_aaPeriodicStatusEDG, m_aaPeriodicStatusFCE, m_aaPeriodicStatusVRT, m_pGrid, ug::OT_EDGE_OBSERVER, ug::OT_FACE_OBSERVER, ug::OT_GRID_OBSERVER, ug::OT_VERTEX_OBSERVER, P_NOT_PERIODIC, ug::Grid::register_observer(), and ug::Grid::unregister_observer().
Referenced by grid_to_be_destroyed(), ug::Grid::set_periodic_boundaries(), and ~PeriodicBoundaryManager().
|
protected |
References ug::PeriodicBoundaryManager::Group< TElem, Container >::m_master, P_MASTER, P_NOT_PERIODIC, P_SLAVE, and UG_ASSERT.
Referenced by handle_creation(), identify(), make_slave(), merge_groups(), and replace_parent().
PeriodicBoundaryManager::Group< TElem >::SlaveContainer * ug::PeriodicBoundaryManager::slaves | ( | TElem * | e | ) | const |
References group().
Referenced by ug::HangingNodeRefinerBase< TSelector >::add_hmark(), check_elements_periodicity(), ug::ElementDebugInfo_IMPL(), handle_creation(), ug::mark_if_periodic(), ug::SurfaceView::mark_sides_as_surface_or_shadow(), ug::HangingNodeRefinerBase< TSelector >::remove_hmark(), remove_slave(), and replace_parent().
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.
|
protected |
References ug::Grid::begin(), ug::ElementDebugInfo(), ug::Grid::end(), m_pGrid, P_MASTER, P_NOT_PERIODIC, P_SLAVE, P_SLAVE_MASTER_UNKNOWN, and UG_THROW.
|
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().
|
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().
|
protected |
Referenced by grid_to_be_destroyed(), and set_grid().
|
protected |
Referenced by grid_to_be_destroyed(), and set_grid().
|
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().
|
protected |
Referenced by set_grid().
|
protected |
Referenced by set_grid().
|
protected |
attachment accessors for PeriodicStatus
Referenced by get_periodic_status_accessor(), and set_grid().
|
protected |
grid instance we operate on
Referenced by get_grid(), grid_to_be_destroyed(), handle_creation(), identify(), make_slave(), print_identification(), set_grid(), and validity_check().