192 OdeBase (
unsigned long neq,
bool need_jac);
259 void step (
double dt,
bool extra=
true);
267 void solve_fixed (
double tint,
double dt,
bool extras=
true);
276 void solve_fixed (
double tint,
double dt,
const char *dirout,
int inter=1);
285 void solve_fixed (
double tint,
double dt,
unsigned long nsnap,
const char *dirout);
294 void solve_fixed (
double dt,
double *tsnap,
unsigned long nsnap,
const char *dirout);
301 void reset (
double t,
double *sol);
311 void solve_fixed_ (
double tint,
double dt,
bool extra=
true);
358 virtual void ode_fun (
double *solin,
double *fout) = 0;
366 virtual void ode_jac (
double *solin,
double **Jout);
384 void ode_fun_ (
double *solin,
double *fout);
391 void ode_jac_ (
double *solin,
double **Jout);
414 virtual void after_snap (std::string dirout,
long isnap,
double t);
428 void snap (std::string dirout,
long isnap,
double tsnap);
Lowest base class for all solvers.
void ode_jac_(double *solin, double **Jout)
wrapper, calls ode_jac() and increments nJac;
virtual void after_capture(double t)
does any extra stuff only when a step is captured
double reljacdel_
relative adjustment fraction for numerical Jacobian, if needed
OdeBase(unsigned long neq, bool need_jac)
constructs
long unsigned icheck_
interval of steps after which to check for nans and infs (zero to ignore)
double get_sol(unsigned long i)
gets an element of the solution array
unsigned long neq_
number of equations in the system of ODEs
const char * get_method()
gets the name of the solver/method
void step(double dt, bool extra=true)
increments the step counter and the time, checks the solution integrity if needed,...
void solve_fixed(double tint, double dt, bool extras=true)
integrates for a specified duration of independent variable without output
bool get_silent_snap()
gets whether to skip writing the solution vector to file when snapping
bool solve_done(double dt, double tend)
checks if the solution is within a single time step of the end point
double t_
time, initialized to zero
const char * get_name()
gets the name of the ODE system
long unsigned get_neval()
gets the total number of ODE system evaluation
long unsigned nJac_
counter for jacobian evaluations
std::string name_
the "name" of the system, which is used for output
virtual void ode_jac(double *solin, double **Jout)
evaluates the system's Jacobian matrix, also in autonomous form, and can either be defined in a deriv...
virtual void after_snap(std::string dirout, long isnap, double t)
does any extra stuff after each snap
virtual void before_solve()
does any extra stuff before starting a solve
double get_dt()
gets the most recent or current time step size
void set_quiet(bool quiet)
sets the boolean determining if updates are printed during solves
virtual void after_solve()
does any extra stuff after completing a solve
double dt_
time step is stored and updated during solves
void snap(std::string dirout, long isnap, double tsnap)
writes the current value of the solution to a binary file
virtual ~OdeBase()
destructs
long unsigned nstep_
number of time steps
double * get_sol()
gets a pointer to the whole solution array
virtual void step_(double dt)=0
advances a single time step (without changing counters or the time) and must be defined in the derive...
bool quiet_
whether stuff should be printed during a solve
virtual void ode_fun(double *solin, double *fout)=0
evaluates the system of ODEs in autonomous form and must be defined by a derived class
void check_sol_integrity()
checks solution for nans and infs, exiting the program if they're found
void set_name(const char *name)
sets the name of the ODE system
bool get_quiet()
gets the boolean determining if updates are printed during solves
double ** Jac_
storage for the ODE system's Jacobian matrix, only allocated for the methods that need it
void set_silent_snap(bool silent_snap)
sets whether to skip writing the solution vector to file when snapping
void reset(double t, double *sol)
reset to a specified time and initial condition array
long unsigned get_icheck()
gets the number of steps after which the solution is checked for integrity
void set_icheck(unsigned long icheck)
sets the number of steps after which the solution is checked for integrity
void solve_fixed_(double tint, double dt, bool extra=true)
integrates without output or any counters, trackers, extra functions...
void set_sol(double *sol)
copies an array into the solution array
bool silent_snap_
whether to skip writing the solution vector to file when snapping but still execute after_snap()
double absjacdel_
absolute adjustment fraction for numerical Jacobian, if needed
std::string method_
the "name" of the solver/method, as in "Euler" or "RK4"
void set_name(std::string name)
sets the name of the ODE system
double get_t()
gets the current value of the independent variable
void check_pre_snaps(double dt, double *tsnap, unsigned long nsnap)
checks that snap times are monotonically increasing and > current time
const char * get_dirout()
gets output directory string if one has been set
long unsigned get_nstep()
gets the total number of steps taken
double * sol_
array for the solution, changing over time
void ode_fun_(double *solin, double *fout)
wrapper, calls ode_fun() and increases the neval counter by one
void set_t(double t)
sets the "time," or independent variable used to track progress
virtual void after_step(double t)
does any extra stuff after each step
long unsigned neval_
function evaluation counter, must be incremented in step() when defined
void set_sol(unsigned long i, double x)
sets an element of the solution array
void check_pre_solve(double tint, double dt)
checks that a solve can be performed with given tend and dt values
std::string dirout_
output directory if one is being used by a solver
long unsigned get_nJac()
gets the total number of Jacobian evaluations performed
unsigned long get_neq()
gets the size of the ODE system