Peano
Loading...
Searching...
No Matches
CellData.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 "tarch/la/Vector.h"
7#include "config.h"
9
10#include <functional>
11#include <string>
12
13namespace exahype2 {
77 template<typename inType=double, typename outType=double>
78 struct CellData {
83 inType** QIn;
86
87 double* t;
88 double* dt;
94 int* id;
95
100 const int numberOfCells;
101
107
112 const int targetDevice;
113
117 outType** QOut;
118
123
124
136 inType* QIn_,
137 const tarch::la::Vector<Dimensions,double>& cellCentre_,
139 double t_,
140 double dt_,
141 outType* QOut_,
144 );
145
147 int numberOfCells_,
150 );
151
152 CellData(const CellData<inType,outType>& copy) = delete;
153
155
156 std::string toString() const;
157
158 static int in(int index[Dimensions+2]);
159 static int out(int index[Dimensions+2]);
160 };
161
162// using CellData = CellData<double, double>;
163
186 template<typename inType=double, typename outType=double>
188 /*
189 See CellData for meaning of member variables.
190 The only change is changing QIn and QOut from 2D arrays to 1D.
191 */
192
193 inType* QIn;
196 double* t;
197 double* dt;
198 int* id;
199 const int numberOfCells;
201 const int targetDevice;
202 outType* QOut;
204
205 inType** QInHost;
206 outType** QOutHost;
208
216 const CellData<inType, outType>& cellData,
217 int inputPatchSize,
218 int outputPatchSize,
220 int currentPatchDevice = tarch::accelerator::Device::HostDevice
221 );
224
225 std::string toString() const;
226
229 };
230
231}
232
233#include "CellData.cpph"
static constexpr int HostDevice
Accelerator devices (GPUs) are enumerated starting from 0.
Definition Device.h:48
This file is part of the multigrid project within Peano 4.
Definition __init__.py:1
MemoryLocation
Definition accelerator.h:58
@ Heap
Create data on the heap of the local device.
Representation of a number of cells which contains all information that's required to process the sto...
Definition CellData.h:78
outType ** QOut
Out values.
Definition CellData.h:117
const tarch::MemoryLocation memoryLocation
We might want to allocate data on the heap or an accelerator, therefore we save the target device id.
Definition CellData.h:106
static int out(int index[Dimensions+2])
inType ** QIn
QIn may not be const, as some kernels delete it straightaway once the input data has been handled.
Definition CellData.h:83
const int numberOfCells
As we store data as SoA, we have to know how big the actual arrays are.
Definition CellData.h:100
static int in(int index[Dimensions+2])
CellData(inType *QIn_, const tarch::la::Vector< Dimensions, double > &cellCentre_, const tarch::la::Vector< Dimensions, double > &cellSize_, double t_, double dt_, outType *QOut_, tarch::MemoryLocation memoryLocation_=tarch::MemoryLocation::Heap, int targetDevice_=tarch::accelerator::Device::HostDevice)
Construct patch data object for one single cell.
std::string toString() const
CellData(const CellData< inType, outType > &copy)=delete
int * id
Id of underlying task.
Definition CellData.h:94
const int targetDevice
We might want to allocate data on an accelerator, therefore we save the target device id.
Definition CellData.h:112
CellData(int numberOfCells_, tarch::MemoryLocation memoryLocation=tarch::MemoryLocation::Heap, int targetDevice=tarch::accelerator::Device::HostDevice)
double * maxEigenvalue
Out values.
Definition CellData.h:122
tarch::la::Vector< Dimensions, double > * cellCentre
Definition CellData.h:84
tarch::la::Vector< Dimensions, double > * cellSize
Definition CellData.h:85
Cousing to CellData which administers copies on the accelerator.
Definition CellData.h:187
const tarch::MemoryLocation memoryLocation
Definition CellData.h:200
tarch::la::Vector< Dimensions, double > * cellCentre
Definition CellData.h:194
tarch::la::Vector< Dimensions, double > * cellSize
Definition CellData.h:195
CopyCellDataGPU(const CellData< inType, outType > &cellData, int inputPatchSize, int outputPatchSize, int device=tarch::accelerator::Device::HostDevice, int currentPatchDevice=tarch::accelerator::Device::HostDevice)
Construct a copy object.
std::string toString() const
Simple vector class.
Definition Vector.h:159