Peano
Loading...
Searching...
No Matches
examples::regulargridupscaling::MyObserver Class Reference

#include <MyObserver.h>

Inheritance diagram for examples::regulargridupscaling::MyObserver:
Collaboration diagram for examples::regulargridupscaling::MyObserver:

Public Member Functions

 MyObserver (int spacetreeId, double h, int flopsPerCell)
 
virtual ~MyObserver ()
 
void beginTraversal (const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h) override
 Begin the traversal.
 
void endTraversal (const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h) override
 
void enterCell (const peano4::grid::GridTraversalEvent &event) override
 Event is invoked per cell.
 
void leaveCell (const peano4::grid::GridTraversalEvent &event) override
 
TraversalObserver * clone (int spacetreeId) override
 I use the clone to create one observer object per traversal thread.
 
std::vector< peano4::grid::GridControlEventgetGridControlEvents () override
 
- Public Member Functions inherited from peano4::grid::TraversalObserver
virtual ~TraversalObserver ()
 
virtual void loadCell (const GridTraversalEvent &event)=0
 
virtual void storeCell (const GridTraversalEvent &event)=0
 
virtual std::vector< GridControlEventgetGridControlEvents () const =0
 
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 Public Attributes

static constexpr int RanksObserverTemplate = 1
 
static double FractionOfCellsYieldingIntegrationTask
 
static int IntegrationAccuracy
 
- 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.
 

Private Attributes

const int _spacetreeId
 
const double _h
 
const int _flopsPerCell
 
double _accumulator
 I use an accumulator just to ensure that the flop calculations are not removed.
 
double _taskAccumulator
 

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...
 

Detailed Description

Definition at line 18 of file MyObserver.h.

Constructor & Destructor Documentation

◆ MyObserver()

examples::regulargridupscaling::MyObserver::MyObserver ( int spacetreeId,
double h,
int flopsPerCell )

Definition at line 20 of file MyObserver.cpp.

◆ ~MyObserver()

examples::regulargridupscaling::MyObserver::~MyObserver ( )
virtual

Definition at line 28 of file MyObserver.cpp.

Member Function Documentation

◆ beginTraversal()

void examples::regulargridupscaling::MyObserver::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.

Definition at line 32 of file MyObserver.cpp.

◆ clone()

peano4::grid::TraversalObserver * examples::regulargridupscaling::MyObserver::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.

Implements peano4::grid::TraversalObserver.

Definition at line 99 of file MyObserver.cpp.

◆ endTraversal()

void examples::regulargridupscaling::MyObserver::endTraversal ( const tarch::la::Vector< Dimensions, double > & x,
const tarch::la::Vector< Dimensions, double > & h )
overridevirtual
See also
beginTraversal()

Implements peano4::grid::TraversalObserver.

Definition at line 41 of file MyObserver.cpp.

References logDebug.

◆ enterCell()

void examples::regulargridupscaling::MyObserver::enterCell ( const peano4::grid::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.

Definition at line 50 of file MyObserver.cpp.

References std::abs(), assertion, tarch::la::frobeniusNorm(), peano4::grid::GridTraversalEvent::getCellData(), peano4::grid::GridTraversalEvent::getH(), tarch::multicore::Core::getInstance(), tarch::multicore::Core::getNumberOfThreads(), toolbox::finiteelements::getPoissonMatrixWithJumpingCoefficient(), and peano4::grid::GridTraversalEvent::getX().

Here is the call graph for this function:

◆ getGridControlEvents()

std::vector< peano4::grid::GridControlEvent > examples::regulargridupscaling::MyObserver::getGridControlEvents ( )
override

◆ leaveCell()

void examples::regulargridupscaling::MyObserver::leaveCell ( const peano4::grid::GridTraversalEvent & event)
overridevirtual

Implements peano4::grid::TraversalObserver.

Definition at line 93 of file MyObserver.cpp.

Field Documentation

◆ _accumulator

double examples::regulargridupscaling::MyObserver::_accumulator
private

I use an accumulator just to ensure that the flop calculations are not removed.

Definition at line 29 of file MyObserver.h.

◆ _flopsPerCell

const int examples::regulargridupscaling::MyObserver::_flopsPerCell
private

Definition at line 24 of file MyObserver.h.

◆ _h

const double examples::regulargridupscaling::MyObserver::_h
private

Definition at line 23 of file MyObserver.h.

◆ _log

tarch::logging::Log examples::regulargridupscaling::MyObserver::_log
staticprivate

Definition at line 20 of file MyObserver.h.

◆ _spacetreeId

const int examples::regulargridupscaling::MyObserver::_spacetreeId
private

Definition at line 22 of file MyObserver.h.

◆ _taskAccumulator

double examples::regulargridupscaling::MyObserver::_taskAccumulator
private

Definition at line 31 of file MyObserver.h.

◆ FractionOfCellsYieldingIntegrationTask

double examples::regulargridupscaling::MyObserver::FractionOfCellsYieldingIntegrationTask
static

Definition at line 36 of file MyObserver.h.

Referenced by main().

◆ IntegrationAccuracy

int examples::regulargridupscaling::MyObserver::IntegrationAccuracy
static

Definition at line 37 of file MyObserver.h.

Referenced by main().

◆ RanksObserverTemplate

constexpr int examples::regulargridupscaling::MyObserver::RanksObserverTemplate = 1
staticconstexpr

Definition at line 34 of file MyObserver.h.

Referenced by runParallel().


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