Peano
Loading...
Searching...
No Matches
EnclaveTaskingAbstract.template.h
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
6#include "exahype2/Solver.h"
7#include "tarch/la/Vector.h"
11
13
14#include "Constants.h"
15
16{% if USE_VARIABLE_SHORTCUT is sameas True %}
17#include "VariableShortcuts.h"
18{% endif %}
19
20{{SOLVER_INCLUDES}}
21
22{% for item in NAMESPACE -%}
23 namespace {{ item }} {
24
25{%- endfor %}
26 class {{CLASSNAME}};
27
28{% for item in NAMESPACE -%}
29 }
30{%- endfor %}
31
32class {{NAMESPACE | join("::")}}::{{CLASSNAME}}: public ::exahype2::Solver {
33 public:
34 enum class SolverState {
35 GridConstruction,
36 GridInitialisation,
37 Primary,
38 Secondary,
39 PlottingInitialCondition,
40 PrimaryAfterGridInitialisation,
41 Plotting,
42 Suspended
43 };
44
45 static std::string toString(SolverState);
46
47 static constexpr int NumberOfFiniteVolumesPerAxisPerPatch = {{NUMBER_OF_VOLUMES_PER_AXIS}};
48
54 static constexpr double MaxAdmissiblePatchH = {{MAX_VOLUME_H}} * NumberOfFiniteVolumesPerAxisPerPatch;
55 static constexpr double MaxAdmissibleVolumeH = {{MAX_VOLUME_H}};
56 static constexpr double MaxAdmissibleCellH = MaxAdmissiblePatchH;
57
66 static constexpr double MinAdmissiblePatchH = {{MIN_VOLUME_H}} * NumberOfFiniteVolumesPerAxisPerPatch;
67 static constexpr double MinAdmissibleVolumeH = {{MIN_VOLUME_H}};
68 static constexpr double MinAdmissibleCellH = MinAdmissiblePatchH;
69
70 {{CLASSNAME}}();
71
75 static std::bitset<Dimensions> PeriodicBC;
76
77 double getMinTimeStamp() const final;
78 double getMaxTimeStamp() const final;
79 double getMinTimeStepSize() const final;
80 double getMaxTimeStepSize() const final;
81
88 virtual ::exahype2::RefinementCommand refinementCriterion(
89 [[maybe_unused]] const double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
90 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeCentre,
91 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeH,
92 [[maybe_unused]] double t
93 ) {% if REFINEMENT_CRITERION_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
94
95 virtual void initialCondition(
96 [[maybe_unused]] double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
97 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeCentre,
98 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeH,
99 [[maybe_unused]] bool gridIsConstructed
100 ) {% if INITIAL_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
101
102 {% if BOUNDARY_CONDITIONS_IMPLEMENTATION!="<none>" %}
103
110 virtual void boundaryConditions(
111 [[maybe_unused]] const double* __restrict__ Qinside, // Qinside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
112 [[maybe_unused]] double* __restrict__ Qoutside, // Qoutside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
113 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& faceCentre,
114 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeH,
115 [[maybe_unused]] double t,
116 [[maybe_unused]] int normal
117 ) {% if BOUNDARY_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final{% endif %};
118 {% endif %}
119
124 virtual void startGridConstructionStep() override;
125
130 virtual void finishGridConstructionStep() override;
131
136 virtual void startGridInitialisationStep() override;
137
142 virtual void finishGridInitialisationStep() override;
143
148 virtual void startTimeStep(
149 double globalMinTimeStamp,
150 double globalMaxTimeStamp,
151 double globalMinTimeStepSize,
152 double globalMaxTimeStepSize
153 ) override;
154
159 virtual void finishTimeStep() override;
160
165 virtual void startPlottingStep(
166 double globalMinTimeStamp,
167 double globalMaxTimeStamp,
168 double globalMinTimeStepSize,
169 double globalMaxTimeStepSize
170 ) override;
171
176 virtual void finishPlottingStep() override;
177
178 virtual void suspendSolversForOneGridSweep() override;
179
189 double getMaxPatchSize() const;
190 double getMinPatchSize() const;
191 double getMaxVolumeSize() const;
192 double getMinVolumeSize() const;
193
197 virtual double getMaxMeshSize() const override final;
198 virtual double getMinMeshSize() const override final;
199
206 void update(double timeStepSize, double timeStamp, double patchSize);
207
208 SolverState getSolverState() const;
209
210 //#if defined(GPUOffloadingOMP) // HS: note there is a compiler bug in llvm until that is resolved
211 //#pragma omp declare target // we need to keep these declarations outside the declare target construct and instead
212 //#endif // map them explicitly in Rusanov.h
213 static constexpr int NumberOfUnknowns = {{NUMBER_OF_UNKNOWNS}};
214 static constexpr int NumberOfAuxiliaryVariables = {{NUMBER_OF_AUXILIARY_VARIABLES}};
215 {{SOLVER_CONSTANTS}}
216 //#if defined(GPUOffloadingOMP)
217 //#pragma omp end declare target
218 //#endif
219
227 virtual bool mayPlot() const override;
228
240 bool isFirstGridSweepOfTimeStep() const;
241 bool isLastGridSweepOfTimeStep() const;
242
243 {% if STATELESS_PDE_TERMS %}
250 {% else %}
257 {% endif %}
258 virtual bool patchCanUseStatelessPDETerms(
259 const tarch::la::Vector<Dimensions, double>& patchCentre,
261 double t,
262 double dt
263 ) const;
264
269 virtual void startSimulation() override;
270
275 virtual void finishSimulation() override;
276
277 protected:
279
280 SolverState _solverState;
281
282 double _minTimeStamp;
283 double _maxTimeStamp;
284
285 double _minTimeStampThisTimeStep;
286 double _maxTimeStampThisTimeStep;
287
288 double _localMinTimeStampThisTimeStep;
289 double _localMaxTimeStampThisTimeStep;
290
291 double _minVolumeH;
292 double _maxVolumeH;
293
294 double _minVolumeHThisTimeStep;
295 double _maxVolumeHThisTimeStep;
296
297 double _minTimeStepSize;
298 double _maxTimeStepSize;
299
300 double _minTimeStepSizeThisTimeStep;
301 double _maxTimeStepSizeThisTimeStep;
302
303 int _patchUpdates;
304
306
307 {{ABSTRACT_SOLVER_USER_DECLARATIONS}}
308};
309
310{# Empty line here #}
std::string toString(exahype2::RefinementCommand value)
Log Device.
Definition Log.h:517
This file is part of the ExaHyPE 2 project within Peano 4.
Definition __init__.py:1
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
Simple vector class.
Definition Vector.h:159