Peano
Loading...
Searching...
No Matches
AutomatonState.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#ifdef Parallel
14#include <functional>
15#include <mpi.h>
16#endif
17
21#include "tarch/la/Vector.h"
22#include "tarch/mpi/Rank.h"
24
25
26namespace peano4 {
27 namespace grid {
28 struct AutomatonState;
29 } // namespace grid
30} // namespace peano4
31
33public:
34 AutomatonState() = default;
36 int __level,
39 bool __inverted,
40 std::bitset<Dimensions> __evenFlags,
42 );
43
44 AutomatonState(const AutomatonState& copy);
46
47 ~AutomatonState() = default;
48
49 int getLevel() const;
50 void setLevel(int value);
53 double getX(int index) const;
54 void setX(int index, double value);
57 double getH(int index) const;
58 void setH(int index, double value);
59 bool getInverted() const;
60 void setInverted(bool value);
61 std::bitset<Dimensions> getEvenFlags() const;
62 void setEvenFlags(const std::bitset<Dimensions>& value);
63 bool getEvenFlags(int index) const;
64 void setEvenFlags(int index, bool value);
65 void flipEvenFlags(int index);
68 int getAccessNumber(int index) const;
69 void setAccessNumber(int index, int value);
70
71#ifdef Parallel
77 [[clang::map_mpi_datatype]]
78 static MPI_Datatype getForkDatatype();
79
80 [[clang::map_mpi_datatype]]
81 static MPI_Datatype getJoinDatatype();
82
83 [[clang::map_mpi_datatype]]
84 static MPI_Datatype getBoundaryExchangeDatatype();
85
86 [[clang::map_mpi_datatype]]
87 static MPI_Datatype getMultiscaleDataExchangeDatatype();
88
89 [[clang::map_mpi_datatype]]
90 static MPI_Datatype getGlobalCommunciationDatatype();
91
92 [[clang::map_mpi_datatype]]
93 static void freeForkDatatype();
94
95 [[clang::map_mpi_datatype]]
96 static void freeJoinDatatype();
97
98 [[clang::map_mpi_datatype]]
99 static void freeBoundaryExchangeDatatype();
100
101 [[clang::map_mpi_datatype]]
103
104 [[clang::map_mpi_datatype]]
106
111 int
112 getSenderRank() const;
113
118 static void initDatatype();
119
123 static void shutdownDatatype();
124
133 static void send(const peano4::grid::AutomatonState& buffer, int destination, int tag, MPI_Comm communicator);
134 static void receive(peano4::grid::AutomatonState& buffer, int source, int tag, MPI_Comm communicator);
135
142 static void send(
143 const peano4::grid::AutomatonState& buffer,
144 int destination,
145 int tag,
146 std::function<void()> startCommunicationFunctor,
147 std::function<void()> waitFunctor,
148 MPI_Comm communicator
149 );
150 static void receive(
152 int source,
153 int tag,
154 std::function<void()> startCommunicationFunctor,
155 std::function<void()> waitFunctor,
156 MPI_Comm communicator
157 );
158#endif
159
161
164
165#ifdef Parallel
166 static void sendAndPollDanglingMessages(
167 const peano4::grid::AutomatonState& message,
168 int destination,
169 int tag,
170 MPI_Comm communicator = tarch::mpi::Rank::getInstance().getCommunicator()
171 );
174 int source,
175 int tag,
176 MPI_Comm communicator = tarch::mpi::Rank::getInstance().getCommunicator()
177 );
178#endif
179
180
181 std::string toString() const;
182
183private:
184 [[clang::pack_range(0, 63)]] int _level;
185#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
186 [[clang::truncate_mantissa(48)]] double _x[Dimensions];
187#endif
188#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
190#endif
191#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
192 [[clang::truncate_mantissa(48)]] double _h[Dimensions];
193#endif
194#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
196#endif
197 [[clang::pack]] bool _inverted;
198#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
199 [[clang::pack]] bool _evenFlags[Dimensions];
200#endif
201#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
202 std::bitset<Dimensions> _evenFlags;
203#endif
204#if defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
205 [[clang::pack_range(-TwoTimesD, TwoTimesD)]] int _accessNumber[DimensionsTimesTwo];
206#endif
207#if !defined(__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__)
209#endif
210
211#ifdef Parallel
213
214#if !defined(__MPI_ATTRIBUTES_LANGUAGE_EXTENSION__)
221 static MPI_Datatype Datatype;
222#endif
223#endif
224};
#define TwoTimesD
Definition Globals.h:30
#define DimensionsTimesTwo
Definition Globals.h:17
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:539
tarch::la::Vector< Dimensions, double > getX() const
void setAccessNumber(const tarch::la::Vector< DimensionsTimesTwo, int > &value)
std::bitset< Dimensions > getEvenFlags() const
AutomatonState(ObjectConstruction)
static MPI_Datatype getBoundaryExchangeDatatype()
std::bitset< Dimensions > _evenFlags
tarch::la::Vector< Dimensions, double > _h
AutomatonState & operator=(const AutomatonState &other)
static void send(const peano4::grid::AutomatonState &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.
tarch::la::Vector< DimensionsTimesTwo, int > _accessNumber
tarch::la::Vector< Dimensions, double > getH() const
static MPI_Datatype Datatype
Whenever we use LLVM's MPI extension (DaStGe), we rely on lazy initialisation of the datatype.
static void shutdownDatatype()
Free the underlying MPI datatype.
static MPI_Datatype getJoinDatatype()
void setH(const tarch::la::Vector< Dimensions, double > &value)
static MPI_Datatype getGlobalCommunciationDatatype()
static MPI_Datatype getForkDatatype()
Hands out MPI datatype if we work without the LLVM MPI extension.
static void freeMultiscaleDataExchangeDatatype()
static void freeGlobalCommunciationDatatype()
tarch::la::Vector< DimensionsTimesTwo, int > getAccessNumber() const
static void sendAndPollDanglingMessages(const peano4::grid::AutomatonState &message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
static void initDatatype()
Wrapper around getDatatype() to trigger lazy evaluation if we use the lazy initialisation.
void setEvenFlags(const std::bitset< Dimensions > &value)
void setX(const tarch::la::Vector< Dimensions, double > &value)
static MPI_Datatype getMultiscaleDataExchangeDatatype()
tarch::la::Vector< Dimensions, double > _x
static void receive(peano4::grid::AutomatonState &buffer, int source, int tag, MPI_Comm communicator)
static void receiveAndPollDanglingMessages(peano4::grid::AutomatonState &message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
Simple vector class.
Definition Vector.h:134