Peano
Loading...
Searching...
No Matches
FD4_patchwise_static_calls.cpph
Go to the documentation of this file.
1#include "FD4.h"
6
7
8namespace exahype2 {
9 namespace fd {
10 namespace fd4 {
11 namespace internal{
12 template <
13 typename Solver,
14 int numberOfGridCellsPerPatchPerAxis,
15 int haloSize,
16 int unknowns,
17 int auxiliaryVariables,
18 typename TempDataEnumerator
19 >
22 double KOSigma,
23 bool evaluateFlux,
24 bool evaluateDifferentialSource, //for ncp
25 bool evaluateAlgebraicSource, //real source
26 bool copyOldTimeStepAndScaleWithTimeStepSize,
30 const TempDataEnumerator& fluxEnumerator,
31 const TempDataEnumerator& differentialSourceEnumerator,
32 const TempDataEnumerator& KODissipationEnumerator,
33 double* tempFluxX,
34 double* tempFluxY,
35 double* tempFluxZ,
36 double* tempDifferentialSourceX,
37 double* tempDifferentialSourceY,
38 double* tempDifferentialSourceZ,
39 double* tempKODissipationX,
40 double* tempKODissipationY,
41 double* tempKODissipationZ
42 ) {
43 const bool evaluateKODissipation = KOSigma>0.0;
44
45 for (int patchIndex=0; patchIndex<patchData.numberOfCells; patchIndex++) {
46 const double timeStepSize = copyOldTimeStepAndScaleWithTimeStepSize ? patchData.dt[patchIndex] : 1.0;
47
48 // STEP 1: copy solution from old array to new array, or set all to zero
49 if ( Dimensions==3 and copyOldTimeStepAndScaleWithTimeStepSize ) {
50 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
51 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
52 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
53 for (int unknown=0; unknown<unknowns; unknown++) {
55 patchData.QIn[patchIndex],
56 QInEnumerator,
57 patchIndex,
58 gridCellIndex3d(x,y,z),
59 unknown,
60 patchData.QOut[patchIndex],
61 QOutEnumerator
62 );
63 }
64 }
65 else if (Dimensions==3 and not copyOldTimeStepAndScaleWithTimeStepSize){
66 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
67 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
68 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
69 {
70 for (int unknown=0; unknown<unknowns; unknown++) {
72 patchIndex,
73 gridCellIndex3d(x,y,z),
74 unknown,
75 patchData.QOut[patchIndex],
76 QOutEnumerator
77 );
78 }
79 }
80 }
81 else if (Dimensions==2 and copyOldTimeStepAndScaleWithTimeStepSize) {
82 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
83 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
84 for (int unknown=0; unknown<unknowns; unknown++) {
86 patchData.QIn[patchIndex],
87 QInEnumerator,
88 patchIndex,
89 gridCellIndex2d(x,y),
90 unknown,
91 patchData.QOut[patchIndex],
92 QOutEnumerator
93 );
94 }
95 }
96 else {
97 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
98 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++){
99 for (int unknown=0; unknown<unknowns; unknown++) {
101 patchIndex,
102 gridCellIndex2d(x,y),
103 unknown,
104 patchData.QOut[patchIndex],
105 QOutEnumerator
106 );
107 }
108 }
109 }
110
111
112 // Step 2: Add source terms
113 if (Dimensions==2 and evaluateAlgebraicSource) {
114 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
115 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
116 ::exahype2::fd::internal::addAlgebraicSourceTerm_LoopBody<Solver>(
117 patchData.QIn[patchIndex],
118 QInEnumerator,
119 patchData.cellCentre[patchIndex],
120 patchData.cellSize[patchIndex],
121 patchIndex,
122 gridCellIndex2d(x,y),
123 patchData.t[patchIndex],
124 timeStepSize,
125 patchData.QOut[patchIndex],
126 QOutEnumerator
127 );
128 }
129 }
130 else if (Dimensions==3 and evaluateAlgebraicSource) {
131 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
132 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
133 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
134 ::exahype2::fd::internal::addAlgebraicSourceTerm_LoopBody<Solver>(
135 patchData.QIn[patchIndex],
136 QInEnumerator,
137 patchData.cellCentre[patchIndex],
138 patchData.cellSize[patchIndex],
139 patchIndex,
140 gridCellIndex3d(x,y,z),
141 patchData.t[patchIndex],
142 timeStepSize,
143 patchData.QOut[patchIndex],
144 QOutEnumerator
145 );
146 }
147 }
148
149 // STEP 3: Evaluate flux and update solution accordingly
150 if (evaluateFlux and Dimensions==2) {
151 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
152 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
153 internal::computeFlux_LoopBody<Solver>(
154 patchData.QIn[patchIndex],
155 QInEnumerator,
156 patchData.cellCentre[patchIndex],
157 patchData.cellSize[patchIndex],
158 patchIndex,
159 gridCellIndex2d(x,y),
160 patchData.t[patchIndex],
161 timeStepSize,
162 0, // normal
163 tempFluxX,
164 QOutEnumerator
165 );
166 }
167 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
168 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
169 internal::computeFlux_LoopBody<Solver>(
170 patchData.QIn[patchIndex],
171 QInEnumerator,
172 patchData.cellCentre[patchIndex],
173 patchData.cellSize[patchIndex],
174 patchIndex,
175 gridCellIndex2d(x,y),
176 patchData.t[patchIndex],
177 timeStepSize,
178 1, // normal
179 tempFluxY,
180 QOutEnumerator
181 );
182 }
183 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
184 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
185 for (int unknown=0; unknown<unknowns; unknown++) {
186 // @todo 2d missing
188 tempFluxX, tempFluxY, tempFluxZ,
189 QOutEnumerator,
190 patchData.cellCentre[patchIndex],
191 patchData.cellSize[patchIndex],
192 patchIndex,
193 gridCellIndex2d(x,y),
194 unknown,
195 timeStepSize,
196 *(patchData.QOut + patchIndex),
197 QOutEnumerator
198 );
199 }
200 }
201 else if (evaluateFlux and Dimensions==3) {
202 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
203 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
204 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
205 internal::computeFlux_LoopBody<Solver>(
206 patchData.QIn[patchIndex],
207 QInEnumerator,
208 patchData.cellCentre[patchIndex],
209 patchData.cellSize[patchIndex],
210 patchIndex,
211 gridCellIndex3d(x,y,z),
212 patchData.t[patchIndex],
213 timeStepSize,
214 0, // normal
215 tempFluxX,
216 QOutEnumerator
217 );
218 }
219 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
220 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
221 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
222 internal::computeFlux_LoopBody<Solver>(
223 patchData.QIn[patchIndex],
224 QInEnumerator,
225 patchData.cellCentre[patchIndex],
226 patchData.cellSize[patchIndex],
227 patchIndex,
228 gridCellIndex3d(x,y,z),
229 patchData.t[patchIndex],
230 timeStepSize,
231 1, // normal
232 tempFluxY,
233 QOutEnumerator
234 );
235 }
236 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
237 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
238 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
239 internal::computeFlux_LoopBody<Solver>(
240 patchData.QIn[patchIndex],
241 QInEnumerator,
242 patchData.cellCentre[patchIndex],
243 patchData.cellSize[patchIndex],
244 patchIndex,
245 gridCellIndex3d(x,y,z),
246 patchData.t[patchIndex],
247 timeStepSize,
248 2, // normal
249 tempFluxZ,
250 QOutEnumerator
251 );
252 }
253
254 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
255 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
256 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
257 for (int unknown=0; unknown<unknowns; unknown++) {
259 tempFluxX, tempFluxY, tempFluxZ,
260 QOutEnumerator,
261 patchData.cellCentre[patchIndex],
262 patchData.cellSize[patchIndex],
263 patchIndex,
264 gridCellIndex3d(x,y,z),
265 unknown,
266 timeStepSize,
267 *(patchData.QOut + patchIndex),
268 QOutEnumerator
269 );
270 }
271 }
272
273 // STEP 4: Evaluate differential source and update solution accordingly
274 if (evaluateDifferentialSource and Dimensions==2) {
275 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
276 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
277 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
278 patchData.QIn[patchIndex],
279 QInEnumerator,
280 patchData.cellCentre[patchIndex],
281 patchData.cellSize[patchIndex],
282 patchIndex,
283 gridCellIndex2d(x,y),
284 patchData.t[patchIndex],
285 timeStepSize,
286 0, // normal
287 tempDifferentialSourceX,
288 QOutEnumerator,
289 variant
290 );
291 }
292 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
293 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
294 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
295 patchData.QIn[patchIndex],
296 QInEnumerator,
297 patchData.cellCentre[patchIndex],
298 patchData.cellSize[patchIndex],
299 patchIndex,
300 gridCellIndex2d(x,y),
301 patchData.t[patchIndex],
302 timeStepSize,
303 1, // normal
304 tempDifferentialSourceY,
305 QOutEnumerator,
306 variant
307 );
308 }
309 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
310 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
311 for (int unknown=0; unknown<unknowns; unknown++) {
313 tempDifferentialSourceX, tempDifferentialSourceY, tempDifferentialSourceZ,
314 QOutEnumerator,
315 patchData.cellCentre[patchIndex],
316 patchData.cellSize[patchIndex],
317 patchIndex,
318 gridCellIndex2d(x,y),
319 unknown,
320 timeStepSize,
321 *(patchData.QOut + patchIndex),
322 QOutEnumerator
323 );
324 }
325 }
326 else if (evaluateDifferentialSource and Dimensions==3) {
327 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
328 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
329 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
330 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
331 patchData.QIn[patchIndex],
332 QInEnumerator,
333 patchData.cellCentre[patchIndex],
334 patchData.cellSize[patchIndex],
335 patchIndex,
336 gridCellIndex3d(x,y,z),
337 patchData.t[patchIndex],
338 timeStepSize,
339 0, // normal
340 tempDifferentialSourceX,
341 QOutEnumerator,
342 variant
343 );
344 }
345 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
346 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
347 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
348 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
349 patchData.QIn[patchIndex],
350 QInEnumerator,
351 patchData.cellCentre[patchIndex],
352 patchData.cellSize[patchIndex],
353 patchIndex,
354 gridCellIndex3d(x,y,z),
355 patchData.t[patchIndex],
356 timeStepSize,
357 1, // normal
358 tempDifferentialSourceY,
359 QOutEnumerator,
360 variant
361 );
362 }
363 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
364 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
365 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
366 internal::computeDifferentialSourceTerm_LoopBody<Solver>(
367 patchData.QIn[patchIndex],
368 QInEnumerator,
369 patchData.cellCentre[patchIndex],
370 patchData.cellSize[patchIndex],
371 patchIndex,
372 gridCellIndex3d(x,y,z),
373 patchData.t[patchIndex],
374 timeStepSize,
375 2, // normal
376 tempDifferentialSourceZ,
377 QOutEnumerator,
378 variant
379 );
380 }
381 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
382 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
383 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
384 for (int unknown=0; unknown<unknowns; unknown++) {
386 tempDifferentialSourceX, tempDifferentialSourceY, tempDifferentialSourceZ,
387 QOutEnumerator,
388 patchData.cellCentre[patchIndex],
389 patchData.cellSize[patchIndex],
390 patchIndex,
391 gridCellIndex3d(x,y,z),
392 unknown,
393 timeStepSize,
394 *(patchData.QOut + patchIndex),
395 QOutEnumerator
396 );
397 }
398 }
399
400 // STEP 5: compute the Kreiss Oliger dissipation and add it to the solution
401 if (evaluateKODissipation and Dimensions==2) {
402 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
403 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
405 patchData.QIn[patchIndex],
406 QInEnumerator,
407 patchData.cellCentre[patchIndex],
408 patchData.cellSize[patchIndex],
409 patchIndex,
410 gridCellIndex2d(x,y),
411 patchData.t[patchIndex],
412 timeStepSize,
413 0, // normal
414 tempKODissipationX,
415 QOutEnumerator
416 );
417 }
418 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
419 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++) {
421 patchData.QIn[patchIndex],
422 QInEnumerator,
423 patchData.cellCentre[patchIndex],
424 patchData.cellSize[patchIndex],
425 patchIndex,
426 gridCellIndex2d(x,y),
427 patchData.t[patchIndex],
428 timeStepSize,
429 1, // normal
430 tempKODissipationY,
431 QOutEnumerator
432 );
433 }
434 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
435 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
436 for (int unknown=0; unknown<unknowns; unknown++) {
438 KOSigma, tempKODissipationX, tempKODissipationY, tempKODissipationZ,
439 QOutEnumerator,
440 patchData.cellCentre[patchIndex],
441 patchData.cellSize[patchIndex],
442 patchIndex,
443 gridCellIndex2d(x,y),
444 unknown,
445 timeStepSize,
446 *(patchData.QOut + patchIndex),
447 QOutEnumerator
448 );
449 }
450 }
451 else if (evaluateKODissipation and Dimensions==3) {
452 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
453 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
454 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
456 patchData.QIn[patchIndex],
457 QInEnumerator,
458 patchData.cellCentre[patchIndex],
459 patchData.cellSize[patchIndex],
460 patchIndex,
461 gridCellIndex3d(x,y,z),
462 patchData.t[patchIndex],
463 timeStepSize,
464 0, // normal
465 tempKODissipationX,
466 QOutEnumerator
467 );
468 }
469 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
470 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
471 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
473 patchData.QIn[patchIndex],
474 QInEnumerator,
475 patchData.cellCentre[patchIndex],
476 patchData.cellSize[patchIndex],
477 patchIndex,
478 gridCellIndex3d(x,y,z),
479 patchData.t[patchIndex],
480 timeStepSize,
481 1, // normal
482 tempKODissipationY,
483 QOutEnumerator
484 );
485 }
486 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
487 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
488 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++) {
490 patchData.QIn[patchIndex],
491 QInEnumerator,
492 patchData.cellCentre[patchIndex],
493 patchData.cellSize[patchIndex],
494 patchIndex,
495 gridCellIndex3d(x,y,z),
496 patchData.t[patchIndex],
497 timeStepSize,
498 2, // normal
499 tempKODissipationZ,
500 QOutEnumerator
501 );
502 }
503 for (int x = 0; x < numberOfGridCellsPerPatchPerAxis; x++)
504 for (int y = 0; y < numberOfGridCellsPerPatchPerAxis; y++)
505 for (int z = 0; z < numberOfGridCellsPerPatchPerAxis; z++)
506 for (int unknown=0; unknown<unknowns; unknown++) {
508 KOSigma, tempKODissipationX, tempKODissipationY, tempKODissipationZ,
509 QOutEnumerator,
510 patchData.cellCentre[patchIndex],
511 patchData.cellSize[patchIndex],
512 patchIndex,
513 gridCellIndex3d(x,y,z),
514 unknown,
515 timeStepSize,
516 *(patchData.QOut + patchIndex),
517 QOutEnumerator
518 );
519 }
520 }
521 }
522 }
523 }
524 }
525 }
526}
527
528
529template <
530 typename Solver,
531 int numberOfGridCellsPerPatchPerAxis,
532 int haloSize,
533 int unknowns,
534 int auxiliaryVariables,
535 typename TempDataEnumerator
536>
539 double KOSigma,
540 bool evaluateFlux,
541 bool evaluateDifferentialSource, //for ncp
542 bool evaluateAlgebraicSource, //real source
543 bool copyOldTimeStepAndScaleWithTimeStepSize,
544 DifferentialSourceTermVariant variant
545) {
546 assertionEquals(haloSize,3);
547
548 const bool evaluateKODissipation = KOSigma>0.0;
549
550 exahype2::enumerator::AoSLexicographicEnumerator QInEnumerator (1,numberOfGridCellsPerPatchPerAxis,haloSize,unknowns,auxiliaryVariables);
551 exahype2::enumerator::AoSLexicographicEnumerator QOutEnumerator(1,numberOfGridCellsPerPatchPerAxis,0, unknowns,0);
552
553 TempDataEnumerator fluxEnumerator (patchData.numberOfCells, numberOfGridCellsPerPatchPerAxis, 0, unknowns, 0);
554 TempDataEnumerator differentialSourceEnumerator(patchData.numberOfCells, numberOfGridCellsPerPatchPerAxis, 0, unknowns, 0);
555 TempDataEnumerator KODissipationEnumerator (patchData.numberOfCells, numberOfGridCellsPerPatchPerAxis, 0, unknowns, 0);
556
557 double* tempFluxX = evaluateFlux ? tarch::allocateMemory( fluxEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
558 double* tempFluxY = evaluateFlux ? tarch::allocateMemory( fluxEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
559 double* tempFluxZ = (evaluateFlux and Dimensions==3) ? tarch::allocateMemory( fluxEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
560 double* tempDifferentialSourceX = evaluateDifferentialSource ? tarch::allocateMemory( differentialSourceEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
561 double* tempDifferentialSourceY = evaluateDifferentialSource ? tarch::allocateMemory( differentialSourceEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
562 double* tempDifferentialSourceZ = (evaluateDifferentialSource and Dimensions==3) ? tarch::allocateMemory( differentialSourceEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
563 double* tempKODissipationX = evaluateKODissipation ? tarch::allocateMemory( KODissipationEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
564 double* tempKODissipationY = evaluateKODissipation ? tarch::allocateMemory( KODissipationEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
565 double* tempKODissipationZ = (evaluateKODissipation and Dimensions==3) ? tarch::allocateMemory( KODissipationEnumerator.size(),tarch::MemoryLocation::Heap ) : nullptr;
566
567 internal::timeStep_patchwise_static_calls<Solver, numberOfGridCellsPerPatchPerAxis, haloSize, unknowns, auxiliaryVariables, TempDataEnumerator>(
568 patchData,
569 KOSigma,
570 evaluateFlux,
571 evaluateDifferentialSource,
572 evaluateAlgebraicSource,
573 copyOldTimeStepAndScaleWithTimeStepSize,
574 variant,
575 QInEnumerator,
576 QOutEnumerator,
577 fluxEnumerator,
578 differentialSourceEnumerator,
579 KODissipationEnumerator,
580 tempFluxX,
581 tempFluxY,
582 tempFluxZ,
583 tempDifferentialSourceX,
584 tempDifferentialSourceY,
585 tempDifferentialSourceZ,
586 tempKODissipationX,
587 tempKODissipationY,
588 tempKODissipationZ
589 );
590
591 if (tempFluxX!=nullptr) tarch::freeMemory(tempFluxX, tarch::MemoryLocation::Heap);
592 if (tempFluxY!=nullptr) tarch::freeMemory(tempFluxY, tarch::MemoryLocation::Heap);
593 if (tempFluxZ!=nullptr) tarch::freeMemory(tempFluxZ, tarch::MemoryLocation::Heap);
594 if (tempDifferentialSourceX!=nullptr) tarch::freeMemory(tempDifferentialSourceX, tarch::MemoryLocation::Heap);
595 if (tempDifferentialSourceY!=nullptr) tarch::freeMemory(tempDifferentialSourceY, tarch::MemoryLocation::Heap);
596 if (tempDifferentialSourceZ!=nullptr) tarch::freeMemory(tempDifferentialSourceZ, tarch::MemoryLocation::Heap);
597 if (tempKODissipationX!=nullptr) tarch::freeMemory(tempKODissipationX, tarch::MemoryLocation::Heap);
598 if (tempKODissipationY!=nullptr) tarch::freeMemory(tempKODissipationY, tarch::MemoryLocation::Heap);
599 if (tempKODissipationZ!=nullptr) tarch::freeMemory(tempKODissipationZ, tarch::MemoryLocation::Heap);
600}
#define assertionEquals(lhs, rhs)
static void updateSolutionWithFlux_LoopBody(const double *__restrict__ tempFluxX, const double *__restrict__ tempFluxY, const double *__restrict__ tempFluxZ, const QOutEnumeratorType &fluxEnumerator, const tarch::la::Vector< Dimensions, double > &patchCentre, const tarch::la::Vector< Dimensions, double > &patchSize, int patchIndex, const tarch::la::Vector< Dimensions, int > &volumeIndex, int unknown, double dt, double *__restrict__ QOut, const QOutEnumeratorType &QOutEnumerator) InlineMethod
Plain update of flux in a finite differences scheme.
static void updateSolutionWithDifferentialSourceTerm_LoopBody(const double *__restrict__ QDiffSrcX, const double *__restrict__ QDiffSrcY, const double *__restrict__ QDiffSrcZ, const QOutEnumeratorType &QDiffSrcEnumerator, const tarch::la::Vector< Dimensions, double > &patchCentre, const tarch::la::Vector< Dimensions, double > &patchSize, int patchIndex, const tarch::la::Vector< Dimensions, int > &volumeIndex, int unknown, double dt, double *__restrict__ QOut, const QOutEnumeratorType &QOutEnumerator) InlineMethod
static void updateSolutionWithKODissipationTerm_LoopBody(const double KOSigma, const double *__restrict__ QKODspX, const double *__restrict__ QKODspY, const double *__restrict__ QKODspZ, const QOutEnumeratorType &QKODspEnumerator, const tarch::la::Vector< Dimensions, double > &patchCentre, const tarch::la::Vector< Dimensions, double > &patchSize, int patchIndex, const tarch::la::Vector< Dimensions, int > &volumeIndex, int unknown, double dt, double *__restrict__ QOut, const QOutEnumeratorType &QOutEnumerator) InlineMethod
static void computeKreissOligerDissipationTerm_LoopBody(const double *__restrict__ QIn, const QInEnumeratorType &QInEnumerator, 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, int normal, double *__restrict__ QKODsp, const QOutEnumeratorType &QKODspEnumerator) InlineMethod
static void timeStep_patchwise_static_calls(::exahype2::CellData< double, double > &patchData, double KOSigma, bool evaluateFlux, bool evaluateDifferentialSource, bool evaluateAlgebraicSource, bool copyOldTimeStepAndScaleWithTimeStepSize, DifferentialSourceTermVariant variant, const exahype2::enumerator::AoSLexicographicEnumerator &QInEnumerator, const exahype2::enumerator::AoSLexicographicEnumerator &QOutEnumerator, const TempDataEnumerator &fluxEnumerator, const TempDataEnumerator &differentialSourceEnumerator, const TempDataEnumerator &KODissipationEnumerator, double *tempFluxX, double *tempFluxY, double *tempFluxZ, double *tempDifferentialSourceX, double *tempDifferentialSourceY, double *tempDifferentialSourceZ, double *tempKODissipationX, double *tempKODissipationY, double *tempKODissipationZ)
static void timeStep_patchwise_heap_static_calls(::exahype2::CellData< double, double > &patchData, double KOSigma, bool evaluateFlux, bool evaluateDifferentialSource, bool evaluateAlgebraicSource, bool copyOldTimeStepAndScaleWithTimeStepSize, DifferentialSourceTermVariant variant)
static void copySolution_LoopBody(const double *__restrict__ QIn, const QInEnumeratorType &QInEnumerator, int patchIndex, const tarch::la::Vector< Dimensions, int > &volumeIndex, int unknown, double *__restrict__ QOut, const QOutEnumeratorType &QOutEnumerator) InlineMethod
static void clearSolution_LoopBody(int patchIndex, const tarch::la::Vector< Dimensions, int > &volumeIndex, int unknown, double *__restrict__ QOut, const QOutEnumeratorType &QOutEnumerator) InlineMethod
The complicated way to write =0.
For the generic kernels that I use here most of the time.
Definition CellAccess.h:13
void freeMemory(void *data, MemoryLocation location, int device=accelerator::Device::HostDevice)
Free memory.
@ Heap
Create data on the heap of the local device.
T * allocateMemory(std::size_t count, MemoryLocation location, int device=accelerator::Device::HostDevice)
Allocates memory on the specified memory location.
Definition accelerator.h:99
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
inType ** QIn
QIn may not be const, as some kernels delete it straightaway once the input data has been handled.
Definition CellData.h:82
const int numberOfCells
As we store data as SoA, we have to know how big the actual arrays are.
Definition CellData.h:99
tarch::la::Vector< Dimensions, double > * cellCentre
Definition CellData.h:83
tarch::la::Vector< Dimensions, double > * cellSize
Definition CellData.h:84