ug4
|
handler for attachments in a multi-grid More...
#include <copy_attachment_handler.h>
Classes | |
struct | propagate |
struct | propagate< TElem, Dummy > |
struct | register_as_observer |
struct | register_as_observer< Edge, Dummy > |
struct | register_as_observer< Face, Dummy > |
struct | register_as_observer< Vertex, Dummy > |
struct | register_as_observer< Volume, Dummy > |
Public Member Functions | |
CopyAttachmentHandler () | |
constructor 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... | |
void | enable_vertical_communication (bool b) |
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... | |
void | set_attachment (const TAttachment &attch) |
void | set_grid (SmartPtr< MultiGrid > mg) |
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 | 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 | ~CopyAttachmentHandler () |
destructor More... | |
Public Member Functions inherited from ug::GridObserver | |
virtual void | elements_to_be_cleared (Grid *grid) |
virtual void | grid_to_be_destroyed (Grid *grid) |
virtual | ~GridObserver () |
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 | 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_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 | 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 | |
virtual void | copy (TElem *parent, TElem *child) |
virtual void | copy_from_other_elem_type (GridObject *parent, TElem *child) |
void | propagate_to_level (size_t lvl, bool vertComm=true) |
void | propagate_to_levels () |
Protected Attributes | |
TAttachment | m_a |
attachment to be handled More... | |
Grid::AttachmentAccessor< TElem, TAttachment > | m_aa |
accessor for handled attachment More... | |
bool | m_bEnableVertComm |
SmartPtr< MultiGrid > | m_spMG |
multigrid More... | |
Friends | |
struct | propagate< TElem, void > |
handler for attachments in a multi-grid
When using attachments in a multi-grid hierarchy, one EITHER needs to create the attachment after the geometry is refined (and distributed) up to the state in which the attachments are used - in this case, every geometric object which the data is attached to will have its attachment and there is no problem OR one creates the attachment before the geometry is refined (and distributed) - in this case, if the attachment is required on elements that are created after creation of the attachment, one needs to take care to supply those elements with attachment values. This class will do exactly this, but only to a very limited extent:
When this class is assigned a multi-grid, it will propagate attachment values from the base level upwards to the children of the same type< > by copying. Vertical communication is performed on each level to make sure that all those children will get their values.
Moreover, making use of the GridObserver interface, this class will copy attachment values to each child element (of equal type as their parent) created after assignment of the grid.
This will not, in general, guarantee that every element of the required type will get an attachment value. It will however suffice if the element type the attachment is attached to is full-dimensional (in its domain); it will obviously also suffice if the attachment values are only required on direct children (of equal type) of coarse grid elements, e.g. on d-dimensional elements on a d-dimensional manifold.
Example:
If, in the base level, attachments (a1, a2) are attached to their resp. nodes like this:
a1 ------— a2 <– lvl 0
then, on the next level, the node marked by "o" will not have an attachment value propagated from below (since it does not have a parent of the same type):
a1 — o — a2 <– lvl 1
a1 ------— a2 <– lvl 0
You may, however, choose to derive another handler class from this implementation and treat the cases where an upper-level element is child of an element of different type there by overloading copy_from_other_elem_type(). In the same manner, you might use derivation and overloading (of the copy() method) to perform a more specialized way of copying.
|
inline |
constructor
|
inlinevirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlinevirtual |
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.
|
inline |
|
inlinevirtual |
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.
|
inlineprotected |
References pcl::InterfaceCommunicator< TLayout >::communicate(), pcl::InterfaceCommunicator< TLayout >::exchange_data(), ug::DistributedGridManager::grid_layout_map(), ug::INT_V_MASTER, ug::INT_V_SLAVE, ug::CopyAttachmentHandler< TElem, TAttachment >::m_a, ug::CopyAttachmentHandler< TElem, TAttachment >::m_spMG, pcl::NumProcs(), and ug::CopyAttachmentHandler< TElem, TAttachment >::propagate< TElem, void >.
Referenced by ug::CopyAttachmentHandler< TElem, TAttachment >::propagate_to_levels().
|
inlineprotected |
|
inline |
|
inline |
References ug::CopyAttachmentHandler< TElem, TAttachment >::m_a, ug::CopyAttachmentHandler< TElem, TAttachment >::m_aa, ug::CopyAttachmentHandler< TElem, TAttachment >::m_spMG, ug::CopyAttachmentHandler< TElem, TAttachment >::propagate_to_levels(), UG_COND_THROW, and SmartPtr< T, FreePolicy >::valid().
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
friend |
|
protected |
|
protected |
accessor for handled attachment
Referenced by ug::CopyAttachmentHandler< TElem, TAttachment >::copy(), ug::CopyAttachmentHandler< TElem, TAttachment >::set_attachment(), ug::CopyAttachmentHandler< TElem, TAttachment >::set_grid(), and ug::CopyAttachmentHandler< TElem, TAttachment >::~CopyAttachmentHandler().
|
protected |
|
protected |
multigrid
Referenced by ug::CopyAttachmentHandler< TElem, TAttachment >::propagate_to_level(), ug::CopyAttachmentHandler< TElem, TAttachment >::propagate_to_levels(), ug::CopyAttachmentHandler< TElem, TAttachment >::set_attachment(), ug::CopyAttachmentHandler< TElem, TAttachment >::set_grid(), and ug::CopyAttachmentHandler< TElem, TAttachment >::~CopyAttachmentHandler().