Peano
Loading...
Searching...
No Matches
DiscontinuousGalerkinDiscretisation.Abstract.template.cpp
Go to the documentation of this file.
1#include "{{CLASSNAME}}.h"
2
3
4
5tarch::logging::Log {{NAMESPACE | join("::")}}::{{CLASSNAME}}::_log( "{{NAMESPACE | join("::")}}::{{CLASSNAME}}" );
6
7
8const double {{NAMESPACE | join("::")}}::{{CLASSNAME}}::QuadraturePointsInUnitInterval[] = {
9 {{QUADRATURE_POINTS_IN_UNIT_INTERVAL| join(", ")}}
10};
11
12const double {{NAMESPACE | join("::")}}::{{CLASSNAME}}::GaussianIntegrationPoints[] = {
13 {{GAUSSIAN_INTEGRATION_POINTS| join(", ")}}
14};
15
16const double {{NAMESPACE | join("::")}}::{{CLASSNAME}}::GaussianIntegrationWeights[] = {
17 {{GAUSSIAN_INTEGRATION_WEIGHTS| join(", ")}}
18};
19
20{{NAMESPACE | join("::")}}::{{CLASSNAME}}::{{CLASSNAME}}():
21 _localToGlobalMap( ::petsc::LocalToGlobalMap::RankGlobalTreeNumber ) {
22}
23
24
25{{NAMESPACE | join("::")}}::{{CLASSNAME}}::~{{CLASSNAME}}() {
26}
27
28
29::petsc::LocalToGlobalMap& {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getLocalToGlobalMap() {
30 return _localToGlobalMap;
31}
32
33
34::petsc::LinearEquationSystem& {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getLinearEquationSystem() {
35 return _linearEquationSystem;
36}
37
38
39void {{NAMESPACE | join("::")}}::{{CLASSNAME}}::finishAssembly() {
40}
41
42
43{% if CELL_CELL_LHS_MATRIX!=[] %}
44tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, double > {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getLhsMatrix(
47) {
48 static tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, double > result = {
49 {{CELL_CELL_LHS_MATRIX[0]| join(", ")}}
50 {% for ROW in CELL_CELL_LHS_MATRIX[1:] %}
51 ,{{ROW | join(", ")}}
52 {% endfor %}
53 };
54 double scaling = 1.0;
55 {% if CELL_CELL_LHS_MATRIX_SCALING >= 0 %}
56 for (int i=0; i<{{CELL_CELL_LHS_MATRIX_SCALING}}; i++) {
57 scaling *= cellSize(0);
58 {% else %}
59 for (int i=0; i<(-1)*{{CELL_CELL_LHS_MATRIX_SCALING}}; i++) {
60 scaling /= cellSize(0);
61 {% endif %}
62 }
63 return scaling * result;
64}
65{% endif %}
66
67
68{% if CELL_CELL_RHS_MATRIX!=[] %}
69tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, double > {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getRhsMatrix(
72) {
73 static tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, double > result = {
74 {{CELL_CELL_RHS_MATRIX[0]| join(", ")}}
75 {% for ROW in CELL_CELL_RHS_MATRIX[1:] %}
76 ,{{ROW | join(", ")}}
77 {% endfor %}
78 };
79 double scaling = 1.0;
80 {% if CELL_CELL_RHS_MATRIX_SCALING >= 0 %}
81 for (int i=0; i<{{CELL_CELL_RHS_MATRIX_SCALING}}; i++) {
82 scaling *= cellSize(0);
83 {% else %}
84 for (int i=0; i<(-1)*{{CELL_CELL_RHS_MATRIX_SCALING}}; i++) {
85 scaling /= cellSize(0);
86 {% endif %}
87 }
88 return scaling * result;
89}
90{% endif %}
91
102{% if CELL_TO_FACE_MATRIX!=[] %}
103tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FacesPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, double > {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getProjectionOfCellDataOntoFace(
106) {
107 static tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FacesPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, double > result = {
108 {{CELL_TO_FACE_MATRIX[0]| join(", ")}}
109 {% for ROW in CELL_TO_FACE_MATRIX[1:] %}
110 ,{{ROW | join(", ")}}
111 {% endfor %}
112 };
113 double scaling = 1.0;
114
115 {% if CELL_TO_FACE_MATRIX_SCALING is none %}
116 // supplied "none" to the scaling for cell to face matrix. putting in custom behaviour
117 // in dervied class. reuse this method to grab the matrix itself
118 return result;
119
120 {% elif CELL_TO_FACE_MATRIX_SCALING >= 0 %}
121 for (int i=0; i<{{CELL_TO_FACE_MATRIX_SCALING}}; i++) {
122 scaling *= cellSize(0);
123 }
124 return scaling * result;
125 {% elif CELL_TO_FACE_MATRIX_SCALING < 0 %}
126 for (int i=0; i<(-1)*{{CELL_TO_FACE_MATRIX_SCALING}}; i++) {
127 scaling /= cellSize(0);
128 }
129 return scaling * result;
130 {% endif %}
131}
132{% endif %}
133
144{% if FACE_TO_CELL_MATRIX!=[] %}
145tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FacesPerCell, double > {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getProjectionOfRiemannSolutionOntoCell(
148) {
149 static tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::DoFsPerCell, {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FacesPerCell, double > result = {
150 {{FACE_TO_CELL_MATRIX[0]| join(", ")}}
151 {% for ROW in FACE_TO_CELL_MATRIX[1:] %}
152 ,{{ROW | join(", ")}}
153 {% endfor %}
154 };
155 double scaling = 1.0;
156 {% if FACE_TO_CELL_MATRIX_SCALING is none %}
157 // supplied "none" to the scaling for cell to face matrix. putting in custom behaviour
158 // in dervied class. reuse this method to grab the matrix itself
159 return result;
160
161 {% elif FACE_TO_CELL_MATRIX_SCALING >= 0 %}
162 for (int i=0; i<{{FACE_TO_CELL_MATRIX_SCALING}}; i++) {
163 scaling *= cellSize(0);
164 }
165 return scaling * result;
166 {% elif FACE_TO_CELL_MATRIX_SCALING < 0 %}
167 for (int i=0; i<(-1)*{{FACE_TO_CELL_MATRIX_SCALING}}; i++) {
168 scaling /= cellSize(0);
169 }
170 return scaling * result;
171 {% endif %}
172}
173{% endif %}
174
175
176{% if FACE_FACE_RIEMANN_PROBLEM_MATRIX!=[] %}
177tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns, 2*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns, double > {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getRiemannSolver(
180) {
181 static tarch::la::Matrix< {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns, 2*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::NodesPerFace*{{NAMESPACE | join("::")}}::{{CLASSNAME}}::FaceUnknowns, double > result = {
182 {{FACE_FACE_RIEMANN_PROBLEM_MATRIX[0]| join(", ")}}
183 {% for ROW in FACE_FACE_RIEMANN_PROBLEM_MATRIX[1:] %}
184 ,{{ROW | join(", ")}}
185 {% endfor %}
186 };
187 return result;
188}
189{% endif %}
190
191
192
193{{NAMESPACE | join("::")}}::vertexdata::{{SOLVER_NAME}}PETScData::Type {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getVertexType(
196) {
197 return vertexdata::{{SOLVER_NAME}}PETScData::Type::Outside;
198}
199
200
201{{NAMESPACE | join("::")}}::facedata::{{SOLVER_NAME}}PETScData::Type {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getFaceType(
204) {
205 auto isOnBoundary = [&]( const tarch::la::Vector< Dimensions, double >& x) -> bool {
206 bool isOnBoundary = false;
207 for (int d=0; d<Dimensions; d++) {
208 isOnBoundary |= tarch::la::smallerEquals( x(d), DomainOffset(d) );
209 isOnBoundary |= tarch::la::greaterEquals( x(d), DomainOffset(d)+DomainSize(d) );
210 }
211 return isOnBoundary;
212 };
213
214 return isOnBoundary(x) ? facedata::{{SOLVER_NAME}}PETScData::Type::Boundary : facedata::{{SOLVER_NAME}}PETScData::Type::Interior;
215}
216
217
218{{NAMESPACE | join("::")}}::celldata::{{SOLVER_NAME}}PETScData::Type {{NAMESPACE | join("::")}}::{{CLASSNAME}}::getCellType(
221) {
222 return celldata::{{SOLVER_NAME}}PETScData::Type::Interior;
223}
224
Class to capture all of the PETSc objects needed by some experiements.
Static (i.e.
Definition Matrix.h:42
Log Device.
Definition Log.h:516
tarch::logging::Log _log("exahype2::fv")
bool greaterEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool smallerEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Simple vector class.
Definition Vector.h:150