Peano 4
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, 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);
99 std::bitset<ThreePowerD> getIsAdjacentCellLocal() const;
100 void setIsAdjacentCellLocal(const std::bitset<ThreePowerD>& value);
101 bool getIsAdjacentCellLocal(int index) const;
102 void setIsAdjacentCellLocal(int index, bool value);
103 void flipIsAdjacentCellLocal(int index);
106 int getVertexDataFrom(int index) const;
107 void setVertexDataFrom(int index, int value);
110 int getVertexDataTo(int index) const;
111 void setVertexDataTo(int index, int value);
114 int getFaceDataFrom(int index) const;
115 void setFaceDataFrom(int index, int value);
118 int getFaceDataTo(int index) const;
119 void setFaceDataTo(int index, int value);
120 int getCellData() const;
121 void setCellData(int value);
124 int getRelativePositionToFather(int index) const;
125 void setRelativePositionToFather(int index, int value);
126 int getInvokingSpacetree() const;
127 void setInvokingSpacetree(int value);
131
132
133 #ifdef Parallel
139 [[clang::map_mpi_datatype]]
140 static MPI_Datatype getForkDatatype();
141
142 [[clang::map_mpi_datatype]]
143 static MPI_Datatype getJoinDatatype();
144
145 [[clang::map_mpi_datatype]]
146 static MPI_Datatype getBoundaryExchangeDatatype();
147
148 [[clang::map_mpi_datatype]]
149 static MPI_Datatype getMultiscaleDataExchangeDatatype();
150
151 [[clang::map_mpi_datatype]]
152 static MPI_Datatype getGlobalCommunciationDatatype();
153
154 [[clang::map_mpi_datatype]]
155 static void freeForkDatatype();
156
157 [[clang::map_mpi_datatype]]
158 static void freeJoinDatatype();
159
160 [[clang::map_mpi_datatype]]
161 static void freeBoundaryExchangeDatatype();
162
163 [[clang::map_mpi_datatype]]
165
166 [[clang::map_mpi_datatype]]
168
173 int getSenderRank() const;
174
179 static void initDatatype();
180
184 static void shutdownDatatype();
185
194 static void send(const peano4::grid::GridTraversalEvent& buffer, int destination, int tag, MPI_Comm communicator );
195 static void receive(peano4::grid::GridTraversalEvent& buffer, int source, int tag, MPI_Comm communicator );
196
203 static void send(const peano4::grid::GridTraversalEvent& buffer, int destination, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
204 static void receive( peano4::grid::GridTraversalEvent& buffer, int source, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
205 #endif
206
207
211
214
215#ifdef Parallel
216 static void sendAndPollDanglingMessages(const peano4::grid::GridTraversalEvent& message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator());
217 static void receiveAndPollDanglingMessages(peano4::grid::GridTraversalEvent& message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator() );
218#endif
219
220
221 std::string toString() const;
222
223 private:
224#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
225 [[clang::truncate_mantissa(23)]] double _x[Dimensions];
226#endif
227#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
229#endif
230#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
231 [[clang::truncate_mantissa(23)]] double _h[Dimensions];
232#endif
233#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
235#endif
236#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
237 [[clang::pack]] bool _hasBeenRefined[TwoPowerD];
238#endif
239#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
240 std::bitset<TwoPowerD> _hasBeenRefined;
241#endif
242#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
243 [[clang::pack]] bool _willBeRefined[TwoPowerD];
244#endif
245#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
246 std::bitset<TwoPowerD> _willBeRefined;
247#endif
248#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
249 [[clang::pack]] bool _isVertexLocal[TwoPowerD];
250#endif
251#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
252 std::bitset<TwoPowerD> _isVertexLocal;
253#endif
254#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
255 [[clang::pack]] bool _isParentVertexLocal[TwoPowerD];
256#endif
257#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
258 std::bitset<TwoPowerD> _isParentVertexLocal;
259#endif
260#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
261 [[clang::pack]] bool _isVertexParentOfSubtree[TwoPowerD];
262#endif
263#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
264 std::bitset<TwoPowerD> _isVertexParentOfSubtree;
265#endif
266#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
267 [[clang::pack]] bool _isFaceLocal[TwoTimesD];
268#endif
269#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
270 std::bitset<TwoTimesD> _isFaceLocal;
271#endif
272 [[clang::pack]] bool _isCellLocal;
273 [[clang::pack]] bool _isParentCellLocal;
274#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
276#endif
277#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
279#endif
280#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
282#endif
283#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
285#endif
286#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
287 [[clang::pack]] bool _isAdjacentCellLocal[ThreePowerD];
288#endif
289#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
290 std::bitset<ThreePowerD> _isAdjacentCellLocal;
291#endif
297#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
298 [[clang::pack_range(0,3)]] int _relativePositionToFather[Dimensions];
299#endif
300#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
302#endif
303 [[clang::pack_range(-1,std::numeric_limits<int>::max())]] int _invokingSpacetree;
305
306
307
308 #ifdef Parallel
309 private:
311
312 #if !defined(__MPI_ATTRIBUTES_LANGUAGE_EXTENSION__)
319 static MPI_Datatype Datatype;
320 #endif
321 #endif
322
323
324
325};
326
327
328
329
#define TwoTimesD
Definition Globals.h:29
#define ThreePowerD
Definition Globals.h:24
#define TwoPowerD
Definition Globals.h:19
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:538
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)
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)
void setWillBeRefined(const std::bitset< TwoPowerD > &value)
static MPI_Datatype getMultiscaleDataExchangeDatatype()
static MPI_Datatype getBoundaryExchangeDatatype()
void setIsVertexAdjacentToParallelDomainBoundary(const std::bitset< TwoPowerD > &value)
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