Class astep_gsl (o2scl)¶
-
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_funct, class fp_t = double>
class astep_gsl : public o2scl::astep_base<boost::numeric::ublas::vector<double>, boost::numeric::ublas::vector<double>, boost::numeric::ublas::vector<double>, ode_funct, double>¶ Adaptive ODE stepper (GSL)
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-initval2functions in GSL.There is an example for the usage of this class in
examples/ex_ode.cppdocumented in the Ordinary differential equations example.- 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
func_t- ode_functvec_t- boost::numeric::ublas::vector < double >
Public Functions
-
inline astep_gsl()¶
-
inline virtual ~astep_gsl()¶
-
inline virtual int astep(fp_t &x, fp_t xmax, fp_t &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.This attempts to take a step of size
hfrom the pointxof ann-dimensionalsystemderivsstarting withy. On exit,xandycontain the new values at the end of the step,hcontains the size of the step,dydx_outcontains the derivative at the end of the step, andyerrcontains the estimated error at the end of the step.
-
inline virtual int astep_derivs(fp_t &x, fp_t xmax, fp_t &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
derivswith derivatives.This attempts to take a step of size
hfrom the pointxof ann-dimensionalsystemderivsstarting withyand given the initial derivativesdydx. On exit,x,yanddydxcontain the new values at the end of the step,hcontains the size of the step,dydxcontains the derivative at the end of the step, andyerrcontains the estimated error at the end of the step.
-
inline virtual int astep_full(fp_t x, fp_t xmax, fp_t &x_out, fp_t &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.This function performs an adaptive integration step with the
n-dimensionalsystemderivsand parameterpa. It Begins atxwith initial stepsizeh, ensuring that the step goes no farther thanxmax. At the end of the step, the size of the step taken ishand the new value ofxis inx_out. Initially, the function values and derivatives should be specified inyanddydx. The function values, derivatives, and the error at the end of the step are given inyout,yerr, anddydx_out. Unlike inode_stepobjects, the objectsy,yout,dydx, anddydx_outmust all be distinct.This adaptive stepper function is faster than astep() or astep_derivs() because it does not require any copying of vectors.
Public Members
-
ode_control_gsl<vec_y_t, vec_dydx_t, vec_yerr_t> con¶
Control specification.
Protected Functions
-
inline int evolve_apply(fp_t t0, fp_t t1, fp_t &t, fp_t &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.
This function is based on
gsl_odeiv2_evolve_apply.Note
This function requres that
y,yout,dydxanddydx_outare all distinct vectors.
Protected Attributes
-
vec_dydx_t dydx_int¶
Internal storage for dydx.
-
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.