42#ifndef OPENSWMM_ODE_SOLVER_HPP
43#define OPENSWMM_ODE_SOLVER_HPP
56constexpr double TINY = 1.0e-30;
82using DerivFunc = std::function<void(
double x,
const double*
y,
double*
dydx)>;
100int integrate(
double*
y,
int n,
double x1,
double x2,
101 double eps,
double h1,
const DerivFunc& derivs);
127 const double* y0,
const double* y1,
128 double* dy0,
double* dy1,
int n_sys)>;
131 double x1,
double x2,
double eps,
double h1,
Definition OdeSolver.cpp:35
constexpr int MAXSTP
Maximum integration steps.
Definition OdeSolver.hpp:55
constexpr double PSHRNK
Exponent for step decrease.
Definition OdeSolver.hpp:59
constexpr double SAFETY
Step adjustment safety factor.
Definition OdeSolver.hpp:57
constexpr double PGROW
Exponent for step increase.
Definition OdeSolver.hpp:58
constexpr int ODE_UNDERFLOW
Step size underflowed.
Definition OdeSolver.hpp:68
constexpr int ODE_OK
Success.
Definition OdeSolver.hpp:66
std::function< void(double x, const double *y, double *dydx)> DerivFunc
Derivative function signature.
Definition OdeSolver.hpp:82
int integrate(double *ystart, int n, double x1, double x2, double eps, double h1, const DerivFunc &derivs)
Integrate an ODE system from x1 to x2 using RK45 Cash-Karp.
Definition OdeSolver.cpp:201
constexpr int ODE_MAX_STEPS
Exceeded MAXSTP.
Definition OdeSolver.hpp:69
constexpr double TINY
Underflow protection.
Definition OdeSolver.hpp:56
int integrate_batch_2eq(double *y0, double *y1, int n_sys, double x1, double x2, double eps, double h1, const BatchDerivFunc &derivs)
Definition OdeSolver.cpp:235
std::function< void(double x, const double *y0, const double *y1, double *dy0, double *dy1, int n_sys)> BatchDerivFunc
Integrate N independent 2-equation ODE systems in batch.
Definition OdeSolver.hpp:126
constexpr double ERRCON
= (5/SAFETY)^(1/PGROW)
Definition OdeSolver.hpp:60
constexpr int ODE_TOO_MANY
n > allocated max
Definition OdeSolver.hpp:67
Definition NodeCoupling.cpp:16
double * dydx
Definition odesolve.c:32
double * y
Definition odesolve.c:28