16 int unknownsPlusAuxiliaryVariables,
17 int numberOfGridCellsPerPatchPerAxis,
21 const double* __restrict__ srcQ,
22 double* __restrict__ destQ
24 dfore(k,numberOfGridCellsPerPatchPerAxis,normal,0) {
25 for (
int i= (isRightLayer ? haloSize : 0); i< (isRightLayer ? 2*haloSize : haloSize); i++) {
27 overlapCell(normal) = i;
29 for (
int j=0; j<unknownsPlusAuxiliaryVariables; j++) {
30 destQ[index*unknownsPlusAuxiliaryVariables+j] = srcQ[index*unknownsPlusAuxiliaryVariables+j];
40 int numberOfVolumesPerAxisInPatch
42 return h(0)/numberOfVolumesPerAxisInPatch;
48 int numberOfVolumesPerAxisInPatch
50 assertion2( numberOfVolumesPerAxisInPatch>=1, h, numberOfVolumesPerAxisInPatch );
52 return h(0)/numberOfVolumesPerAxisInPatch;
57 const double* __restrict__ Q,
60 std::string result =
"(" + std::to_string(Q[0]);
61 for (
int i=1; i<unknowns; i++) result +=
"," + std::to_string(Q[i]);
73 std::string prettyFormat(
double value,
bool isFirst ) {
74 static int previousZeroDataEntries = 0;
78 previousZeroDataEntries = 1;
83 previousZeroDataEntries = 0;
84 return std::to_string(value);
88 return "," + std::to_string(value);
92 previousZeroDataEntries = 0;
93 return "," + std::to_string(value);
96 previousZeroDataEntries += 1;
109 const double* __restrict__ Q,
111 int auxiliaryVariables,
112 int numberOfVolumesPerAxisInPatch,
116 const int PatchSize = numberOfVolumesPerAxisInPatch+2*haloSize;
118 std::ostringstream result;
120 if (prettyPrint) result << std::endl;
123 for (
int y=0; y<PatchSize; y++) {
124 for (
int x=0; x<PatchSize; x++) {
125 int index = (y*PatchSize+x) * (unknowns+auxiliaryVariables);
130 bool isDiagonal = (x<haloSize and y<haloSize)
131 or (x>=numberOfVolumesPerAxisInPatch+haloSize and y<haloSize)
132 or (x<haloSize and y>=numberOfVolumesPerAxisInPatch+haloSize)
133 or (x>=numberOfVolumesPerAxisInPatch+haloSize and y>=numberOfVolumesPerAxisInPatch+haloSize);
136 for (
int i=0; i<unknowns+auxiliaryVariables; i++) {
137 const int entry = index+i;
140 result << prettyFormat( Q[entry], i==0);
158 for (
int i=0; i<unknowns+auxiliaryVariables; i++) {
159 const int entry = index+i;
161 if (i!=0) result <<
",";
163 if (haloSize==0 or not isDiagonal)
172 if (prettyPrint) result << std::endl;
180 const double* __restrict__ Q,
182 int auxiliaryVariables,
183 int numberOfVolumesPerAxisInPatch,
191 std::ostringstream result;
197 for (
int y=0; y<numberOfVolumesPerAxisInPatch; y++) {
198 for (
int x=0; x<2*haloSize; x++) {
199 int index = (y*numberOfVolumesPerAxisInPatch+x) * (unknowns+auxiliaryVariables);
201 for (
int i=0; i<unknowns+auxiliaryVariables; i++) {
202 const int entry = index+i;
203 result << prettyFormat( Q[entry],i==0 );
213 for (
int y=0; y<2*haloSize; y++) {
214 for (
int x=0; x<numberOfVolumesPerAxisInPatch; x++) {
215 int index = (y*numberOfVolumesPerAxisInPatch+x) * (unknowns+auxiliaryVariables);
217 for (
int i=0; i<unknowns+auxiliaryVariables; i++) {
218 const int entry = index+i;
219 result << prettyFormat( Q[entry],i==0 );
226 for (
int x=0; x<numberOfVolumesPerAxisInPatch; x++) {
233 result <<
"<not implemented yet>";
239 for (
int overlap=0; overlap<2*haloSize; overlap++)
241 for (
int i=0; i<numberOfVolumesPerAxisInPatch; i++)
243 for (
int ii=0; ii<numberOfVolumesPerAxisInPatch; ii++)
251 for (
int iii=0; iii<unknowns+auxiliaryVariables; iii++) {
252 result << prettyFormat( Q[entry],iii==0 );
264 const double *__restrict__ Q,
int unknowns,
265 int auxiliaryVariables,
266 int numberOfVolumesPerAxisInPatch,
int haloSize,
267 const std::string &location,
268 bool triggerNonCriticalAssertion,
272 #if PeanoDebug>1 && !defined(GPUOffloadingOMP)
274 logTraceInWith5Arguments(
"validatePatch(...)", unknowns, auxiliaryVariables, numberOfVolumesPerAxisInPatch, haloSize, location );
275 const int PatchSize = numberOfVolumesPerAxisInPatch+2*haloSize;
279 int outsidePatchAlongCoordinateAxis = 0;
280 for (
int d=0; d<Dimensions; d++) {
281 if (k(d)<haloSize) outsidePatchAlongCoordinateAxis++;
282 if (k(d)>=haloSize+numberOfVolumesPerAxisInPatch) outsidePatchAlongCoordinateAxis++;
284 bool isDiagonal = outsidePatchAlongCoordinateAxis>1;
286 if (haloSize==0 or not isDiagonal) {
287 for (
int i=0; i<unknowns+auxiliaryVariables; i++) {
288 const int entry = index+i;
289 bool dataValid =
true;
290 if (minValues!=
nullptr and minValues[i]>Q[entry]) {
293 if (maxValues!=
nullptr and maxValues[i]<Q[entry]) {
296 if (triggerNonCriticalAssertion) {
298 Q[entry]==Q[entry] and std::isfinite(Q[entry]) and dataValid,
301 isDiagonal, haloSize, entry,
302 numberOfVolumesPerAxisInPatch, haloSize, k, i, location );
303 assertion( Q[entry]==Q[entry] and std::isfinite(Q[entry]) and dataValid );
307 Q[entry]==Q[entry] and std::isfinite(Q[entry]) and dataValid,
310 isDiagonal, haloSize, i,
311 numberOfVolumesPerAxisInPatch, haloSize, k, i, location,
312 plotPatch(Q,unknowns,auxiliaryVariables,numberOfVolumesPerAxisInPatch,haloSize)
#define assertion2(expr, param0, param1)
#define assertion12(expr, param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11)
#define logTraceOut(methodName)
#define logTraceInWith5Arguments(methodName, argument0, argument1, argument2, argument3, argument4)
#define dfore(counter, max, dim, value)
This is an exclusive d-dimensional for loop.
#define dfor(counter, max)
d-dimensional Loop
tarch::logging::Log _log("::")
#define nonCriticalAssertion11(expr, param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10)
void validatePatch(const double *__restrict__ Q, int unknowns, int auxiliaryVariables, int numberOfVolumesPerAxisInPatch, int haloSize, const std::string &location="", bool triggerNonCriticalAssertion=true, double *minValues=nullptr, double *maxValues=nullptr)
Just runs over the patch and ensures that no entry is non or infinite.
std::string plotPatch(const double *__restrict__ Q, int unknowns, int auxiliaryVariables, int numberOfVolumesPerAxisInPatch, int haloSize, bool prettyPrint=false)
Plot patch.
double getVolumeLength(const tarch::la::Vector< 2, double > &h, int numberOfVolumesPerAxisInPatch)
With GCC 10, it was impossible to return/copy the vector class.
void copyHalfOfHalo(int unknownsPlusAuxiliaryVariables, int numberOfGridCellsPerPatchPerAxis, int haloSize, int normal, bool isRightLayer, const double *__restrict__ srcQ, double *__restrict__ destQ)
A face always holds a left and a right overlap.
std::string plotPatchOverlap(const double *__restrict__ Q, int unknowns, int auxiliaryVariables, int numberOfGridCellsPerPatchPerAxis, int haloSize, int normal, bool prettyPrint=false)
std::string plotVolume(const double *__restrict__ Q, int unknowns)
Helper routine that I need in the log statements.
CPUGPUMethod int dLinearised(const tarch::la::Vector< Dimensions, int > &counter, int max)
Map d-dimensional vector onto integer index.
int count(const Vector< Size, Scalar > &vector, const Scalar &value)
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.