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#include "tarch/logging/Log.h"
12
13#include <array>
14#include <string>
15#include <utility>
16#include <vector>
17
28 public:
33 struct Indexing {
40 static int linearise(
41 const tarch::la::Vector<DIMENSIONS, int>& cellCentre,
42 const tarch::la::Vector<DIMENSIONS, double>& cellSize
43 );
44
57 static tarch::la::Vector<DIMENSIONS, int> getFaceIndices(
58 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
59 const tarch::la::Vector<DIMENSIONS, double>& cellSize
60 );
61
62 static int getFaceIndex(
63 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
64 const tarch::la::Vector<DIMENSIONS, double>& cellSize,
65 int axis
66 );
67 };
68
70
75
76 ~DataRepository() = default;
77
78 double* getCellQ(
79 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
80 const tarch::la::Vector<DIMENSIONS, double>& cellSize
81 );
82
84 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
85 const tarch::la::Vector<DIMENSIONS, double>& cellSize
86 );
87
88 double* getFaceQNew(int index, int depth, int axis);
89 double* getFaceQNew(
90 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
91 const tarch::la::Vector<DIMENSIONS, double>& cellSize,
92 int axis
93 );
94
95 int getFaceCardinality() const;
96 // QReconstructed is not stored explicitly anymore, as it is just used to store the patch+halo temporarily before
97 // the Riemann step but we still need its size, therefore the getter.
98 int getCellQCardinality() const;
100
101 std::size_t getMemoryUsageInBytes() const;
102
103 private:
104 using CellQ = std::array<double, celldata::FVSolverQ::Cardinality>;
105 using CellQReconstructed = std::array<double, celldata::FVSolverQReconstructed::Cardinality>;
106 using FaceQNew = std::array<double, facedata::FVSolverQNew::Cardinality>;
107
108 struct DepthLevel {
109 std::vector<CellQ> Q;
110 std::vector<CellQReconstructed> QReconstructed;
111
112 // Stores faces based on linearised order (face GridSize = 3^Depth * (3^Depth) + 1)
113 std::array<std::vector<FaceQNew>, DIMENSIONS> faces;
114 };
115
116 std::vector<DepthLevel> _depthLevels;
117
119 };
120} // namespace benchmarks::exahype2::kernelbenchmarks
const tarch::la::Vector< DIMENSIONS, double > cellSize
A singleton repository to manage and provide access to grid cell and face data.
double * getFaceQNew(int index, int depth, int axis)
DataRepository & operator=(DataRepository &&)=delete
std::array< double, facedata::FVSolverQNew::Cardinality > FaceQNew
double * getCellQReconstructed(const tarch::la::Vector< DIMENSIONS, double > &cellCentre, const tarch::la::Vector< DIMENSIONS, double > &cellSize)
DataRepository & operator=(const DataRepository &)=delete
std::array< double, celldata::FVSolverQReconstructed::Cardinality > CellQReconstructed
double * getCellQ(const tarch::la::Vector< DIMENSIONS, double > &cellCentre, const tarch::la::Vector< DIMENSIONS, double > &cellSize)
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)