Peano
Loading...
Searching...
No Matches
TraversalObserver.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include <set>
6#include <vector>
7
10#include "tarch/la/Vector.h"
11
12namespace peano4 {
13 namespace grid {
14 class TraversalObserver;
15 // Forward declarations as structs
16 struct GridControlEvent;
17 struct GridTraversalEvent;
18 } // namespace grid
19 namespace datamanagement {
20 struct CellMarker;
21 struct FaceMarker;
22 struct VertexMarker;
23 } // namespace datamanagement
24} // namespace peano4
25
37public:
38 virtual ~TraversalObserver() {}
39
40 static constexpr int NoRebalancing = -1;
41
52 static constexpr int NoData = -1;
53
57 static constexpr int CreateOrDestroyPersistentGridEntity = -2;
58
62 static constexpr int CreateOrDestroyHangingGridEntity = -3;
63
64 virtual void loadCell(const GridTraversalEvent& event) = 0;
65
70 virtual void enterCell(const GridTraversalEvent& event) = 0;
71
72 virtual void leaveCell(const GridTraversalEvent& event) = 0;
73
74 virtual void storeCell(const GridTraversalEvent& event) = 0;
75
100 virtual TraversalObserver* clone(int spacetreeId) = 0;
101
128 virtual std::vector<GridControlEvent> getGridControlEvents() const = 0;
129
143 virtual void beginTraversal(
145 ) = 0;
146
150 virtual void endTraversal(
152 ) = 0;
153
164 virtual void exchangeAllVerticalDataExchangeStacks(int /*masterId*/) {};
165
178 virtual void exchangeAllHorizontalDataExchangeStacks(bool /*symmetricDataCardinality*/) {};
179
186
199 virtual void streamDataFromSplittingTreeToNewTree(int /*newWorker*/) {};
200 virtual void streamDataFromJoiningTreeToMasterTree(int /*masterId*/) {};
201
208
238
239 virtual void sendVertex(int /*position*/, int /*toStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
240 virtual void sendFace(int /*position*/, int /*toStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
241 virtual void sendCell(int /*toStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
242
243 virtual void receiveAndMergeVertex(int /*position*/, int /*fromStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
244 virtual void receiveAndMergeFace(int /*position*/, int /*fromStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
245 virtual void receiveAndMergeCell(int /*fromStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/){};
246
247 virtual void deleteAllStacks() {};
248};
virtual void receiveAndMergeVertex(int, int, SendReceiveContext, const GridTraversalEvent &)
virtual void finishAllOutstandingSendsAndReceives()
Wrap up all sends and receives, i.e.
virtual void receiveAndMergeCell(int, SendReceiveContext, const GridTraversalEvent &)
SendReceiveContext
There are three different scenarios when we merge data:
virtual void streamDataFromSplittingTreeToNewTree(int)
Stream data from current tree on which this routine is called to the new worker.
static constexpr int CreateOrDestroyHangingGridEntity
Implies that the data will then be local or had been local.
static constexpr int CreateOrDestroyPersistentGridEntity
Implies that the data will then be local or had been local.
virtual void loadCell(const GridTraversalEvent &event)=0
virtual TraversalObserver * clone(int spacetreeId)=0
virtual void exchangeAllHorizontalDataExchangeStacks(bool)
Exchange all the data along the domain boundaries.
virtual void storeCell(const GridTraversalEvent &event)=0
virtual void beginTraversal(const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h)=0
Begin the traversal.
virtual void endTraversal(const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h)=0
static constexpr int NoData
Can this grid entity hold data.
virtual void sendFace(int, int, SendReceiveContext, const GridTraversalEvent &)
virtual void sendCell(int, SendReceiveContext, const GridTraversalEvent &)
virtual void streamDataFromJoiningTreeToMasterTree(int)
virtual void exchangeAllPeriodicBoundaryDataStacks()
Exchange all periodic boundary data.
virtual std::vector< GridControlEvent > getGridControlEvents() const =0
virtual void sendVertex(int, int, SendReceiveContext, const GridTraversalEvent &)
virtual void leaveCell(const GridTraversalEvent &event)=0
virtual void enterCell(const GridTraversalEvent &event)=0
Event is invoked per cell.
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 receiveAndMergeFace(int, int, SendReceiveContext, const GridTraversalEvent &)
Simple vector class.
Definition Vector.h:134