Peano
Loading...
Searching...
No Matches
exahype2.api.PDETerm.PDETerm Class Reference

Represents one named, point-wise PDE operator that a solver exposes for the user to implement: a C++ method name, its parameter list, and an implementation. More...

Inheritance diagram for exahype2.api.PDETerm.PDETerm:

Data Structures

class  Generator
 Turns a PDETerm into the C++ text for its generated method: exactly one method - the static, GPU-offloadable overload if the term is stateless, otherwise the virtual instance method. More...
 

Public Member Functions

 __init__ (self, str name, str implementation=None, bool stateless=False)
 name: str The C++ method name, e.g.
 
str __repr__ (self)
 
str __str__ (self)
 
"PDETerm.Generator" generator (self)
 Code generator for this term: an instance of this term's own (possibly subclass-specific) Generator.
 

Data Fields

 name
 
 implementation
 
 stateless
 

Static Public Attributes

str NAME
 
str SIGNATURE
 

Detailed Description

Represents one named, point-wise PDE operator that a solver exposes for the user to implement: a C++ method name, its parameter list, and an implementation.

flux(), eigenvalues(), the nonconservative product, algebraic/point sources, boundary conditions, ... all have this same shape (see python/exahype2/solvers/fv/riemann/kernels.py for how they are actually declared in the generated abstract solver header).

Well-known terms should get their own PDETerm subclass which pins down name and signature and adds any term-specific behaviour -

See also
Flux for a fully worked example. Use the plain PDETerm constructor directly only for a new, solver-specific term that does not warrant its own subclass (yet).

A term's implementation is a C++ code snippet that becomes the generated method's body verbatim - including the empty string, which generates a method that does nothing (a no-op, not "contributes zero": it does not zero out the output for you) - or None (the default), which leaves the method pure virtual for you to implement by hand in your solver subclass instead of generating it. A term you don't want at all is simply never passed to solver.add_pde_term() in the first place.

implementation must not be None when stateless is True: the constructor raises ValueError in that case, since a stateless term's generated method is static, and static methods cannot be pure virtual - there would be no declaration left to signal "implement this by hand".

PDETerm only models what the term is (name, signature, implementation). It deliberately knows nothing about Jinja2 or the code generator: turning a solver's collection of terms into the generated abstract solver header remains the code generator's job, exactly as it is today.

See also
exahype2.api.Solver.add_pde_term()

Definition at line 6 of file PDETerm.py.

Constructor & Destructor Documentation

◆ __init__()

exahype2.api.PDETerm.PDETerm.__init__ (   self,
str  name,
str   implementation = None,
bool   stateless = False 
)

name: str The C++ method name, e.g.

"flux" or "eigenvalues". Used by exahype2.api.Solver to key its collection of terms, i.e. has to be unique per solver.

implementation: str A C++ snippet that becomes the method's body verbatim (the empty string is a valid, generated no-op body), or None (the default) to leave the method pure virtual for you to implement by hand. Must not be None if stateless is True: the generated method is then static, and static methods cannot be pure virtual, so there would be nothing left to tell you to implement it by hand.

Reimplemented in exahype2.api.blockstructured.DirichletBoundaryConditions.DirichletBoundaryConditions, exahype2.api.Flux.Flux, exahype2.api.GradientRefinement.GradientRefinement, exahype2.api.InitPointWisely.InitPointWisely, exahype2.api.MassMatrix.MassMatrix, exahype2.api.MaxEigenvalue.MaxEigenvalue, exahype2.api.NonconservativeProduct.NonconservativeProduct, exahype2.api.PointSource.PointSource, exahype2.api.RefineErasePointwisely.RefineErasePointwisely, exahype2.api.VolumetricSource.VolumetricSource, exahype2.api.blockstructured.SommerfeldBoundaryConditions.SommerfeldBoundaryConditions, and exahype2.api.AdaptivityCriterion.AdaptivityCriterion.

Definition at line 47 of file PDETerm.py.

Member Function Documentation

◆ __repr__()

str exahype2.api.PDETerm.PDETerm.__repr__ (   self)

Definition at line 79 of file PDETerm.py.

◆ __str__()

str exahype2.api.PDETerm.PDETerm.__str__ (   self)

Definition at line 82 of file PDETerm.py.

Referenced by peano4.api.toolbox.particles.postprocessing.ParticleVTUReader.VTUParticleSet.__repr__().

Here is the caller graph for this function:

◆ generator()

Field Documentation

◆ implementation

◆ NAME

◆ name

exahype2.api.PDETerm.PDETerm.name

Definition at line 75 of file PDETerm.py.

Referenced by solvers.aderdg.kernels.Gemms.Gemms.__repr__(), test_derive_load_store_compute_flag._FakeSubmodel.__repr__(), test_propagate_use_statements._FakeSubmodel.__repr__(), exaparty.api.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.__setup_algorithm_steps(), exaparty.api.particle.AlgorithmStep.AlgorithmStep.__str__(), exahype2.api.Solver.Solver.Plotter._add_time_interval_bookkeeping_to_solver(), exaparty.api.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius._setup_algorithm_steps_dict(), exagrype.api.CCZ4Solver.CCZ4Solver._tasks_of_this_solver(), peano4.api.datamodel.DoF.DoF.additional_load_and_store_arguments_for_other_dof(), exaparty.api.particle.ExplicitEulerDynamicSearchRadius.ExplicitEulerDynamicSearchRadius.algorithm_steps(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle.algorithm_steps(), exahype2.api.Solver.Solver.Plotter.create_finish_call(), exahype2.api.Solver.Solver.Plotter.create_is_active_predicate(), peano4.api.solversteps.UserActionSet.UserActionSet.get_action_set_name(), peano4.api.taskgraph.compiler.fuse-steps-illustrations._IllustrationActionSet.get_action_set_name(), test_fuse_steps._FakeActionSet.get_action_set_name(), peano4.api.datamodel.DoF.DoF.get_full_qualified_type(), peano4.api.datamodel.DoF.DoF.get_logical_type_name(), peano4.api.solversteps.Step.Step.get_observer_class_name(), dastgen2.attributes.Enumeration.Enumeration.get_to_string(), and exaparty.api.particle.Particle.Particle.readme_descriptor().

◆ SIGNATURE

str exahype2.api.PDETerm.PDETerm.SIGNATURE
static

Definition at line 45 of file PDETerm.py.

◆ stateless

exahype2.api.PDETerm.PDETerm.stateless

Definition at line 77 of file PDETerm.py.


The documentation for this class was generated from the following file: