Peano
Loading...
Searching...
No Matches
DataRepository.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
5#include "Constants.h"
6#include "celldata/FVSolverQ.h"
7#include "celldata/FVSolverQReconstructed.h"
8#include "facedata/FVSolverQNew.h"
9#include "peano4/datamanagement/CellMarker.h"
10#include "tarch/la/Vector.h"
11
12#include <array>
13#include <string>
14#include <utility>
15#include <vector>
16
27 public:
32 struct Indexing {
39 static int linearise(
40 const tarch::la::Vector<DIMENSIONS, int>& cellCentre,
41 const tarch::la::Vector<DIMENSIONS, double>& cellSize
42 );
43
56 static tarch::la::Vector<DIMENSIONS, int> getFaceIndices(
57 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
58 const tarch::la::Vector<DIMENSIONS, double>& cellSize
59 );
60
61 static int getFaceIndex(
62 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
63 const tarch::la::Vector<DIMENSIONS, double>& cellSize,
64 int axis
65 );
66 };
67
69
74
76
77 double* getCellQ(int index);
78 double* getCellQ(
79 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
80 const tarch::la::Vector<DIMENSIONS, double>& cellSize
81 );
82
83 double* getFaceQNew(int index, int axis);
84 double* getFaceQNew(
85 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
86 const tarch::la::Vector<DIMENSIONS, double>& cellSize,
87 int axis
88 );
89 double* getFaceQNewDevice(
90 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
91 const tarch::la::Vector<DIMENSIONS, double>& cellSize,
92 int axis
93 );
94
95 void copyFacesToDevice();
97
99 // QReconstructed is not stored explicitly anymore, as it is just used to store the patch+halo temporarily before
100 // the Riemann step but we still need its size, therefore the getter.
103
104 private:
105 friend struct celldata::FVSolverQ;
107
108 using CellQ = std::array<double, celldata::FVSolverQ::Cardinality>;
109 using FaceQNew = std::array<double, facedata::FVSolverQNew::Cardinality>;
110
111 struct DepthLevel {
112 // cellData
113 std::vector<CellQ> Q;
114 // Other cellData would go here also as a std::vector<CellQ...>
115
116 // Stores faces based on linearised order (face GridSize = 3^Depth * (3^Depth)+1) (not based on cellKeys)
117 std::array<std::vector<FaceQNew>, DIMENSIONS> faces;
118 std::array<double*, DIMENSIONS> facesDevice;
119 };
120
122
124 };
125} // namespace benchmarks::exahype2::kernelbenchmarks
const tarch::la::Vector< DIMENSIONS, double > cellSize
DataRepository & operator=(DataRepository &&)=delete
std::array< double, facedata::FVSolverQNew::Cardinality > FaceQNew
double * getFaceQNewDevice(const tarch::la::Vector< DIMENSIONS, double > &cellCentre, const tarch::la::Vector< DIMENSIONS, double > &cellSize, int axis)
DataRepository & operator=(const DataRepository &)=delete
std::array< double, celldata::FVSolverQ::Cardinality > CellQ
std::array< std::vector< FaceQNew >, DIMENSIONS > faces
Provides helper functions for calculating linearized array indices from geometric cell positions.
static tarch::la::Vector< DIMENSIONS, int > getFaceIndices(const tarch::la::Vector< DIMENSIONS, double > &cellCentre, const tarch::la::Vector< DIMENSIONS, double > &cellSize)
Calculates the indices of the lower faces of a cell along along all axis for x axis: x_1 + x_2 * (3^D...
static int linearise(const tarch::la::Vector< DIMENSIONS, int > &cellCentre, const tarch::la::Vector< DIMENSIONS, double > &cellSize)
Calculates the linearised index of the lower face of a cell along one axis (along one axis means the ...
static int getFaceIndex(const tarch::la::Vector< DIMENSIONS, double > &cellCentre, const tarch::la::Vector< DIMENSIONS, double > &cellSize, int axis)