Peano
Loading...
Searching...
No Matches
PointSource.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 A source term that contributes only at isolated points (e.g. a seismic
12 point source), as opposed to VolumetricSource, which is distributed over
13 the whole domain.
14
15 See python/exahype2/solvers/aderdg/AbstractSolverDeclarations.py's
16 pointSource(), which additionally takes t, dt and an index n selecting
17 which of possibly several point sources is being evaluated - dropped
18 here the same way h/t/dt are dropped from Flux, and n returns once PDE
19 terms are tied to real C code snippets with proper signatures:
20
21 @code
22 virtual void pointSource(
23 const double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
24 const tarch::la::Vector<Dimensions, double>& x,
25 double* __restrict__ forceVector // forceVector[{{NUMBER_OF_UNKNOWNS}}]
26 );
27 @endcode
28
29 """
30
31 SIGNATURE = (
32 "const double* __restrict__ Q, "
33 "const tarch::la::Vector<Dimensions, double>& x, "
34 "double* __restrict__ forceVector"
35 )
36
37 NAME = "pointSource"
38
40 self,
41 implementation: str = None,
42 stateless: bool = False,
43 ):
44 """!
45
46 implementation: str
47 A C++ snippet that becomes pointSource()'s body (the empty string
48 is a valid, generated no-op body), or None (the default) to leave
49 pointSource() pure virtual for you to implement by hand. Don't add
50 this term to a solver at all if the PDE has no point source
51 contribution.
52
53 """
54 super().__init__(
55 name=self.NAMENAME,
56 implementation=implementation,
57 stateless=stateless,
58 )
59
61 """!
62
63 PointSource-specific code generation
64
65 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
66 as-is - PointSource.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 pointSource-specific generation behaviour later, and so
70 point_source_term.generator reports its type as
71 PointSource.Generator rather than the more generic PDETerm.Generator.
72
73 """
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
PointSource-specific code generation.
A source term that contributes only at isolated points (e.g.
Definition PointSource.py:8
__init__(self, str implementation=None, bool stateless=False)
implementation: str A C++ snippet that becomes pointSource()'s body (the empty string is a valid,...