40 template_parameters = [DSL.SyntaxTree.Argument(
"DGOrder", DSL.SyntaxTree.TInteger()),
41 DSL.SyntaxTree.Argument(
"NumberOfUnknowns", DSL.SyntaxTree.TInteger()),
42 DSL.SyntaxTree.Argument(
"NumberOfAuxiliaryVariables", DSL.SyntaxTree.TInteger()),
43 DSL.SyntaxTree.Argument(
"EvaluateFlux", DSL.SyntaxTree.TBoolean()),
44 DSL.SyntaxTree.Argument(
"EvaluateNonconservativeProduct", DSL.SyntaxTree.TBoolean()),
45 DSL.SyntaxTree.Argument(
"EvaluateSource", DSL.SyntaxTree.TBoolean()),
46 DSL.SyntaxTree.Argument(
"EvaluatePointSources", DSL.SyntaxTree.TBoolean())]
48 functor_arguments = [DSL.SyntaxTree.Argument(
"flux", DSL.SyntaxTree.TCustom(
"const Flux&")),
49 DSL.SyntaxTree.Argument(
"nonconservativeProduct", DSL.SyntaxTree.TCustom(
"const NonConservativeProduct&")),
50 DSL.SyntaxTree.Argument(
"sourceTerm", DSL.SyntaxTree.TCustom(
"const Source&")),
51 DSL.SyntaxTree.Argument(
"pointSource", DSL.SyntaxTree.TCustom(
"const PointSources&")),
52 DSL.SyntaxTree.Argument(
"getQuadraturePoint", DSL.SyntaxTree.TCustom(
"const QuadraturePoint&")),
53 DSL.SyntaxTree.Argument(
"QuadraturePoints1d", DSL.SyntaxTree.TCustom(
"const double*")),
54 DSL.SyntaxTree.Argument(
"MassMatrixDiagonal1d", DSL.SyntaxTree.TCustom(
"const double*")),
55 DSL.SyntaxTree.Argument(
"StiffnessOperator1d", DSL.SyntaxTree.TCustom(
"const double*")),
56 DSL.SyntaxTree.Argument(
"DerivativeOperator1d", DSL.SyntaxTree.TCustom(
"const double*"))]
58 dg_stateless_tree = DSL.Parser().parse(exahype2.solvers.rkdg.cellIntegral2d, template_parameters, functor_arguments, [
"exahype2",
"dg", namespace], stateless=
True)
59 dg_stateless_kernel = dg_stateless_tree.print_cpp()
60 dg_stateless_call_with_measurement = dg_stateless_tree.print_definition_with_timer()
61 dg_stateless_kernel_declaration = dg_stateless_tree.print_declaration()
62 dg_stateless_call_with_measurement_declaration = dg_stateless_tree.print_declaration_with_timer()
64 dg_stateless_omp_accelerator_tree = DSL.Parser().parse(exahype2.solvers.rkdg.cellIntegral2d, template_parameters, functor_arguments, [
"exahype2",
"dg",
"omp", namespace], stateless=
True, use_accelerator=
True)
65 dg_stateless_omp_accelerator_kernel = dg_stateless_omp_accelerator_tree.print_omp()
66 dg_stateless_omp_accelerator_call_with_measurement = dg_stateless_omp_accelerator_tree.print_definition_with_timer()
67 dg_stateless_omp_accelerator_kernel_declaration = dg_stateless_omp_accelerator_tree.print_declaration()
68 dg_stateless_omp_accelerator_call_with_measurement_declaration = dg_stateless_omp_accelerator_tree.print_declaration_with_timer()
70 dg_tree = DSL.Parser().parse(exahype2.solvers.rkdg.cellIntegral2d, template_parameters, functor_arguments, [
"exahype2",
"dg", namespace], stateless=
False)
71 dg_kernel = dg_tree.print_cpp()
72 dg_call_with_measurement = dg_tree.print_definition_with_timer()
73 dg_kernel_declaration = dg_tree.print_declaration()
74 dg_call_with_measurement_declaration = dg_tree.print_declaration_with_timer()
76 if not os.path.exists(
"kernels"):
77 os.makedirs(
"kernels")
79 file = open(
"kernels/dg_cellIntegral2d.h",
"w")
80 file.write(f
"""#pragma once
81#include "exahype2/CellData.h"
82#include "exahype2/VolumeIndex.h"
83#include "exahype2/dg/DGUtils.h"
84#include "exahype2/dg/Functors.h"
85#include "peano4/utils/Loop.h"
86#include "tarch/timing/Measurement.h"
87#include "tarch/timing/Watch.h"
90{dg_stateless_kernel_declaration}
91{dg_stateless_call_with_measurement_declaration}
93{dg_stateless_omp_accelerator_kernel_declaration}
94{dg_stateless_omp_accelerator_call_with_measurement_declaration}
96{dg_kernel_declaration}
97{dg_call_with_measurement_declaration}
99#include "dg_cellIntegral2d.cpph"
103 file = open(
"kernels/dg_cellIntegral2d.cpph",
"w")
104 file.write(
"#include \"exahype2/dg/DGUtils.h\"\n")
105 file.write(dg_stateless_kernel)
106 file.write(dg_stateless_call_with_measurement)
107 file.write(dg_stateless_omp_accelerator_kernel)
108 file.write(dg_stateless_omp_accelerator_call_with_measurement)
109 file.write(dg_kernel)
110 file.write(dg_call_with_measurement)
114 template_parameters = [DSL.SyntaxTree.Argument(
"DGOrder", DSL.SyntaxTree.TInteger()),
115 DSL.SyntaxTree.Argument(
"NumberOfUnknowns", DSL.SyntaxTree.TInteger()),
116 DSL.SyntaxTree.Argument(
"NumberOfAuxiliaryVariables", DSL.SyntaxTree.TInteger()),
117 DSL.SyntaxTree.Argument(
"EvaluateFlux", DSL.SyntaxTree.TBoolean()),
118 DSL.SyntaxTree.Argument(
"EvaluateNonconservativeProduct", DSL.SyntaxTree.TBoolean()),
119 DSL.SyntaxTree.Argument(
"EvaluateSource", DSL.SyntaxTree.TBoolean()),
120 DSL.SyntaxTree.Argument(
"EvaluatePointSources", DSL.SyntaxTree.TBoolean())]
122 functor_arguments = [DSL.SyntaxTree.Argument(
"flux", DSL.SyntaxTree.TCustom(
"const Flux&")),
123 DSL.SyntaxTree.Argument(
"nonconservativeProduct", DSL.SyntaxTree.TCustom(
"const NonConservativeProduct&")),
124 DSL.SyntaxTree.Argument(
"sourceTerm", DSL.SyntaxTree.TCustom(
"const Source&")),
125 DSL.SyntaxTree.Argument(
"pointSource", DSL.SyntaxTree.TCustom(
"const PointSources&")),
126 DSL.SyntaxTree.Argument(
"getQuadraturePoint", DSL.SyntaxTree.TCustom(
"const QuadraturePoint&")),
127 DSL.SyntaxTree.Argument(
"QuadraturePoints1d", DSL.SyntaxTree.TCustom(
"const double*")),
128 DSL.SyntaxTree.Argument(
"MassMatrixDiagonal1d", DSL.SyntaxTree.TCustom(
"const double*")),
129 DSL.SyntaxTree.Argument(
"StiffnessOperator1d", DSL.SyntaxTree.TCustom(
"const double*")),
130 DSL.SyntaxTree.Argument(
"DerivativeOperator1d", DSL.SyntaxTree.TCustom(
"const double*"))]
132 dg_stateless_tree = DSL.Parser().parse(exahype2.solvers.rkdg.cellIntegral3d, template_parameters, functor_arguments, [
"exahype2",
"dg", namespace], stateless=
True)
133 dg_stateless_kernel = dg_stateless_tree.print_cpp()
134 dg_stateless_call_with_measurement = dg_stateless_tree.print_definition_with_timer()
135 dg_stateless_kernel_declaration = dg_stateless_tree.print_declaration()
136 dg_stateless_call_with_measurement_declaration = dg_stateless_tree.print_declaration_with_timer()
138 dg_stateless_omp_accelerator_tree = DSL.Parser().parse(exahype2.solvers.rkdg.cellIntegral3d, template_parameters, functor_arguments, [
"exahype2",
"dg",
"omp", namespace], stateless=
True, use_accelerator=
True)
139 dg_stateless_omp_accelerator_kernel = dg_stateless_omp_accelerator_tree.print_cpp()
140 dg_stateless_omp_accelerator_call_with_measurement = dg_stateless_omp_accelerator_tree.print_definition_with_timer()
141 dg_stateless_omp_accelerator_kernel_declaration = dg_stateless_omp_accelerator_tree.print_declaration()
142 dg_stateless_omp_accelerator_call_with_measurement_declaration = dg_stateless_omp_accelerator_tree.print_declaration_with_timer()
144 dg_tree = DSL.Parser().parse(exahype2.solvers.rkdg.cellIntegral3d, template_parameters, functor_arguments, [
"exahype2",
"dg", namespace], stateless=
False)
145 dg_kernel = dg_tree.print_cpp()
146 dg_call_with_measurement = dg_tree.print_definition_with_timer()
147 dg_kernel_declaration = dg_tree.print_declaration()
148 dg_call_with_measurement_declaration = dg_tree.print_declaration_with_timer()
150 if not os.path.exists(
"kernels"):
151 os.makedirs(
"kernels")
153 file = open(
"kernels/dg_cellIntegral3d.h",
"w")
154 file.write(f
"""#pragma once
155#include "exahype2/CellData.h"
156#include "exahype2/VolumeIndex.h"
157#include "exahype2/dg/DGUtils.h"
158#include "exahype2/dg/Functors.h"
159#include "peano4/utils/Loop.h"
160#include "tarch/timing/Measurement.h"
161#include "tarch/timing/Watch.h"
164{dg_stateless_kernel_declaration}
165{dg_stateless_call_with_measurement_declaration}
167{dg_stateless_omp_accelerator_kernel_declaration}
168{dg_stateless_omp_accelerator_call_with_measurement_declaration}
170{dg_kernel_declaration}
171{dg_call_with_measurement_declaration}
173#include "dg_cellIntegral3d.cpph"
177 file = open(
"kernels/dg_cellIntegral3d.cpph",
"w")
178 file.write(
"#include \"exahype2/dg/DGUtils.h\"\n")
179 file.write(dg_stateless_kernel)
180 file.write(dg_stateless_call_with_measurement)
181 file.write(dg_stateless_omp_accelerator_kernel)
182 file.write(dg_stateless_omp_accelerator_call_with_measurement)
183 file.write(dg_kernel)
184 file.write(dg_call_with_measurement)
190 eigenvalues_implementation,
191 source_term_implementation,
192 point_source_implementation,
193 pde_terms_without_state,
195 Template = jinja2.Template(
198 {% if EIGENVALUES_IMPLEMENTATION=="<none>" or EIGENVALUES_IMPLEMENTATION=="<empty>" %}
199 #error Eigenvalue implementation cannot be none or empty
202 {% if EIGENVALUES_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
204 * Depending on the implementation, this variant might be slow as it
205 * lacks an inline define. Also, if you don't want to use ipo aggressively,
206 * it might be clever to put the implementation into the header.
208 #if defined(GPUOffloadingOMP)
209 #pragma omp declare target
211 static void maxEigenvalue(
212 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
213 const tarch::la::Vector<Dimensions,double>& faceCentre,
217 double* maxEigenvalue,
220 #if defined(GPUOffloadingOMP)
221 #pragma omp end declare target
226 * Determine max eigenvalue over Jacobian in a given point with solution values
227 * (states) Q. All parameters are in.
229 * @return Max eigenvalue. Result has to be positive, so we are actually speaking
230 * about the maximum absolute eigenvalue.
232 virtual void maxEigenvalue(
233 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
234 const tarch::la::Vector<Dimensions,double>& faceCentre,
238 double* maxEigenvalue
239 ) {% if EIGENVALUES_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final{% endif %};
241 {% if FLUX_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
243 * Depending on the implementation, this variant might be slow as it
244 * lacks an inline define. Also, if you don't want to use ipo aggressively,
245 * it might be clever to put the implementation into the header.
247 #if defined(GPUOffloadingOMP)
248 #pragma omp declare target
251 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
252 const tarch::la::Vector<Dimensions,double>& faceCentre,
256 double * __restrict__ F, // F[{{NUMBER_OF_UNKNOWNS}}]
259 #if defined(GPUOffloadingOMP)
260 #pragma omp end declare target
264 {% if FLUX_IMPLEMENTATION!="<none>" %}
266 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
267 const tarch::la::Vector<Dimensions,double>& faceCentre,
271 double * __restrict__ F // F[{{NUMBER_OF_UNKNOWNS}}]
272 ) {% if FLUX_IMPLEMENTATION=="<user-defined>" %}=0{% else %} final {% endif %};
275 {% if NCP_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
277 * Depending on the implementation, this variant might be slow as it
278 * lacks an inline define. Also, if you don't want to use ipo aggressively,
279 * it might be clever to put the implementation into the header.
281 #if defined(GPUOffloadingOMP)
282 #pragma omp declare target
284 static void nonconservativeProduct(
285 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
286 const double * __restrict__ deltaQ, // deltaQ[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
287 const tarch::la::Vector<Dimensions,double>& faceCentre,
291 double * __restrict__ BTimesDeltaQ, // BTimesDeltaQ[{{NUMBER_OF_UNKNOWNS}}]
294 #if defined(GPUOffloadingOMP)
295 #pragma omp end declare target
299 {% if NCP_IMPLEMENTATION!="<none>" %}
300 virtual void nonconservativeProduct(
301 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
302 const double * __restrict__ deltaQ, // [{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
303 const tarch::la::Vector<Dimensions,double>& faceCentre,
307 double * __restrict__ BTimesDeltaQ // BTimesDeltaQ[{{NUMBER_OF_UNKNOWNS}}]
308 ) {% if NCP_IMPLEMENTATION=="<user-defined>" %}=0{% endif %};
311 {% if SOURCE_TERM_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
313 * Depending on the implementation, this variant might be slow as it
314 * lacks an inline define. Also, if you don't want to use ipo aggressively,
315 * it might be clever to put the implementation into the header.
317 #if defined(GPUOffloadingOMP)
318 #pragma omp declare target
320 static void sourceTerm(
321 const double * __restrict__ Q,
322 const tarch::la::Vector<Dimensions,double>& volumeCentre,
325 double * __restrict__ S,
328 #if defined(GPUOffloadingOMP)
329 #pragma omp end declare target
333 {% if SOURCE_TERM_IMPLEMENTATION!="<none>" %}
334 virtual void sourceTerm(
335 const double * __restrict__ Q,
336 const tarch::la::Vector<Dimensions,double>& volumeCentre,
339 double * __restrict__ S
340 ) {% if SOURCE_TERM_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
343 {% if POINT_SOURCE_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
345 * Depending on the implementation, this variant might be slow as it
346 * lacks an inline define. Also, if you don't want to use ipo aggressively,
347 * it might be clever to put the implementation into the header.
349 #if defined(GPUOffloadingOMP)
350 #pragma omp declare target
353 const double * __restrict__ Q,
354 const tarch::la::Vector<Dimensions,double>& x,
357 double * __restrict__ S,
360 #if defined(GPUOffloadingOMP)
361 #pragma omp end declare target
365 {% if POINT_SOURCE_IMPLEMENTATION!="<none>" %}
366 virtual void pointSource(
367 const double * __restrict__ Q,
368 const tarch::la::Vector<Dimensions,double>& x,
371 double * __restrict__ S
372 ) {% if SOURCE_TERM_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
375 #if defined(GPUOffloadingOMP)
376 #pragma omp declare target
378 static void getQuadraturePoint(
379 const tarch::la::Vector<Dimensions,int>& index,
380 const tarch::la::Vector<Dimensions,double>& cellCentre,
381 const tarch::la::Vector<Dimensions,double>& cellSize,
383 const double* __restrict__ quadraturePoints,
384 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions,
387 #if defined(GPUOffloadingOMP)
388 #pragma omp end declare target
391 #if defined(GPUOffloadingOMP)
392 #pragma omp declare target
394 static void getQuadraturePointInFace(
395 const tarch::la::Vector<Dimensions,int>& index,
396 const tarch::la::Vector<Dimensions,double>& faceCentre,
397 const tarch::la::Vector<Dimensions,double>& cellSize,
400 const double* __restrict__ quadraturePoints,
401 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions,
404 #if defined(GPUOffloadingOMP)
405 #pragma omp end declare target
408 void getQuadraturePoint(
409 const tarch::la::Vector<Dimensions,int>& index,
410 const tarch::la::Vector<Dimensions,double>& cellCentre,
411 const tarch::la::Vector<Dimensions,double>& cellSize,
413 const double* __restrict__ quadraturePoints,
414 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions
417 void getQuadraturePointInFace(
418 const tarch::la::Vector<Dimensions,int>& index,
419 const tarch::la::Vector<Dimensions,double>& faceCentre,
420 const tarch::la::Vector<Dimensions,double>& cellSize,
423 const double* __restrict__ quadraturePoints,
424 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions
427 undefined=jinja2.DebugUndefined,
431 d[
"FLUX_IMPLEMENTATION"] = flux_implementation
432 d[
"NCP_IMPLEMENTATION"] = ncp_implementation
433 d[
"EIGENVALUES_IMPLEMENTATION"] = eigenvalues_implementation
434 d[
"SOURCE_TERM_IMPLEMENTATION"] = source_term_implementation
435 d[
"POINT_SOURCE_IMPLEMENTATION"] = point_source_implementation
436 d[
"STATELESS_PDE_TERMS"] = pde_terms_without_state
437 return Template.render(**d)
443 eigenvalues_implementation,
444 source_term_implementation,
445 point_source_implementation,
446 pde_terms_without_state,
448 Template = jinja2.Template(
450{% if EIGENVALUES_IMPLEMENTATION!="<user-defined>" and EIGENVALUES_IMPLEMENTATION!="<none>" %}
451void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::maxEigenvalue(
452 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
453 const tarch::la::Vector<Dimensions,double>& faceCentre,
457 double* maxEigenvalue
459 {{EIGENVALUES_IMPLEMENTATION}}
463{% if FLUX_IMPLEMENTATION!="<none>" and FLUX_IMPLEMENTATION!="<user-defined>" %}
464void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::flux(
465 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
466 const tarch::la::Vector<Dimensions,double>& faceCentre,
470 double * __restrict__ F // F[{{NUMBER_OF_UNKNOWNS}}]
472 {{FLUX_IMPLEMENTATION}}
476{% if NCP_IMPLEMENTATION!="<none>" and NCP_IMPLEMENTATION!="<user-defined>" %}
477void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::nonconservativeProduct(
478 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
479 const double * __restrict__ deltaQ, // deltaQ[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
480 const tarch::la::Vector<Dimensions,double>& faceCentre,
484 double * __restrict__ BTimesDeltaQ // BTimesDeltaQ[{{NUMBER_OF_UNKNOWNS}}]
486 {{NCP_IMPLEMENTATION}}
490{% if SOURCE_TERM_IMPLEMENTATION!="<user-defined>" and SOURCE_TERM_IMPLEMENTATION!="<none>" %}
491void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::sourceTerm(
492 const double * __restrict__ Q,
493 const tarch::la::Vector<Dimensions,double>& volumeCentre,
496 double * __restrict__ S
498 {% if SOURCE_TERM_IMPLEMENTATION!="<empty>" %}
499 {{SOURCE_TERM_IMPLEMENTATION}}
501 std::fill_n(S,{{NUMBER_OF_UNKNOWNS}},0.0);
506{% if POINT_SOURCE_IMPLEMENTATION!="<user-defined>" and POINT_SOURCE_IMPLEMENTATION!="<none>" %}
507#error Point sources not yet implemented
508void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::pointSource(
509 const double * __restrict__ Q,
510 const tarch::la::Vector<Dimensions,double>& x,
513 double * __restrict__ S
515 {% if POINT_SOURCE_IMPLEMENTATION!="<empty>" %}
516 {{POINT_SOURCE_IMPLEMENTATION}}
518 std::fill_n(S,{{NUMBER_OF_UNKNOWNS}},0.0);
523{% if EIGENVALUES_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
524#if defined(GPUOffloadingOMP)
525#pragma omp declare target
527void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::maxEigenvalue(
528 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
529 const tarch::la::Vector<Dimensions,double>& faceCentre,
533 double* maxEigenvalue,
536 {{EIGENVALUES_IMPLEMENTATION}};
538#if defined(GPUOffloadingOMP)
539#pragma omp end declare target
543{% if FLUX_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
544#if defined(GPUOffloadingOMP)
545#pragma omp declare target
547void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::flux(
548 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
549 const tarch::la::Vector<Dimensions,double>& faceCentre,
553 double * __restrict__ F, // F[{{NUMBER_OF_UNKNOWNS}}]
556 {% if FLUX_IMPLEMENTATION=="<none>" %}
559 {{FLUX_IMPLEMENTATION}}
562#if defined(GPUOffloadingOMP)
563#pragma omp end declare target
567{% if NCP_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
568#if defined(GPUOffloadingOMP)
569#pragma omp declare target
571void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::nonconservativeProduct(
572 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
573 const double * __restrict__ deltaQ, // deltaQ[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
574 const tarch::la::Vector<Dimensions,double>& faceCentre,
578 double * __restrict__ BTimesDeltaQ, // BTimesDeltaQ[{{NUMBER_OF_UNKNOWNS}}]
581 {% if NCP_IMPLEMENTATION=="<none>" %}
584 {{NCP_IMPLEMENTATION}}
587#if defined(GPUOffloadingOMP)
588#pragma omp end declare target
592{% if SOURCE_TERM_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
593#if defined(GPUOffloadingOMP)
594#pragma omp declare target
596void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::sourceTerm(
597 const double * __restrict__ Q,
598 const tarch::la::Vector<Dimensions,double>& volumeCentre,
601 double * __restrict__ S,
604 {% if SOURCE_TERM_IMPLEMENTATION=="<none>" %}
607 {{SOURCE_TERM_IMPLEMENTATION}}
610#if defined(GPUOffloadingOMP)
611#pragma omp end declare target
615{% if POINT_SOURCE_IMPLEMENTATION!="<user-defined>" and STATELESS_PDE_TERMS %}
616#if defined(GPUOffloadingOMP)
617#pragma omp declare target
619void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::pointSource(
620 const double * __restrict__ Q,
621 const tarch::la::Vector<Dimensions,double>& x,
624 double * __restrict__ S,
627 assertionMsg( false, "point sources not implemented yet" );
628 {% if POINT_SOURCE_IMPLEMENTATION=="<none>" %}
631 {{POINT_SOURCE_IMPLEMENTATION}}
634#if defined(GPUOffloadingOMP)
635#pragma omp end declare target
639void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::getQuadraturePoint(
640 const tarch::la::Vector<Dimensions,int>& index,
641 const tarch::la::Vector<Dimensions,double>& cellCentre,
642 const tarch::la::Vector<Dimensions,double>& cellSize,
644 const double* __restrict__ quadraturePoints,
645 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions,
648 quadraturePositions[0] = ::exahype2::dg::getQuadraturePoint(cellCentre, cellSize, index, polynomialOrder, quadraturePoints);
651void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::getQuadraturePointInFace(
652 const tarch::la::Vector<Dimensions,int>& index,
653 const tarch::la::Vector<Dimensions,double>& faceCentre,
654 const tarch::la::Vector<Dimensions,double>& cellSize,
657 const double* __restrict__ quadraturePoints,
658 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions,
661 ::exahype2::dg::getQuadraturePointInFace(faceCentre, cellSize, index, polynomialOrder, faceOrientation, quadraturePoints, quadraturePositions);
664void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::getQuadraturePoint(
665 const tarch::la::Vector<Dimensions,int>& index,
666 const tarch::la::Vector<Dimensions,double>& cellCentre,
667 const tarch::la::Vector<Dimensions,double>& cellSize,
669 const double* __restrict__ quadraturePoints,
670 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions
672 quadraturePositions[0] = ::exahype2::dg::getQuadraturePoint(cellCentre, cellSize, index, polynomialOrder, quadraturePoints);
675void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::getQuadraturePointInFace(
676 const tarch::la::Vector<Dimensions,int>& index,
677 const tarch::la::Vector<Dimensions,double>& faceCentre,
678 const tarch::la::Vector<Dimensions,double>& cellSize,
681 const double* __restrict__ quadraturePoints,
682 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions
684 ::exahype2::dg::getQuadraturePointInFace(faceCentre, cellSize, index, polynomialOrder, faceOrientation, quadraturePoints, quadraturePositions);
687 undefined=jinja2.DebugUndefined,
691 d[
"FLUX_IMPLEMENTATION"] = flux_implementation
692 d[
"NCP_IMPLEMENTATION"] = ncp_implementation
693 d[
"EIGENVALUES_IMPLEMENTATION"] = eigenvalues_implementation
694 d[
"SOURCE_TERM_IMPLEMENTATION"] = source_term_implementation
695 d[
"POINT_SOURCE_IMPLEMENTATION"] = point_source_implementation
696 d[
"STATELESS_PDE_TERMS"] = pde_terms_without_state
697 return Template.render(**d)
703 eigenvalues_implementation,
704 source_term_implementation,
705 point_source_implementation,
706 pde_terms_without_state,
708 Template = jinja2.Template(
711 {% if SOURCE_TERM_IMPLEMENTATION=="<user-defined>" %}
712 virtual void sourceTerm(
713 const double * __restrict__ Q,
714 const tarch::la::Vector<Dimensions,double>& volumeCentre,
717 double * __restrict__ S
721 {% if POINT_SOURCE_IMPLEMENTATION=="<user-defined>" %}
722 #error point sources not defined yet
723 virtual void pointSource(
724 const double * __restrict__ Q,
725 const tarch::la::Vector<Dimensions,double>& x,
728 double * __restrict__ S
732 {% if EIGENVALUES_IMPLEMENTATION=="<user-defined>" %}
734 * Determine max eigenvalue over Jacobian in a given point with solution values
735 * (states) Q. All parameters are in.
737 * @return Max eigenvalue. Result has to be positive, so we are actually speaking
738 * about the maximum absolute eigenvalue.
740 virtual void maxEigenvalue(
741 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
742 const tarch::la::Vector<Dimensions,double>& faceCentre,
746 double* maxEigenvalue
750 {% if FLUX_IMPLEMENTATION=="<user-defined>" %}
752 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
753 const tarch::la::Vector<Dimensions,double>& faceCentre,
757 double * __restrict__ F // F[{{NUMBER_OF_UNKNOWNS}}]
761 {% if NCP_IMPLEMENTATION=="<user-defined>" %}
762 virtual void nonconservativeProduct(
763 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
764 const double * __restrict__ deltaQ, // deltaQ[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
765 const tarch::la::Vector<Dimensions,double>& faceCentre,
769 double * __restrict__ BTimesDeltaQ // BTimesDeltaQ[{{NUMBER_OF_UNKNOWNS}}]
773 {% if STATELESS_PDE_TERMS and SOURCE_TERM_IMPLEMENTATION=="<user-defined>" %}
775 * To obtain the best performance, I recommend to man inline command to
776 * this signature and to copy the implementation into the header. So it would
779 * static inline void sourceTerm( ... ) {
783 * The GPU offloading requires static functions. As we cannot overload the
784 * original (virtual) function with a static alternative, we do the
785 * TBB trick and overload by adding an additional enum. It has no semantics
786 * but helps the compiler to distinguish the different function variants.
788 #if defined(GPUOffloadingOMP)
789 #pragma omp declare target
791 static void sourceTerm(
792 const double * __restrict__ Q,
793 const tarch::la::Vector<Dimensions,double>& volumeCentre,
794 const tarch::la::Vector<Dimensions,double>& volumeH,
797 double * __restrict__ S,
800 #if defined(GPUOffloadingOMP)
801 #pragma omp end declare target
805 {% if STATELESS_PDE_TERMS and POINT_SOURCE_IMPLEMENTATION=="<user-defined>" %}
807 * To obtain the best performance, I recommend to man inline command to
808 * this signature and to copy the implementation into the header. So it would
811 * static inline void pointSource( ... ) {
815 * The GPU offloading requires static functions. As we cannot overload the
816 * original (virtual) function with a static alternative, we do the
817 * TBB trick and overload by adding an additional enum. It has no semantics
818 * but helps the compiler to distinguish the different function variants.
820 #error point sources not implemented yet
821 #if defined(GPUOffloadingOMP)
822 #pragma omp declare target
824 static void pointSource(
825 const double * __restrict__ Q,
826 const tarch::la::Vector<Dimensions,double>& volumeCentre,
827 const tarch::la::Vector<Dimensions,double>& volumeH,
830 double * __restrict__ S,
833 #if defined(GPUOffloadingOMP)
834 #pragma omp end declare target
838 {% if EIGENVALUES_IMPLEMENTATION=="<user-defined>" and STATELESS_PDE_TERMS %}
840 * To obtain the best performance, I recommend to man inline command to
841 * this signature and to copy the implementation into the header. So it would
844 * static inline void maxEigenvalue( ... ) {
848 * The GPU offloading requires static functions. As we cannot overload the
849 * original (virtual) function with a static alternative, we do the
850 * TBB trick and overload by adding an additional enum. It has no semantics
851 * but helps the compiler to distinguish the different function variants.
853 #if defined(GPUOffloadingOMP)
854 #pragma omp declare target
856 static void maxEigenvalue(
857 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
858 const tarch::la::Vector<Dimensions,double>& faceCentre,
862 double* maxEigenvalue,
865 #if defined(GPUOffloadingOMP)
866 #pragma omp end declare target
870 {% if STATELESS_PDE_TERMS and FLUX_IMPLEMENTATION=="<user-defined>" %}
872 * To obtain the best performance, I recommend to man inline command to
873 * this signature and to copy the implementation into the header. So it would
876 * static inline void flux( ... ) {
880 * The GPU offloading requires static functions. As we cannot overload the
881 * original (virtual) function with a static alternative, we do the
882 * TBB trick and overload by adding an additional enum. It has no semantics
883 * but helps the compiler to distinguish the different function variants.
885 #if defined(GPUOffloadingOMP)
886 #pragma omp declare target
889 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
890 const tarch::la::Vector<Dimensions,double>& faceCentre,
894 double * __restrict__ F, // F[{{NUMBER_OF_UNKNOWNS}}]
897 #if defined(GPUOffloadingOMP)
898 #pragma omp end declare target
902 {% if STATELESS_PDE_TERMS and NCP_IMPLEMENTATION=="<user-defined>" %}
904 * To obtain the best performance, I recommend to man inline command to
905 * this signature and to copy the implementation into the header. So it would
908 * static inline void nonconservativeProduct( ... ) {
912 * The GPU offloading requires static functions. As we cannot overload the
913 * original (virtual) function with a static alternative, we do the
914 * TBB trick and overload by adding an additional enum. It has no semantics
915 * but helps the compiler to distinguish the different function variants.
917 #if defined(GPUOffloadingOMP)
918 #pragma omp declare target
920 static void nonconservativeProduct(
921 const double * __restrict__ Q, // Q[5+0],
922 const double * __restrict__ deltaQ, // deltaQ[5+0]
923 const tarch::la::Vector<Dimensions,double>& x,
927 double * __restrict__ BTimesDeltaQ, // BTimesDeltaQ[5]
930 #if defined(GPUOffloadingOMP)
931 #pragma omp end declare target
935 undefined=jinja2.DebugUndefined,
938 d[
"FLUX_IMPLEMENTATION"] = flux_implementation
939 d[
"NCP_IMPLEMENTATION"] = ncp_implementation
940 d[
"EIGENVALUES_IMPLEMENTATION"] = eigenvalues_implementation
941 d[
"SOURCE_TERM_IMPLEMENTATION"] = source_term_implementation
942 d[
"POINT_SOURCE_IMPLEMENTATION"] = point_source_implementation
943 d[
"STATELESS_PDE_TERMS"] = pde_terms_without_state
944 return Template.render(**d)
950 eigenvalues_implementation,
951 source_term_implementation,
952 point_source_implementation,
953 pde_terms_without_state,
955 Template = jinja2.Template(
957{% if EIGENVALUES_IMPLEMENTATION=="<user-defined>" %}
958void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::maxEigenvalue(
959 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
960 const tarch::la::Vector<Dimensions,double>& faceCentre,
964 double* maxEigenvalue
966 logTraceInWith4Arguments( "maxEigenvalue(...)", x, t, dt, normal );
968 logTraceOut( "maxEigenvalue(...)" );
972{% if FLUX_IMPLEMENTATION=="<user-defined>" %}
973void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::flux(
974 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
975 const tarch::la::Vector<Dimensions,double>& faceCentre,
979 double * __restrict__ F // F[{{NUMBER_OF_UNKNOWNS}}]
981 logTraceInWith4Arguments( "flux(...)", faceCentre, t, dt, normal );
983 logTraceOut( "flux(...)" );
987{% if NCP_IMPLEMENTATION=="<user-defined>" %}
988void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::nonconservativeProduct(
989 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
990 const double * __restrict__ deltaQ, // deltaQ[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
991 const tarch::la::Vector<Dimensions,double>& faceCentre,
995 double * __restrict__ BTimesDeltaQ // BTimesDeltaQ[{{NUMBER_OF_UNKNOWNS}}]
997 logTraceInWith4Arguments( "nonconservativeProduct(...)", faceCentre, t, dt, normal );
999 logTraceOut( "nonconservativeProduct(...)" );
1003{% if SOURCE_TERM_IMPLEMENTATION=="<user-defined>" %}
1004void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::sourceTerm(
1005 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
1006 const tarch::la::Vector<Dimensions,double>& volumeCentre,
1009 double * __restrict__ S // S[{{NUMBER_OF_UNKNOWNS}}]
1011 logTraceInWith3Arguments( "sourceTerm(...)", volumeCentre, t, dt );
1013 // @todo implement and ensure that all entries of S are properly set
1014 for (int i=0; i<NumberOfUnknowns; i++) {
1018 logTraceOut( "sourceTerm(...)" );
1022{% if EIGENVALUES_IMPLEMENTATION=="<user-defined>" and STATELESS_PDE_TERMS %}
1023 #if defined(GPUOffloadingOMP)
1024 #pragma omp declare target
1026void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::maxEigenvalue(
1027 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
1028 const tarch::la::Vector<Dimensions,double>& faceCentre,
1032 double* maxEigenvalue,
1037 #if defined(GPUOffloadingOMP)
1038 #pragma omp end declare target
1042{% if FLUX_IMPLEMENTATION=="<user-defined>" and STATELESS_PDE_TERMS %}
1043 #if defined(GPUOffloadingOMP)
1044 #pragma omp declare target
1046void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::flux(
1047 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
1048 const tarch::la::Vector<Dimensions,double>& faceCentre,
1052 double * __restrict__ F,
1057 #if defined(GPUOffloadingOMP)
1058 #pragma omp end declare target
1062{% if NCP_IMPLEMENTATION=="<user-defined>" and STATELESS_PDE_TERMS %}
1063 #if defined(GPUOffloadingOMP)
1064 #pragma omp declare target
1066void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::nonconservativeProduct(
1067 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
1068 const double * __restrict__ deltaQ, // deltaQ[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
1069 const tarch::la::Vector<Dimensions,double>& faceCentre,
1073 double * __restrict__ BTimesDeltaQ,
1078 #if defined(GPUOffloadingOMP)
1079 #pragma omp end declare target
1083{% if SOURCE_TERM_IMPLEMENTATION=="<user-defined>" and STATELESS_PDE_TERMS %}
1084 #if defined(GPUOffloadingOMP)
1085 #pragma omp declare target
1087void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::sourceTerm(
1088 const double * __restrict__ Q,
1089 const tarch::la::Vector<Dimensions,double>& volumeCentre,
1092 double * __restrict__ S,
1097 #if defined(GPUOffloadingOMP)
1098 #pragma omp end declare target
1102{% if POINT_SOURCE_IMPLEMENTATION=="<user-defined>" and STATELESS_PDE_TERMS %}
1103 #if defined(GPUOffloadingOMP)
1104 #pragma omp declare target
1106#error point sources not implemented yet
1107void {{FULL_QUALIFIED_NAMESPACE}}::{{CLASSNAME}}::sourceTerm(
1108 const double * __restrict__ Q,
1109 const tarch::la::Vector<Dimensions,double>& volumeCentre,
1112 double * __restrict__ S,
1117 #if defined(GPUOffloadingOMP)
1118 #pragma omp end declare target
1122 undefined=jinja2.DebugUndefined,
1125 d[
"FLUX_IMPLEMENTATION"] = flux_implementation
1126 d[
"NCP_IMPLEMENTATION"] = ncp_implementation
1127 d[
"EIGENVALUES_IMPLEMENTATION"] = eigenvalues_implementation
1128 d[
"SOURCE_TERM_IMPLEMENTATION"] = source_term_implementation
1129 d[
"POINT_SOURCE_IMPLEMENTATION"] = point_source_implementation
1130 d[
"STATELESS_PDE_TERMS"] = pde_terms_without_state
1131 return Template.render(**d)
1198 A set of default volumetric kernel calls. You might want to use different
1199 solver calls in your code depending on the context.
1201 ## Difference to Finite Volume (FV) implementation
1203 In the FV code base, I need the implementation routines as argument: As we work
1204 with FV, the generic FV class does not know which implementations are around. If
1205 you work with a domain-specific dg solver, e.g., then there is no such
1208 For the DG schemes, things are different: Every DG solver in ExaHyPE 2 in principle
1209 supports the ncp. So the base Python class already instantiates the corresponding
1210 dictionary entries, and we can use them straightaway.
1214 solver_variant: SolverVariant
1215 Picks different implementation variants
1218 isinstance(polynomial_basis, GaussLegendreBasis)
1219 and solver_variant == SolverVariant.WithVirtualFunctions
1221 return """cellIntegral<{{ORDER}},{{NUMBER_OF_UNKNOWNS}},{{NUMBER_OF_AUXILIARY_VARIABLES}},
1222 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
1223 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
1224 {{ "true" if SOURCE_TERM_IMPLEMENTATION!="<none>" else "false" }}, //useSource
1225 {{ "true" if POINT_SOURCES_IMPLEMENTATION!="<none>" else "false" }} //usePointSource
1229 const double * __restrict__ Q,
1230 const tarch::la::Vector<Dimensions,double>& x,
1234 double * __restrict__ F
1236 {% if FLUX_IMPLEMENTATION!="<none>" %}
1237 repositories::{{SOLVER_INSTANCE}}.flux(Q,x,t,dt,normal,F);
1241 const double * __restrict__ Q,
1242 const double * __restrict__ deltaQ,
1243 const tarch::la::Vector<Dimensions,double>& faceCentre,
1247 double * __restrict__ F
1249 {% if NCP_IMPLEMENTATION!="<none>" %}
1250 repositories::{{SOLVER_INSTANCE}}.nonconservativeProduct(Q, deltaQ, faceCentre, t, dt, normal, F);
1254 const double * __restrict__ Q,
1255 const tarch::la::Vector<Dimensions,double>& x,
1258 double * __restrict__ S
1260 {% if SOURCE_TERM_IMPLEMENTATION!="<none>" %}
1261 repositories::{{SOLVER_INSTANCE}}.sourceTerm(Q,x,t,dt,S);
1265 const double * __restrict__ Q,
1266 const tarch::la::Vector<Dimensions,double>& cellCentre,
1267 const tarch::la::Vector<Dimensions,double>& cellH,
1270 ) -> std::vector<::exahype2::dg::PointSource> {
1271 {% if POINT_SOURCES_IMPLEMENTATION!="<none>" %}
1272 return repositories::{{SOLVER_INSTANCE}}.pointSources(Q,cellCentre,cellH,t,dt);
1274 return std::vector<::exahype2::dg::PointSource>();
1278 const tarch::la::Vector<Dimensions,int>& index,
1279 const tarch::la::Vector<Dimensions,double>& cellCentre,
1280 const tarch::la::Vector<Dimensions,double>& cellSize,
1281 int polynomialOrder,
1282 const double* __restrict__ quadraturePoints,
1283 tarch::la::Vector<Dimensions,double>* __restrict__ quadraturePositions
1284 ) -> std::vector<::exahype2::dg::PointSource> {
1285 repositories::{{SOLVER_INSTANCE}}.getQuadraturePoint(index, cellCentre, cellSize, polynomialOrder, quadraturePoints, quadraturePositions);
1286 }, //quadraturePoints
1287 repositories::{{SOLVER_INSTANCE}}.QuadraturePoints1d,
1288 repositories::{{SOLVER_INSTANCE}}.MassMatrixDiagonal1d,
1289 repositories::{{SOLVER_INSTANCE}}.StiffnessOperator1d,
1290 repositories::{{SOLVER_INSTANCE}}.DerivativeOperator1d
1294 isinstance(polynomial_basis, GaussLegendreBasis)
1295 and solver_variant == SolverVariant.Stateless
1297 return """cellIntegralStateless<{{SOLVER_NAME}},{{ORDER}},{{NUMBER_OF_UNKNOWNS}},{{NUMBER_OF_AUXILIARY_VARIABLES}},
1298 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
1299 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
1300 {{ "true" if SOURCE_TERM_IMPLEMENTATION!="<none>" else "false" }}, //useSource
1301 {{ "true" if POINT_SOURCES_IMPLEMENTATION!="<none>" else "false" }} //usePointSource
1307 isinstance(polynomial_basis, GaussLegendreBasis)
1308 and solver_variant == SolverVariant.Accelerator
1310 return """cellIntegralStateless<{{SOLVER_NAME}},{{ORDER}},{{NUMBER_OF_UNKNOWNS}},{{NUMBER_OF_AUXILIARY_VARIABLES}},
1311 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
1312 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
1313 {{ "true" if SOURCE_TERM_IMPLEMENTATION!="<none>" else "false" }}, //useSource
1314 {{ "true" if POINT_SOURCES_IMPLEMENTATION!="<none>" else "false" }} //usePointSource
1316 gpuCellData.targetDevice,
1321 return "#solver variant not implemented yet"
1325 A set of default volumetric kernel calls. You might want to use different
1326 solver calls in your code depending on the context.
1328 ## Difference to Finite Volume (FV) implementation
1330 In the FV code base, I need the implementation routines as argument: As we work
1331 with FV, the generic FV class does not know which implementations are around. If
1332 you work with a domain-specific dg solver, e.g., then there is no such
1335 For the DG schemes, things are different: Every DG solver in ExaHyPE 2 in principle
1336 supports the ncp. So the base Python class already instantiates the corresponding
1337 dictionary entries, and we can use them straightaway.
1341 solver_variant: SolverVariant
1342 Picks different implementation variants
1345 isinstance(polynomial_basis, GaussLegendreBasis)
1346 and solver_variant == SolverVariant.WithVirtualFunctions
1348 return """cellIntegral_patchwise_in_situ_GaussLegendre_functors(
1351 {{NUMBER_OF_UNKNOWNS}},
1352 {{NUMBER_OF_AUXILIARY_VARIABLES}},
1354 const double * __restrict__ Q,
1355 const tarch::la::Vector<Dimensions,double>& x,
1359 double * __restrict__ F
1361 {% if FLUX_IMPLEMENTATION!="<none>" %}
1362 repositories::{{SOLVER_INSTANCE}}.flux(Q,x,t,dt,normal,F);
1366 const double * __restrict__ Q,
1367 const double * __restrict__ deltaQ,
1368 const tarch::la::Vector<Dimensions,double>& faceCentre,
1372 double * __restrict__ F
1374 {% if NCP_IMPLEMENTATION!="<none>" %}
1375 repositories::{{SOLVER_INSTANCE}}.nonconservativeProduct(Q, deltaQ, faceCentre, t, dt, normal, F);
1379 const double * __restrict__ Q,
1380 const tarch::la::Vector<Dimensions,double>& x,
1383 double * __restrict__ S
1385 {% if SOURCE_TERM_IMPLEMENTATION!="<none>" %}
1386 repositories::{{SOLVER_INSTANCE}}.sourceTerm(Q,x,t,dt,S);
1390 const double * __restrict__ Q,
1391 const tarch::la::Vector<Dimensions,double>& cellCentre,
1392 const tarch::la::Vector<Dimensions,double>& cellH,
1395 ) -> std::vector<::exahype2::dg::PointSource> {
1396 {% if POINT_SOURCES_IMPLEMENTATION!="<none>" %}
1397 return repositories::{{SOLVER_INSTANCE}}.pointSources(Q,cellCentre,cellH,t,dt);
1399 return std::vector<::exahype2::dg::PointSource>();
1402 repositories::{{SOLVER_INSTANCE}}.QuadraturePoints1d,
1403 repositories::{{SOLVER_INSTANCE}}.MassMatrixDiagonal1d,
1404 repositories::{{SOLVER_INSTANCE}}.StiffnessOperator1d,
1405 repositories::{{SOLVER_INSTANCE}}.DerivativeOperator1d,
1406 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
1407 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
1408 {{ "true" if SOURCE_TERM_IMPLEMENTATION!="<none>" else "false" }}, //useSource
1409 {{ "true" if POINT_SOURCES_IMPLEMENTATION!="<none>" else "false" }} //usePointSource
1413 isinstance(polynomial_basis, GaussLegendreBasis)
1414 and solver_variant == SolverVariant.Stateless
1416 return """cellIntegral_patchwise_in_situ_GaussLegendre<{{SOLVER_NAME}},{{ORDER}},{{NUMBER_OF_UNKNOWNS}},{{NUMBER_OF_AUXILIARY_VARIABLES}}>(
1418 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
1419 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
1420 {{ "true" if SOURCE_TERM_IMPLEMENTATION!="<none>" else "false" }}, //useSource
1421 {{ "true" if POINT_SOURCES_IMPLEMENTATION!="<none>" else "false" }} //usePointSource
1425 isinstance(polynomial_basis, GaussLegendreBasis)
1426 and solver_variant == SolverVariant.Accelerator
1428 return """cellIntegral_patchwise_in_situ_GaussLegendre<{{SOLVER_NAME}},{{ORDER}},{{NUMBER_OF_UNKNOWNS}},{{NUMBER_OF_AUXILIARY_VARIABLES}}>(
1431 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
1432 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
1433 {{ "true" if SOURCE_TERM_IMPLEMENTATION!="<none>" else "false" }}, //useSource
1434 {{ "true" if POINT_SOURCES_IMPLEMENTATION!="<none>" else "false" }} //usePointSource
1438 return "#solver variant not implemented yet"