Peano
Loading...
Searching...
No Matches
AbstractSolverDeclarations.py
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
3import jinja2
4
5
8 self,
9 flux_implementation,
10 ncp_implementation,
11 eigenvalues_implementation,
12 source_term_implementation,
13 material_parameters_implementation,
14 point_source_implementation,
15 is_linear,
16 computation_precisions,
17 pde_terms_without_state,
18 ):
19 self._flux_implementation = flux_implementation
20 self._ncp_implementation = ncp_implementation
21 self._eigenvalues_implementation = eigenvalues_implementation
22 self._source_term_implementation = source_term_implementation
23 self._material_parameters_implementation = material_parameters_implementation
24 self._point_source_implementation = point_source_implementation
25 self._is_linear = is_linear
26 self._computation_precisions = computation_precisions
27 self._pde_terms_without_state = pde_terms_without_state
28
30 Template = jinja2.Template(
31 """
32 {% for PRECISION_NUM in range(0,COMPUTATION_PRECISIONS|length) %}
33
34 {% if EIGENVALUES_IMPLEMENTATION=="<none>" or EIGENVALUES_IMPLEMENTATION=="<empty>" %}
35 #error Eigenvalue implementation cannot be none or empty
36 {% elif EIGENVALUES_IMPLEMENTATION=="<user-defined>" %}
37 virtual double maxEigenvalue(
38 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* __restrict__ Q,
39 const tarch::la::Vector<Dimensions, double>& x,
40 const tarch::la::Vector<Dimensions, double>& h,
41 double t,
42 double dt,
43 int normal
44 ) = 0;
45 {% else %}
46 virtual double maxEigenvalue(
47 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* __restrict__ Q,
48 const tarch::la::Vector<Dimensions, double>& x,
49 const tarch::la::Vector<Dimensions, double>& h,
50 double t,
51 double dt,
52 int normal
53 );
54 {% endif %}
55
56 {% if FLUX_IMPLEMENTATION!="<none>" %}
57 virtual void flux(
58 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* __restrict__ Q,
59 const tarch::la::Vector<Dimensions, double>& x,
60 const tarch::la::Vector<Dimensions, double>& h,
61 double t,
62 double dt,
63 int normal,
64 {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* __restrict__ F
65 ) {% if FLUX_IMPLEMENTATION=="<user-defined>" %} = 0{% else %} final {% endif %};
66 {% endif %}
67
68 {% if NCP_IMPLEMENTATION!="<none>" %}
69 virtual void nonconservativeProduct(
70 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}*__restrict__ Q,
71 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}*__restrict__ deltaQ,
72 const tarch::la::Vector<Dimensions, double>& x,
73 const tarch::la::Vector<Dimensions, double>& h,
74 double t,
75 double dt,
76 int normal,
77 {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}*__restrict__ BTimesDeltaQ
78 ) {% if NCP_IMPLEMENTATION=="<user-defined>" %} = 0{% else %} final {% endif %};
79 {% endif %}
80
81 {% if SOURCE_TERM_IMPLEMENTATION!="<none>" %}
82 virtual void algebraicSource(
83 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* const Q,
84 const tarch::la::Vector<Dimensions, double>& x,
85 const tarch::la::Vector<Dimensions, double>& h,
86 double t,
87 double dt,
88 {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* S
89 ) {% if SOURCE_TERM_IMPLEMENTATION=="<user-defined>" %} = 0{% else %} final {% endif %};
90 {% endif %}
91
92 {% if MATERIAL_PARAM_IMPLEMENTATION!="<none>" %}
93 virtual void multiplyMaterialParameterMatrix(
94 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* const Q,
95 const tarch::la::Vector<Dimensions, double>& x,
96 const tarch::la::Vector<Dimensions, double>& h,
97 double t,
98 double dt,
99 int normal,
100 {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* const rhs
101 ) {% if MATERIAL_PARAM_IMPLEMENTATION=="<user-defined>" %} = 0{% else %} final {% endif %};
102 {% endif %}
103
104 {% if POINT_SOURCE_IMPLEMENTATION!="<none>" %}
105 virtual void pointSource(
106 const {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* const Q,
107 const double* const x,
108 const double t,
109 const double dt,
110 {{COMPUTATION_PRECISIONS[PRECISION_NUM]}}* const forceVector,
111 int n
112 ) {% if POINT_SOURCE_IMPLEMENTATION=="<user-defined>" %} = 0{% else %} final {% endif %};
113 {% endif %}
114
115 {% endfor %}
116
117 {% if POINT_SOURCE_IMPLEMENTATION!="<none>" %}
118 virtual void initPointSourceLocations(
119 double sourceLocation[NumberOfPointSources][Dimensions]
120 ) = 0;
121 {% endif %}
122""",
123 undefined=jinja2.DebugUndefined,
124 )
125
126 d = {}
127 d["FLUX_IMPLEMENTATION"] = self._flux_implementation
128 d["NCP_IMPLEMENTATION"] = self._ncp_implementation
129 d["EIGENVALUES_IMPLEMENTATION"] = self._eigenvalues_implementation
130 d["SOURCE_TERM_IMPLEMENTATION"] = self._source_term_implementation
131 d["MATERIAL_PARAM_IMPLEMENTATION"] = self._material_parameters_implementation
132 d["POINT_SOURCE_IMPLEMENTATION"] = self._point_source_implementation
133 d["IS_LINEAR"] = self._is_linear
134 d["COMPUTATION_PRECISIONS"] = self._computation_precisions
135 d["STATELESS_PDE_TERMS"] = self._pde_terms_without_state
136 return Template.render(**d)
__init__(self, flux_implementation, ncp_implementation, eigenvalues_implementation, source_term_implementation, material_parameters_implementation, point_source_implementation, is_linear, computation_precisions, pde_terms_without_state)