libode
Easy to compile, fast ODE integrators as C++ classes
Loading...
Searching...
No Matches
ode_euler.cc
Go to the documentation of this file.
1
2
3#include "ode_euler.h"
4
5namespace ode {
6
7OdeEuler::OdeEuler (unsigned long neq) :
8 OdeAdaptive(neq, false),
9 OdeRK (neq, 1) {
10
11 method_ = "Euler";
12}
13
14void OdeEuler::step_ (double dt) {
15
16 //index
17 unsigned long i;
18 //compute slope
19 ode_fun_(sol_, k_[0]);
20 //compute solution
21 for (i=0; i<neq_; i++) sol_[i] += dt*k_[0][i];
22}
23
24} // namespace ode
Base class implementing solver functions with adaptive time steps.
unsigned long neq_
number of equations in the system of ODEs
Definition ode_base.h:327
std::string method_
the "name" of the solver/method, as in "Euler" or "RK4"
Definition ode_base.h:319
double * sol_
array for the solution, changing over time
Definition ode_base.h:333
void ode_fun_(double *solin, double *fout)
wrapper, calls ode_fun() and increases the neval counter by one
Definition ode_base.cc:87
OdeEuler(unsigned long neq)
constructs
Definition ode_euler.cc:7
Provides space for stage slope values, an array of arrays for k values.
Definition ode_rk.h:9
double ** k_
stage evaluations
Definition ode_rk.h:23