OGS
ODESolver.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <array>
14
15#include "ODESolverTypes.h"
16
17namespace MathLib
18{
19namespace ODE
20{
23
36template <unsigned NumEquations>
38{
39public:
51
61 virtual void setTolerance(const double abstol, const double reltol) = 0;
62
72 virtual void setTolerance(const std::array<double, NumEquations>& abstol,
73 const double reltol) = 0;
74
84 virtual void setIC(const double t0,
85 std::initializer_list<double> const& y0) = 0;
86
88 virtual void setIC(
89 const double t0,
90 Eigen::Matrix<double, NumEquations, 1, Eigen::ColMajor> const& y0) = 0;
91
103 virtual void preSolve() = 0;
104
111 virtual bool solve(const double t) = 0;
112
114 virtual unsigned getNumberOfEquations() const { return NumEquations; }
117
123 virtual double getTime() const = 0;
124
129 virtual Eigen::Matrix<double, NumEquations, 1, Eigen::ColMajor> getYDot(
130 const double t, const MappedConstVector<NumEquations>& y) const = 0;
131
132 virtual ~ODESolver() = default;
133};
134
136
137} // namespace ODE
138} // namespace MathLib
virtual void preSolve()=0
virtual ~ODESolver()=default
virtual void setIC(const double t0, std::initializer_list< double > const &y0)=0
virtual bool solve(const double t)=0
virtual void setIC(const double t0, Eigen::Matrix< double, NumEquations, 1, Eigen::ColMajor > const &y0)=0
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual Eigen::Matrix< double, NumEquations, 1, Eigen::ColMajor > getYDot(const double t, const MappedConstVector< NumEquations > &y) const =0
virtual MappedConstVector< NumEquations > getSolution() const =0
Returns the solution vector y.
virtual unsigned getNumberOfEquations() const
Returns the number of equations.
Definition ODESolver.h:114
virtual void setTolerance(const double abstol, const double reltol)=0
virtual void setFunction(Function< NumEquations > f, JacobianFunction< NumEquations > df)=0
virtual void setTolerance(const std::array< double, NumEquations > &abstol, const double reltol)=0
virtual double getTime() const =0
MappedConstMatrix< N, 1 > MappedConstVector
std::function< bool(const double t, MappedConstVector< N > const &y, MappedConstVector< N > const &ydot, MappedMatrix< N, N > &jac)> JacobianFunction
std::function< bool( const double t, MappedConstVector< N > const &y, MappedVector< N > &ydot)> Function
static const double t