Peano
Loading...
Searching...
No Matches
MassMatrix.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
3from __future__ import annotations
4
5from .PDETerm import PDETerm
6
7
9 """!
10
11 The (possibly Q-dependent) mass matrix M(Q) multiplying the input in a
12 given direction, i.e. MTimesQ = M(Q) * Q. There is no direct legacy
13 equivalent named "mass matrix" - the closest relative is aderdg's
14 multiplyMaterialParameterMatrix() in
15 python/exahype2/solvers/aderdg/AbstractSolverDeclarations.py, which is
16 also normal-dependent, so this term follows the same reduced-signature
17 pattern as Flux/MaxEigenvalue:
18
19 @code
20 virtual void massMatrix(
21 const double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
22 const tarch::la::Vector<Dimensions, double>& x,
23 int normal,
24 double* __restrict__ MTimesQ // MTimesQ[{{NUMBER_OF_UNKNOWNS}}]
25 );
26 @endcode
27
28 """
29
30 SIGNATURE = (
31 "const double* __restrict__ Q, "
32 "const tarch::la::Vector<Dimensions, double>& x, "
33 "int normal, "
34 "double* __restrict__ MTimesQ"
35 )
36
37 NAME = "massMatrix"
38
40 self,
41 implementation: str = None,
42 stateless: bool = False,
43 ):
44 """!
45
46 implementation: str
47 A C++ snippet that becomes massMatrix()'s body (the empty string
48 is a valid, generated no-op body), or None (the default) to leave
49 massMatrix() pure virtual for you to implement by hand. Don't add
50 this term to a solver at all if the PDE has an (implicit) identity
51 mass matrix.
52
53 """
54 super().__init__(
55 name=self.NAMENAME,
56 implementation=implementation,
57 stateless=stateless,
58 )
59
61 """!
62
63 MassMatrix-specific code generation
64
65 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
66 as-is - MassMatrix.SIGNATURE is picked up automatically. Declared
67 explicitly (rather than left to be inherited implicitly) for the
68 same reason as Flux.Generator: the obvious place to add
69 massMatrix-specific generation behaviour later, and so
70 mass_matrix_term.generator reports its type as MassMatrix.Generator
71 rather than the more generic PDETerm.Generator.
72
73 """
MassMatrix-specific code generation.
Definition MassMatrix.py:60
The (possibly Q-dependent) mass matrix M(Q) multiplying the input in a given direction,...
Definition MassMatrix.py:8
__init__(self, str implementation=None, bool stateless=False)
implementation: str A C++ snippet that becomes massMatrix()'s body (the empty string is a valid,...
Definition MassMatrix.py:43
Turns a PDETerm into the C++ text for its generated method: exactly one method - the static,...
Definition PDETerm.py:85
Represents one named, point-wise PDE operator that a solver exposes for the user to implement: a C++ ...
Definition PDETerm.py:6