Peano 4
Loading...
Searching...
No Matches
AbstractLOH1OnGPU.cpp
Go to the documentation of this file.
1#include "AbstractLOH1OnGPU.h"
2#include "Constants.h"
3
4tarch::logging::Log examples::exahype2::loh1::AbstractLOH1OnGPU::AbstractLOH1OnGPU::_log( "examples::exahype2::loh1::AbstractLOH1OnGPU::AbstractLOH1OnGPU" );
5
6std::bitset<Dimensions> examples::exahype2::loh1::AbstractLOH1OnGPU::AbstractLOH1OnGPU::PeriodicBC = examples::exahype2::loh1::PeriodicBC;
7
8
12
13
17
18
22
23
27
28
32
33
37
38
42
43
44
45
47 const double * __restrict__ Q, // Q[9+4],
48 const tarch::la::Vector<Dimensions,double>& volumeCentre,
50 double t
51) {
52
54
55 if ( tarch::la::smallerEquals(_maxH,_NumberOfFiniteVolumesPerAxisPerPatch*tarch::la::max(volumeH)) ) {
57 }
58
59 return result;
60
61}
62
63
64
65
66
67
68
69
70#include <algorithm>
71
72
74 _NumberOfFiniteVolumesPerAxisPerPatch( 8 ),
75 _timeStamp(0.0),
76 _solverState(SolverState::GridConstruction),
77 _maxH(10.0),
78 _minH(10.0)
79 {
80}
81
82
86
87
90
91
93 assertion( _solverState == SolverState::GridConstruction );
94 _solverState = SolverState::GridInitialisation;
95 logDebug( "startGridInitialisationStep(...)", "new state is " << toString(_solverState) );
96}
97
98
101
102
104 double globalMinTimeStamp,
105 double globalMaxTimeStamp,
106 double globalMinTimeStepSize,
107 double globalMaxTimeStepSize
108) {
109 if (
110 _solverState == SolverState::GridInitialisation
111 ) {
112 _solverState = SolverState::PrimaryAfterGridInitialisation;
113 }
114 else if (
115 _solverState == SolverState::Primary
116 or
117 _solverState == SolverState::PrimaryAfterGridInitialisation
118 ) {
119 _solverState = SolverState::Secondary;
120 }
121 else {
122 _solverState = SolverState::Primary;
123 }
124
125 logDebug( "startTimeStep(...)", "new state is " << toString(_solverState) );
126}
127
128
130 if ( _solverState == SolverState::Secondary ) {
131 _timeStamp += 0.04;
132 }
133}
134
135
137 double globalMinTimeStamp,
138 double globalMaxTimeStamp,
139 double globalMinTimeStepSize,
140 double globalMaxTimeStepSize
141) {
142 if ( _solverState == SolverState::GridInitialisation ) {
143 _solverState = SolverState::PlottingInitialCondition;
144 }
145 else {
146 _solverState = SolverState::Plotting;
147 }
148}
149
150
153
154
156 switch (state) {
157 case SolverState::GridConstruction:
158 return "grid-construction";
159 case SolverState::GridInitialisation:
160 return "grid-initialisation";
161 case SolverState::Primary:
162 return "primary";
163 case SolverState::Secondary:
164 return "secondary";
165 case SolverState::PlottingInitialCondition:
166 return "plotting-initial-condition";
167 case SolverState::PrimaryAfterGridInitialisation:
168 return "primary-after-grid-initialisation";
169 case SolverState::Plotting:
170 return "plotting";
171 }
172 return "<undef>";
173}
174
175
176
178 const double * __restrict__ Q, // Q[9+4]
181 double t,
182 double dt,
183 double * __restrict__ S // S[9]
184) {
185
186 std::fill_n(S,9,0.0);
187
188}
189
190
191
192
193
194
195
196
197
#define assertion(expr)
AutomatonState state
#define logDebug(methodName, logMacroMessageStream)
Definition Log.h:50
_solverState(SolverState::GridConstruction)
_maxH({{MAX_H}})
_timeStamp(0.0)
void startPlottingStep(double globalMinTimeStamp, double globalMaxTimeStamp, double globalMinTimeStepSize, double globalMaxTimeStepSize) override
If you hook into this routine, ensure the abstract base class operation is still invoked.
void startGridConstructionStep() override
If you hook into this routine, ensure the abstract base class operation is still invoked.
void startTimeStep(double globalMinTimeStamp, double globalMaxTimeStamp, double globalMinTimeStepSize, double globalMaxTimeStepSize) override
If you hook into this routine, ensure the abstract base class operation is still invoked.
void finishGridInitialisationStep() override
If you hook into this routine, ensure the abstract base class operation is still invoked.
void startGridInitialisationStep() override
If you hook into this routine, ensure the abstract base class operation is still invoked.
void finishGridConstructionStep() override
If you hook into this routine, ensure the abstract base class operation is still invoked.
void finishTimeStep() override
If you hook into this routine, ensure the abstract base class operation is still invoked.
void finishPlottingStep() override
If you hook into this routine, ensure the abstract base class operation is still invoked.
virtual::exahype2::RefinementCommand refinementCriterion(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &volumeCentre, const tarch::la::Vector< Dimensions, double > &volumeH, double t) final
static void sourceTerm(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &volumeCentre, const tarch::la::Vector< Dimensions, double > &volumeH, double t, double dt, double *__restrict__ S)
Log Device.
Definition Log.h:516
std::string toString(Filter filter)
Definition convert.cpp:170
double max(double a, double b, double c)
I need the maximum of three values all the time, to I decided to write a function for this.
Definition Scalar.cpp:8
bool smallerEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Simple vector class.
Definition Vector.h:134