Peano
Loading...
Searching...
No Matches
peano4::grid::EmptyTraversalObserver Class Reference

Empty observer. More...

#include <EmptyTraversalObserver.h>

Inheritance diagram for peano4::grid::EmptyTraversalObserver:
Collaboration diagram for peano4::grid::EmptyTraversalObserver:

Public Member Functions

virtual void beginTraversal (const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h) override
 Begin the traversal.
 
virtual void endTraversal (const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h) override
 
virtual void enterCell (const GridTraversalEvent &event) override
 Event is invoked per cell.
 
virtual void leaveCell (const GridTraversalEvent &event) override
 
virtual void loadCell (const GridTraversalEvent &event) override
 
virtual void storeCell (const GridTraversalEvent &event) override
 
virtual TraversalObserver * clone (int spacetreeId) override
 
virtual std::vector< GridControlEvent > getGridControlEvents () const override
 
- Public Member Functions inherited from peano4::grid::TraversalObserver
virtual ~TraversalObserver ()
 
virtual void exchangeAllVerticalDataExchangeStacks (int)
 Send local data from top level of local mesh to master and receive its top-down information in return.
 
virtual void exchangeAllHorizontalDataExchangeStacks (bool)
 Exchange all the data along the domain boundaries.
 
virtual void exchangeAllPeriodicBoundaryDataStacks ()
 Exchange all periodic boundary data.
 
virtual void streamDataFromSplittingTreeToNewTree (int)
 Stream data from current tree on which this routine is called to the new worker.
 
virtual void streamDataFromJoiningTreeToMasterTree (int)
 
virtual void finishAllOutstandingSendsAndReceives ()
 Wrap up all sends and receives, i.e.
 
virtual void sendVertex (int, int, SendReceiveContext, const GridTraversalEvent &)
 
virtual void sendFace (int, int, SendReceiveContext, const GridTraversalEvent &)
 
virtual void sendCell (int, SendReceiveContext, const GridTraversalEvent &)
 
virtual void receiveAndMergeVertex (int, int, SendReceiveContext, const GridTraversalEvent &)
 
virtual void receiveAndMergeFace (int, int, SendReceiveContext, const GridTraversalEvent &)
 
virtual void receiveAndMergeCell (int, SendReceiveContext, const GridTraversalEvent &)
 
virtual void deleteAllStacks ()
 

Static Private Attributes

static tarch::logging::Log _log
 

Additional Inherited Members

- Public Types inherited from peano4::grid::TraversalObserver
enum class  SendReceiveContext {
  BoundaryExchange , MultiscaleExchange , ForkDomain , JoinDomain ,
  PeriodicBoundaryDataSwap
}
 There are three different scenarios when we merge data: More...
 
- Static Public Attributes inherited from peano4::grid::TraversalObserver
static constexpr int NoRebalancing = -1
 
static constexpr int NoData = -1
 Can this grid entity hold data.
 
static constexpr int CreateOrDestroyPersistentGridEntity = -2
 Implies that the data will then be local or had been local.
 
static constexpr int CreateOrDestroyHangingGridEntity = -3
 Implies that the data will then be local or had been local.
 

Detailed Description

Empty observer.

I usually use this only for debugging reasons. The name is not 100 percent correct. The observer at least logs its state transitions.

Definition at line 21 of file EmptyTraversalObserver.h.

Member Function Documentation

◆ beginTraversal()

virtual void peano4::grid::EmptyTraversalObserver::beginTraversal ( const tarch::la::Vector< Dimensions, double > & x,
const tarch::la::Vector< Dimensions, double > & h )
overridevirtual

Begin the traversal.

This routine is called per spacetree instance, i.e. per subtree (thread) per rank. Within the usual implementation, everything will reside on the call stack anyway. If the routine is called on tree no 0, this operation has to establish the master data of the global root tree, i.e. ensure that the data of level -1 is technically there for the subsequent enterCell event, though this data is ill-defined.

Parameters
xRoot cell coordinates
hRoot cell size

Implements peano4::grid::TraversalObserver.

◆ clone()

virtual TraversalObserver * peano4::grid::EmptyTraversalObserver::clone ( int spacetreeId)
overridevirtual
 I use the clone to create one observer object per traversal thread. So
 between different spacetrees of one spacetree set, there can be no race
 condition. Yet, the clone() itself could be called in parallel.

 \section  Global per-sweep actions

 If you want to implement an operation once per sweep in a parallel
 environment, then you can exploit the fact that the spacetree set also
 creates an observer for the global master thread, i.e. tree no 0. So if
 you add a statement alike

 <pre>

if (peano4::parallel::Node::isGlobalMaster(spacetreeId)) { ... }

then you can be sure that the branch body is executed only once globally per grid sweep.

The counterpart of the clone operation is the destructor.

Implements peano4::grid::TraversalObserver.

◆ endTraversal()

virtual void peano4::grid::EmptyTraversalObserver::endTraversal ( const tarch::la::Vector< Dimensions, double > & x,
const tarch::la::Vector< Dimensions, double > & h )
overridevirtual
See also
beginTraversal()

Implements peano4::grid::TraversalObserver.

◆ enterCell()

virtual void peano4::grid::EmptyTraversalObserver::enterCell ( const GridTraversalEvent & event)
overridevirtual

Event is invoked per cell.

It is however not called for the root cell, i.e. for the cell with level 0 that does not have a parent.

Implements peano4::grid::TraversalObserver.

◆ getGridControlEvents()

virtual std::vector< GridControlEvent > peano4::grid::EmptyTraversalObserver::getGridControlEvents ( ) const
overridevirtual
 The tree traversal invokes this operation before beginIteration.

 \section Content

Dynamic AMR is controlled via a sequence of grid control events. Each event spans a certain region and prescribes an h resolution over this region. Depending on the type of the event (erase or refine), the grid adopts. A simple snippet just creating a refined area in a square is

std::vector< peano4::grid::GridControlEvent > applications4::grid::MyObserver::getGridControlEvents() {
std::vector< peano4::grid::GridControlEvent >  controlEvents;
peano4::grid::GridControlEvent newEvent;
newEvent.setRefinementControl( peano4::grid::GridControlEvent::RefinementControl::Refine );
newEvent.setOffset( {0.0,0.0} );
newEvent.setWidth( {0.5,0.5} );
newEvent.setH( {0.05,0.05} );
controlEvents.push_back(newEvent);
return controlEvents;
}
   

The entries are logically ordered. The later the entry, the more important it is. So entry 2 overrules entry 1.

Implements peano4::grid::TraversalObserver.

◆ leaveCell()

virtual void peano4::grid::EmptyTraversalObserver::leaveCell ( const GridTraversalEvent & event)
overridevirtual

◆ loadCell()

virtual void peano4::grid::EmptyTraversalObserver::loadCell ( const GridTraversalEvent & event)
overridevirtual

◆ storeCell()

virtual void peano4::grid::EmptyTraversalObserver::storeCell ( const GridTraversalEvent & event)
overridevirtual

Field Documentation

◆ _log

tarch::logging::Log peano4::grid::EmptyTraversalObserver::_log
staticprivate

Definition at line 23 of file EmptyTraversalObserver.h.


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