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
91 virtual bool canSkipFullyRemoteCells() const { return false; }
92
117 virtual TraversalObserver* clone(int spacetreeId) = 0;
118
148 virtual std::vector<GridControlEvent> createGridControlEventsForNextTraversal() const = 0;
149
163 virtual void beginTraversal(
165 ) = 0;
166
170 virtual void endTraversal(
172 ) = 0;
173
184 virtual void exchangeAllVerticalDataExchangeStacks(int /*masterId*/) {};
185
198 virtual void exchangeAllHorizontalDataExchangeStacks(bool /*symmetricDataCardinality*/) {};
199
206
219 virtual void streamDataFromSplittingTreeToNewTree(int /*newWorker*/) {};
220 virtual void streamDataFromJoiningTreeToMasterTree(int /*masterId*/) {};
221
228
258
259 virtual void sendVertex(int /*position*/, int /*toStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
260 virtual void sendFace(int /*position*/, int /*toStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
261 virtual void sendCell(int /*toStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
262
263 virtual void receiveAndMergeVertex(int /*position*/, int /*fromStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
264 virtual void receiveAndMergeFace(int /*position*/, int /*fromStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/) {};
265 virtual void receiveAndMergeCell(int /*fromStack*/, SendReceiveContext /*context*/, const GridTraversalEvent& /*event*/){};
266
267 virtual void deleteAllStacks() {};
268};
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 std::vector< GridControlEvent > createGridControlEventsForNextTraversal() const =0
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 bool canSkipFullyRemoteCells() const
May the spacetree skip cells that carry no information for this observer?
virtual void sendCell(int, SendReceiveContext, const GridTraversalEvent &)
virtual void streamDataFromJoiningTreeToMasterTree(int)
virtual void exchangeAllPeriodicBoundaryDataStacks()
Exchange all periodic boundary data.
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:159