Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
o2scl::astep_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t > Class Template Reference

Adaptive ODE stepper (GSL) More...

#include <astep_gsl.h>

Inheritance diagram for o2scl::astep_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >:
o2scl::astep_base< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >

Public Types

typedef boost::numeric::ublas::vector< double > ubvector
 

Public Member Functions

virtual int astep (double &x, double xmax, double &h, size_t n, vec_y_t &y, vec_dydx_t &dydx_out, vec_yerr_t &yerr, func_t &derivs)
 Make an adaptive integration step of the system derivs. More...
 
virtual int astep_derivs (double &x, double xmax, double &h, size_t n, vec_y_t &y, vec_dydx_t &dydx, vec_yerr_t &yerr, func_t &derivs)
 Make an adaptive integration step of the system derivs with derivatives. More...
 
virtual int astep_full (double x, double xmax, double &x_out, double &h, size_t n, vec_y_t &y, vec_dydx_t &dydx, vec_y_t &yout, vec_yerr_t &yerr, vec_dydx_t &dydx_out, func_t &derivs)
 Make an adaptive integration step of the system derivs. More...
 
- Public Member Functions inherited from o2scl::astep_base< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >
int set_step (ode_step< vec_y_t, vec_dydx_t, vec_yerr_t, func_t > &step)
 Set stepper. More...
 

Public Attributes

ode_control_gsl< vec_y_t, vec_dydx_t, vec_yerr_t > con
 Control specification.
 
- Public Attributes inherited from o2scl::astep_base< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >
int verbose
 Set output level.
 
ode_rkck_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t > def_step
 The default stepper.
 

Protected Member Functions

int evolve_apply (double t0, double t1, double &t, double &h, size_t nvar, vec_y_t &y, vec_dydx_t &dydx, vec_y_t &yout, vec_yerr_t &yerr, vec_dydx_t &dydx_out, func_t &derivs)
 Apply the evolution for the next adaptive step. More...
 

Protected Attributes

vec_y_t yout_int
 Temporary storage for yout.
 
vec_dydx_t dydx_int
 Internal storage for dydx.
 
double last_step
 The size of the last step.
 
unsigned long int count
 The number of steps.
 
unsigned long int failed_steps
 The number of failed steps.
 
size_t msize
 The size of the allocated vectors.
 
- Protected Attributes inherited from o2scl::astep_base< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >
ode_step< vec_y_t, vec_dydx_t, vec_yerr_t, func_t > * stepp
 Pointer to the stepper being used.
 

Detailed Description

template<class vec_y_t = boost::numeric::ublas::vector<double>, class vec_dydx_t = vec_y_t, class vec_yerr_t = vec_y_t, class func_t = ode_funct11>
class o2scl::astep_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >

This class performs an adaptive step of a system of ODEs. To modify the ODE stepper which is used, use the function astep_base::set_step().

Note, this has been updated to correspond to the ode-initval2 functions in GSL.

There is an example for the usage of this class in examples/ex_ode.cpp documented in the Ordinary differential equations example section.

Todo:

Document what happens when the stepper function returns a non-zero value, as it's different now with the ode-initval2 function.

Document count, failed_steps, etc.

Idea for Future:
Compare more directly to GSL

Default template arguments

Definition at line 268 of file astep_gsl.h.

Member Function Documentation

◆ astep()

template<class vec_y_t = boost::numeric::ublas::vector<double>, class vec_dydx_t = vec_y_t, class vec_yerr_t = vec_y_t, class func_t = ode_funct11>
virtual int o2scl::astep_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >::astep ( double &  x,
double  xmax,
double &  h,
size_t  n,
vec_y_t &  y,
vec_dydx_t &  dydx_out,
vec_yerr_t &  yerr,
func_t &  derivs 
)
inlinevirtual

This attempts to take a step of size h from the point x of an n-dimensional system derivs starting with y. On exit, x and y contain the new values at the end of the step, h contains the size of the step, dydx_out contains the derivative at the end of the step, and yerr contains the estimated error at the end of the step.

Implements o2scl::astep_base< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >.

Definition at line 461 of file astep_gsl.h.

◆ astep_derivs()

template<class vec_y_t = boost::numeric::ublas::vector<double>, class vec_dydx_t = vec_y_t, class vec_yerr_t = vec_y_t, class func_t = ode_funct11>
virtual int o2scl::astep_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >::astep_derivs ( double &  x,
double  xmax,
double &  h,
size_t  n,
vec_y_t &  y,
vec_dydx_t &  dydx,
vec_yerr_t &  yerr,
func_t &  derivs 
)
inlinevirtual

This attempts to take a step of size h from the point x of an n-dimensional system derivs starting with y and given the initial derivatives dydx. On exit, x, y and dydx contain the new values at the end of the step, h contains the size of the step, dydx contains the derivative at the end of the step, and yerr contains the estimated error at the end of the step.

Implements o2scl::astep_base< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >.

Definition at line 506 of file astep_gsl.h.

◆ astep_full()

template<class vec_y_t = boost::numeric::ublas::vector<double>, class vec_dydx_t = vec_y_t, class vec_yerr_t = vec_y_t, class func_t = ode_funct11>
virtual int o2scl::astep_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >::astep_full ( double  x,
double  xmax,
double &  x_out,
double &  h,
size_t  n,
vec_y_t &  y,
vec_dydx_t &  dydx,
vec_y_t &  yout,
vec_yerr_t &  yerr,
vec_dydx_t &  dydx_out,
func_t &  derivs 
)
inlinevirtual

This function performs an adaptive integration step with the n-dimensional system derivs and parameter pa. It Begins at x with initial stepsize h, ensuring that the step goes no farther than xmax. At the end of the step, the size of the step taken is h and the new value of x is in x_out. Initially, the function values and derivatives should be specified in y and dydx. The function values, derivatives, and the error at the end of the step are given in yout, yerr, and dydx_out. Unlike in ode_step objects, the objects y, yout, dydx, and dydx_out must all be distinct.

This adaptive stepper function is faster than astep() or astep_derivs() because it does not require any copying of vectors.

Implements o2scl::astep_base< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >.

Definition at line 557 of file astep_gsl.h.

◆ evolve_apply()

template<class vec_y_t = boost::numeric::ublas::vector<double>, class vec_dydx_t = vec_y_t, class vec_yerr_t = vec_y_t, class func_t = ode_funct11>
int o2scl::astep_gsl< vec_y_t, vec_dydx_t, vec_yerr_t, func_t >::evolve_apply ( double  t0,
double  t1,
double &  t,
double &  h,
size_t  nvar,
vec_y_t &  y,
vec_dydx_t &  dydx,
vec_y_t &  yout,
vec_yerr_t &  yerr,
vec_dydx_t &  dydx_out,
func_t &  derivs 
)
inlineprotected

This function is based on gsl_odeiv2_evolve_apply.

Note
This function requres that y, yout, dydx and dydx_out are all distinct vectors.

Definition at line 304 of file astep_gsl.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).