OGS
v6.4.0
|
ODE solver with a bounds-safe interface using a concrete implementation.
This class makes contact between the abstract ODESolver
interface and a certain solver Implementation
.
The interface of this class inherits the array bounds checking from ODESolver
. Its methods forward calls to the Implementation
erasing array bounds info by passing std::array
and Eigen::Matrix arguments as raw pointers.
Thus the Implementation
does not need template to be templated which makes it possible for Implementation
to use the pimpl idiom whereby the headers of external libraries only have to be included in the final cpp file. Thereby our namespaces do not get polluted with symbols from external libraries.
NumEquations | the number of equations in the ODE system. |
Implementation | a concrete ODE solver implementation used as a backend. |
Definition at line 55 of file ConcreteODESolver.h.
#include <ConcreteODESolver.h>
Public Member Functions | |
void | setFunction (Function< NumEquations > f, JacobianFunction< NumEquations > df) override |
void | setTolerance (const std::array< double, NumEquations > &abstol, const double reltol) override |
void | setTolerance (const double abstol, const double reltol) override |
void | setIC (const double t0, std::initializer_list< double > const &y0) override |
void | setIC (const double t0, Eigen::Matrix< double, NumEquations, 1, Eigen::ColMajor > const &y0) override |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | preSolve () override |
bool | solve (const double t) override |
MappedConstVector< NumEquations > | getSolution () const override |
Returns the solution vector y . More... | |
double | getTime () const override |
Eigen::Matrix< double, NumEquations, 1, Eigen::ColMajor > | getYDot (const double t, const MappedConstVector< NumEquations > &y) const override |
Public Member Functions inherited from MathLib::ODE::ODESolver< NumEquations > | |
virtual unsigned | getNumberOfEquations () const |
Returns the number of equations. More... | |
virtual | ~ODESolver ()=default |
Private Member Functions | |
ConcreteODESolver (BaseLib::ConfigTree const &config) | |
Instances of this class shall only be constructed by createODESolver(). More... | |
Friends | |
std::unique_ptr< ODESolver< NumEquations > > | createODESolver (BaseLib::ConfigTree const &config) |
|
inlineexplicitprivate |
Instances of this class shall only be constructed by createODESolver().
Definition at line 108 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Returns the solution vector y
.
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 93 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Returns the time that the solver has reached.
The return value should be equal to the time t
passed to solve() if everything went fine.
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 97 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Computes \( \dot y = f(t,y) \).
This method is provided for convenience only.
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 98 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Finishes setting up the ODE solver, makes it ready to solve the provided ODE.
This method applies settings to the ODE solver, hence it has to be called after calling setters.
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 91 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Sets functions that compute \(\dot y\) and the Jacobian \(\partial \dot y/\partial y\).
If no Jacobian function shall be set, nullptr
can be passed for df
.
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 59 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 84 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Sets the conditions.
t0 | initial time. |
y0 | initial values. |
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 77 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Sets the tolerances for the ODE solver.
abstol | absolute tolerance, one value for all equations. |
reltol | relative tolerance. |
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 72 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Sets the tolerances for the ODE solver.
abstol | absolute tolerance, one value each equation. |
reltol | relative tolerance. |
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 66 of file ConcreteODESolver.h.
|
inlineoverridevirtual |
Solves the ODE from the set initial condition to time t
.
Implements MathLib::ODE::ODESolver< NumEquations >.
Definition at line 92 of file ConcreteODESolver.h.
|
friend |
Creates a new ODESolver instance from the given config
.
NumEquations | the number of equations in the ODE system to be solved. |
Definition at line 39 of file ODESolverBuilder.h.