3from __future__
import annotations
5from .PDETerm
import PDETerm
11 Point-wise initial condition: given the physical position of a single
12 degree of freedom, write its initial Q there.
14 Unlike the legacy, cell-wise initialCondition() (handed a whole mesh
15 cell's centre and extent plus gridIsConstructed, and expected to fill an
16 entire patch itself - see python/exahype2/solvers/rkfd/*.template.h),
17 this term is evaluated once per degree of freedom, exactly like Flux and
21 virtual void initPointWisely(
22 const tarch::la::Vector<Dimensions, double>& x,
23 double* __restrict__ Q // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
27 Q holds the unknowns. If the solver has auxiliary variables, a pointer to
28 each set follows right behind Q (@ref exahype2.api.AuxiliaryVariables).
29 The solver that owns a set receives a non-const pointer and initialises the set
30 here, as this term has to set up everything a fresh degree of freedom
31 needs. Solvers which share a set receive a const pointer.
36 "const tarch::la::Vector<Dimensions, double>& x, "
37 "double* __restrict__ Q"
40 NAME =
"initPointWisely"
44 implementation: str =
None,
45 stateless: bool =
False,
50 A C++ snippet that becomes initPointWisely()'s body (the empty
51 string is a valid, generated no-op body, though a no-op initial
52 condition leaves Q uninitialised), or None (the default) to leave
53 initPointWisely() pure virtual for you to implement by hand.
55 A grid construction such as exahype2.api.fv.SetupSimulationOverRegularGrid
56 validates that the solver it is attached to has this term
57 registered before it does anything else, since it relies on it to
58 fill in the initial condition.
63 implementation=implementation,
70 InitPointWisely-specific code generation
72 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
73 as-is - InitPointWisely.SIGNATURE is picked up automatically.
74 Declared explicitly (rather than left to be inherited implicitly)
75 for the same reason as Flux.Generator: the obvious place to add
76 initPointWisely-specific generation behaviour later, and so
77 init_point_wisely_term.generator reports its type as
78 InitPointWisely.Generator rather than the more generic
InitPointWisely-specific code generation.
Point-wise initial condition: given the physical position of a single degree of freedom,...
__init__(self, str implementation=None, bool stateless=False)
implementation: str A C++ snippet that becomes initPointWisely()'s body (the empty string is a valid,...
Turns a PDETerm into the C++ text for its generated method: exactly one method - the static,...
Represents one named, point-wise PDE operator that a solver exposes for the user to implement: a C++ ...