Peano
Loading...
Searching...
No Matches
LoopBody.cpp
Go to the documentation of this file.
1#include "LoopBody.h"
3#include "peano4/utils/Loop.h"
4
7 int numberOfGridCellsPerPatchPerAxis,
8 int overlap,
9 int unknowns,
10 int auxiliaryVariables,
11 MaxEigenvalue maxEigenvalue
12) {
13 exahype2::enumerator::AoSLexicographicEnumerator QOutEnumerator(1, numberOfGridCellsPerPatchPerAxis, overlap, unknowns, auxiliaryVariables);
14
15 for (int patchIndex=0; patchIndex<patchData.numberOfCells; patchIndex++) {
16 double newMaxEigenvalue = 0.0;
17 dfor(cell,numberOfGridCellsPerPatchPerAxis) {
18 newMaxEigenvalue = std::max(
19 newMaxEigenvalue,
21 *(patchData.QOut + patchIndex),
22 QOutEnumerator,
23 maxEigenvalue,
24 patchData.cellCentre[patchIndex],
25 patchData.cellSize[patchIndex],
26 patchIndex,
27 cell,
28 patchData.t[patchIndex],
29 patchData.dt[patchIndex]
30 )
31 );
32 }
33 patchData.maxEigenvalue[patchIndex] = newMaxEigenvalue;
34 }
35}
36
37template <>
39 const double* __restrict__ QOut,
41 exahype2::fd::MaxEigenvalue maxEigenvalue,
42 const tarch::la::Vector<Dimensions,double>& patchCentre,
44 int patchIndex,
45 const tarch::la::Vector<Dimensions,int>& volumeIndex,
46 double t,
47 double dt
48) {
49 double result = 0.0;
50 for (int normal=0; normal<Dimensions; normal++) {
51 result = std::max(
52 result,
53 maxEigenvalue(
54 & (QOut[ QOutEnumerator(patchIndex,volumeIndex,0) ]),
55 ::exahype2::fd::getGridCellCentre( patchCentre, patchSize, QOutEnumerator._numberOfDoFsPerAxisInCell, volumeIndex ),
57 t,
58 dt,
59 normal
60 )
61 );
62 }
63
64 return result;
65}
#define dfor(counter, max)
d-dimensional Loop
Definition Loop.h:313
static double reduceMaxEigenvalue_LoopBody(const double *__restrict__ QOut, const QOutEnumeratorType &QOutEnumerator, exahype2::fd::MaxEigenvalue maxEigenvalue, const tarch::la::Vector< Dimensions, double > &patchCentre, const tarch::la::Vector< Dimensions, double > &patchSize, int patchIndex, const tarch::la::Vector< Dimensions, int > &volumeIndex, double t, double dt) InlineMethod
static tarch::la::Vector< 2, double > getGridCellCentre(const tarch::la::Vector< 2, double > &x, const tarch::la::Vector< 2, double > &h, int numberOfGridCellsPerPatchPerAxis, const tarch::la::Vector< 2, int > &index)
In ExaHyPE's Finite Volume setup, a cell hosts a patch of Finite Volumes.
Definition PatchUtils.h:77
void reduceMaxEigenvalue_patchwise_functors(::exahype2::CellData< double, double > &patchData, int numberOfGridCellsPerPatchPerAxis, int overlap, int unknowns, int auxiliaryVariables, MaxEigenvalue maxEigenvalue)
Definition LoopBody.cpp:5
static tarch::la::Vector< 2, double > getGridCellSize(const tarch::la::Vector< 2, double > &h, int numberOfGridCellsPerPatchPerAxis)
Definition PatchUtils.h:22
std::function< double(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &gridCellX, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal) MaxEigenvalue)
The max eigenvalue is used if and only if you have adaptive time stepping.
Definition Functors.h:53
auto volumeIndex(Args... args)
Definition VolumeIndex.h:54
Representation of a number of cells which contains all information that's required to process the sto...
Definition CellData.h:77
outType ** QOut
Out values.
Definition CellData.h:116
const int numberOfCells
As we store data as SoA, we have to know how big the actual arrays are.
Definition CellData.h:99
double * maxEigenvalue
Out values.
Definition CellData.h:121
tarch::la::Vector< Dimensions, double > * cellCentre
Definition CellData.h:83
tarch::la::Vector< Dimensions, double > * cellSize
Definition CellData.h:84
Simple vector class.
Definition Vector.h:134