Peano
Loading...
Searching...
No Matches
GridTraversalEvent.h
Go to the documentation of this file.
1
2//
3// Generated by DaStGen2 (C) 2020 Tobias Weinzierl
4//
5// For DaStGen's copyright, visit www.peano-framework.org. These generated files
6// however are not subject of copyright, i.e. feel free to add your copyright in
7// here
8//
9#pragma once
10
11#include <string>
12
13
14
15#ifdef Parallel
16 #include <mpi.h>
17 #include <functional>
18#endif
19
20#include "tarch/la/Vector.h"
21#include "tarch/mpi/Rank.h"
26
27
28
29
30namespace peano4{
31namespace grid{
32
33 struct GridTraversalEvent;
34}
35}
36
37
38
40 public:
41
42
44 GridTraversalEvent(tarch::la::Vector<Dimensions,double> __x, tarch::la::Vector<Dimensions,double> __h, std::bitset<TwoPowerD> __hasBeenRefined, std::bitset<TwoPowerD> __willBeRefined, std::bitset<TwoPowerD> __isVertexLocal, std::bitset<TwoPowerD> __isParentVertexLocal, std::bitset<TwoPowerD> __isVertexParentOfSubtree, std::bitset<TwoTimesD> __isFaceLocal, bool __isCellLocal, bool __isParentCellLocal, std::bitset<TwoPowerD> __isVertexAdjacentToParallelDomainBoundary, std::bitset<TwoTimesD> __isFaceAdjacentToParallelDomainBoundary, tarch::la::Vector<TwoPowerD,int> __numberOfAdjacentTreesPerVertex, std::bitset<ThreePowerD> __isAdjacentCellLocal, tarch::la::Vector<TwoPowerD,int> __vertexDataFrom, tarch::la::Vector<TwoPowerD,int> __vertexDataTo, tarch::la::Vector<TwoTimesD,int> __faceDataFrom, tarch::la::Vector<TwoTimesD,int> __faceDataTo, int __cellData, tarch::la::Vector<Dimensions,int> __relativePositionToFather, int __invokingSpacetree, bool __invokingSpacetreeIsNotInvolvedInAnyDynamicLoadBalancing);
45
46
49 double getX(int index) const;
50 void setX(int index, double value);
53 double getH(int index) const;
54 void setH(int index, double value);
55 std::bitset<TwoPowerD> getHasBeenRefined() const;
56 void setHasBeenRefined(const std::bitset<TwoPowerD>& value);
57 bool getHasBeenRefined(int index) const;
58 void setHasBeenRefined(int index, bool value);
59 void flipHasBeenRefined(int index);
60 std::bitset<TwoPowerD> getWillBeRefined() const;
61 void setWillBeRefined(const std::bitset<TwoPowerD>& value);
62 bool getWillBeRefined(int index) const;
63 void setWillBeRefined(int index, bool value);
64 void flipWillBeRefined(int index);
65 std::bitset<TwoPowerD> getIsVertexLocal() const;
66 void setIsVertexLocal(const std::bitset<TwoPowerD>& value);
67 bool getIsVertexLocal(int index) const;
68 void setIsVertexLocal(int index, bool value);
69 void flipIsVertexLocal(int index);
70 std::bitset<TwoPowerD> getIsParentVertexLocal() const;
71 void setIsParentVertexLocal(const std::bitset<TwoPowerD>& value);
72 bool getIsParentVertexLocal(int index) const;
73 void setIsParentVertexLocal(int index, bool value);
74 void flipIsParentVertexLocal(int index);
75 std::bitset<TwoPowerD> getIsVertexParentOfSubtree() const;
76 void setIsVertexParentOfSubtree(const std::bitset<TwoPowerD>& value);
77 bool getIsVertexParentOfSubtree(int index) const;
78 void setIsVertexParentOfSubtree(int index, bool value);
79 void flipIsVertexParentOfSubtree(int index);
80 std::bitset<TwoTimesD> getIsFaceLocal() const;
81 void setIsFaceLocal(const std::bitset<TwoTimesD>& value);
82 bool getIsFaceLocal(int index) const;
83 void setIsFaceLocal(int index, bool value);
84 void flipIsFaceLocal(int index);
85 bool getIsCellLocal() const;
86 void setIsCellLocal(bool value);
87 bool getIsParentCellLocal() const;
88 void setIsParentCellLocal(bool value);
89 std::bitset<TwoPowerD> getIsVertexAdjacentToParallelDomainBoundary() const;
90 void setIsVertexAdjacentToParallelDomainBoundary(const std::bitset<TwoPowerD>& value);
92 void setIsVertexAdjacentToParallelDomainBoundary(int index, bool value);
94 std::bitset<TwoTimesD> getIsFaceAdjacentToParallelDomainBoundary() const;
95 void setIsFaceAdjacentToParallelDomainBoundary(const std::bitset<TwoTimesD>& value);
97 void setIsFaceAdjacentToParallelDomainBoundary(int index, bool value);
101 int getNumberOfAdjacentTreesPerVertex(int index) const;
102 void setNumberOfAdjacentTreesPerVertex(int index, int value);
103 std::bitset<ThreePowerD> getIsAdjacentCellLocal() const;
104 void setIsAdjacentCellLocal(const std::bitset<ThreePowerD>& value);
105 bool getIsAdjacentCellLocal(int index) const;
106 void setIsAdjacentCellLocal(int index, bool value);
107 void flipIsAdjacentCellLocal(int index);
110 int getVertexDataFrom(int index) const;
111 void setVertexDataFrom(int index, int value);
114 int getVertexDataTo(int index) const;
115 void setVertexDataTo(int index, int value);
118 int getFaceDataFrom(int index) const;
119 void setFaceDataFrom(int index, int value);
122 int getFaceDataTo(int index) const;
123 void setFaceDataTo(int index, int value);
124 int getCellData() const;
125 void setCellData(int value);
128 int getRelativePositionToFather(int index) const;
129 void setRelativePositionToFather(int index, int value);
130 int getInvokingSpacetree() const;
131 void setInvokingSpacetree(int value);
135
136
137 #ifdef Parallel
143 [[clang::map_mpi_datatype]]
144 static MPI_Datatype getForkDatatype();
145
146 [[clang::map_mpi_datatype]]
147 static MPI_Datatype getJoinDatatype();
148
149 [[clang::map_mpi_datatype]]
150 static MPI_Datatype getBoundaryExchangeDatatype();
151
152 [[clang::map_mpi_datatype]]
153 static MPI_Datatype getMultiscaleDataExchangeDatatype();
154
155 [[clang::map_mpi_datatype]]
156 static MPI_Datatype getGlobalCommunciationDatatype();
157
158 [[clang::map_mpi_datatype]]
159 static void freeForkDatatype();
160
161 [[clang::map_mpi_datatype]]
162 static void freeJoinDatatype();
163
164 [[clang::map_mpi_datatype]]
165 static void freeBoundaryExchangeDatatype();
166
167 [[clang::map_mpi_datatype]]
169
170 [[clang::map_mpi_datatype]]
172
177 int getSenderRank() const;
178
183 static void initDatatype();
184
188 static void shutdownDatatype();
189
198 static void send(const peano4::grid::GridTraversalEvent& buffer, int destination, int tag, MPI_Comm communicator );
199 static void receive(peano4::grid::GridTraversalEvent& buffer, int source, int tag, MPI_Comm communicator );
200
207 static void send(const peano4::grid::GridTraversalEvent& buffer, int destination, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
208 static void receive( peano4::grid::GridTraversalEvent& buffer, int source, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
209 #endif
210
211
215
218
219#ifdef Parallel
220 static void sendAndPollDanglingMessages(const peano4::grid::GridTraversalEvent& message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator());
221 static void receiveAndPollDanglingMessages(peano4::grid::GridTraversalEvent& message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator() );
222#endif
223
224
225 std::string toString() const;
226
227 private:
228#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
229 [[clang::truncate_mantissa(48)]] double _x[Dimensions];
230#endif
231#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
233#endif
234#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
235 [[clang::truncate_mantissa(48)]] double _h[Dimensions];
236#endif
237#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
239#endif
240#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
241 [[clang::pack]] bool _hasBeenRefined[TwoPowerD];
242#endif
243#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
244 std::bitset<TwoPowerD> _hasBeenRefined;
245#endif
246#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
247 [[clang::pack]] bool _willBeRefined[TwoPowerD];
248#endif
249#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
250 std::bitset<TwoPowerD> _willBeRefined;
251#endif
252#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
253 [[clang::pack]] bool _isVertexLocal[TwoPowerD];
254#endif
255#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
256 std::bitset<TwoPowerD> _isVertexLocal;
257#endif
258#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
259 [[clang::pack]] bool _isParentVertexLocal[TwoPowerD];
260#endif
261#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
262 std::bitset<TwoPowerD> _isParentVertexLocal;
263#endif
264#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
265 [[clang::pack]] bool _isVertexParentOfSubtree[TwoPowerD];
266#endif
267#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
268 std::bitset<TwoPowerD> _isVertexParentOfSubtree;
269#endif
270#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
271 [[clang::pack]] bool _isFaceLocal[TwoTimesD];
272#endif
273#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
274 std::bitset<TwoTimesD> _isFaceLocal;
275#endif
276 [[clang::pack]] bool _isCellLocal;
277 [[clang::pack]] bool _isParentCellLocal;
278#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
280#endif
281#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
283#endif
284#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
286#endif
287#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
289#endif
291#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
292 [[clang::pack]] bool _isAdjacentCellLocal[ThreePowerD];
293#endif
294#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
295 std::bitset<ThreePowerD> _isAdjacentCellLocal;
296#endif
302#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
303 [[clang::pack_range(0,3)]] int _relativePositionToFather[Dimensions];
304#endif
305#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
307#endif
308 [[clang::pack_range(-1,std::numeric_limits<int>::max())]] int _invokingSpacetree;
310
311
312
313 #ifdef Parallel
314 private:
316
317 #if !defined(__MPI_ATTRIBUTES_LANGUAGE_EXTENSION__)
324 static MPI_Datatype Datatype;
325 #endif
326 #endif
327
328
329
330};
331
332
333
334
#define TwoTimesD
Definition Globals.h:30
#define ThreePowerD
Definition Globals.h:24
#define TwoPowerD
Definition Globals.h:19
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:539
static MPI_Datatype getForkDatatype()
Hands out MPI datatype if we work without the LLVM MPI extension.
void setIsFaceAdjacentToParallelDomainBoundary(const std::bitset< TwoTimesD > &value)
std::bitset< TwoTimesD > getIsFaceLocal() const
std::bitset< ThreePowerD > _isAdjacentCellLocal
void setIsFaceLocal(const std::bitset< TwoTimesD > &value)
void setRelativePositionToFather(const tarch::la::Vector< Dimensions, int > &value)
bool getInvokingSpacetreeIsNotInvolvedInAnyDynamicLoadBalancing() const
void setVertexDataFrom(const tarch::la::Vector< TwoPowerD, int > &value)
tarch::la::Vector< TwoTimesD, int > getFaceDataFrom() const
std::bitset< TwoPowerD > getIsVertexParentOfSubtree() const
std::bitset< TwoPowerD > _isParentVertexLocal
std::bitset< TwoPowerD > getHasBeenRefined() const
static void sendAndPollDanglingMessages(const peano4::grid::GridTraversalEvent &message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
tarch::la::Vector< TwoPowerD, int > _vertexDataFrom
void setFaceDataTo(const tarch::la::Vector< TwoTimesD, int > &value)
static void receive(peano4::grid::GridTraversalEvent &buffer, int source, int tag, MPI_Comm communicator)
std::bitset< TwoTimesD > _isFaceAdjacentToParallelDomainBoundary
void setX(const tarch::la::Vector< Dimensions, double > &value)
static void send(const peano4::grid::GridTraversalEvent &buffer, int destination, int tag, MPI_Comm communicator)
In DaStGen (the first version), I had a non-static version of the send as well as the receive.
void flipIsVertexAdjacentToParallelDomainBoundary(int index)
void setNumberOfAdjacentTreesPerVertex(const tarch::la::Vector< TwoPowerD, int > &value)
std::bitset< TwoPowerD > _hasBeenRefined
std::bitset< TwoPowerD > _isVertexLocal
tarch::la::Vector< TwoTimesD, int > _faceDataTo
void setInvokingSpacetreeIsNotInvolvedInAnyDynamicLoadBalancing(bool value)
std::bitset< ThreePowerD > getIsAdjacentCellLocal() const
tarch::la::Vector< TwoTimesD, int > _faceDataFrom
tarch::la::Vector< TwoPowerD, int > getVertexDataFrom() const
static void shutdownDatatype()
Free the underlying MPI datatype.
void setIsAdjacentCellLocal(const std::bitset< ThreePowerD > &value)
std::bitset< TwoPowerD > getIsParentVertexLocal() const
std::bitset< TwoPowerD > _isVertexParentOfSubtree
std::bitset< TwoPowerD > getWillBeRefined() const
std::bitset< TwoPowerD > getIsVertexAdjacentToParallelDomainBoundary() const
void setFaceDataFrom(const tarch::la::Vector< TwoTimesD, int > &value)
tarch::la::Vector< TwoTimesD, int > getFaceDataTo() const
static void initDatatype()
Wrapper around getDatatype() to trigger lazy evaluation if we use the lazy initialisation.
tarch::la::Vector< Dimensions, double > getH() const
void flipIsFaceAdjacentToParallelDomainBoundary(int index)
void setIsVertexLocal(const std::bitset< TwoPowerD > &value)
tarch::la::Vector< Dimensions, int > _relativePositionToFather
void setH(const tarch::la::Vector< Dimensions, double > &value)
void setIsParentVertexLocal(const std::bitset< TwoPowerD > &value)
tarch::la::Vector< TwoPowerD, int > _numberOfAdjacentTreesPerVertex
void setWillBeRefined(const std::bitset< TwoPowerD > &value)
static MPI_Datatype getMultiscaleDataExchangeDatatype()
static MPI_Datatype getBoundaryExchangeDatatype()
void setIsVertexAdjacentToParallelDomainBoundary(const std::bitset< TwoPowerD > &value)
tarch::la::Vector< TwoPowerD, int > getNumberOfAdjacentTreesPerVertex() const
static void receiveAndPollDanglingMessages(peano4::grid::GridTraversalEvent &message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
void setIsVertexParentOfSubtree(const std::bitset< TwoPowerD > &value)
std::bitset< TwoPowerD > _isVertexAdjacentToParallelDomainBoundary
std::bitset< TwoTimesD > _isFaceLocal
tarch::la::Vector< TwoPowerD, int > getVertexDataTo() const
std::bitset< TwoPowerD > getIsVertexLocal() const
static MPI_Datatype getGlobalCommunciationDatatype()
tarch::la::Vector< Dimensions, double > _h
tarch::la::Vector< Dimensions, double > getX() const
std::bitset< TwoTimesD > getIsFaceAdjacentToParallelDomainBoundary() const
tarch::la::Vector< Dimensions, int > getRelativePositionToFather() const
tarch::la::Vector< Dimensions, double > _x
void setVertexDataTo(const tarch::la::Vector< TwoPowerD, int > &value)
void setHasBeenRefined(const std::bitset< TwoPowerD > &value)
tarch::la::Vector< TwoPowerD, int > _vertexDataTo
std::bitset< TwoPowerD > _willBeRefined
static MPI_Datatype Datatype
Whenever we use LLVM's MPI extension (DaStGe), we rely on lazy initialisation of the datatype.
Simple vector class.
Definition Vector.h:134