Public Attributes | Protected Member Functions | Protected Attributes | List of all members
o2scl::ode_iv_solve_grid< func_t, mat_row_t > Class Template Reference

Solve an initial-value ODE problems on a grid given an adaptive ODE stepper. More...

#include <ode_iv_solve.h>

Detailed Description

template<class func_t = ode_funct_solve_grid, class mat_row_t = solve_grid_mat_row>
class o2scl::ode_iv_solve_grid< func_t, mat_row_t >

This class works as similar to ode_iv_solve::solve_store() except that the solution is stored on a grid of points in the independent variable specified by the user, at the cost of taking extra steps to ensure that function values, derivatives, and errors are computed at each grid point.

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

Definition at line 673 of file ode_iv_solve.h.

Public Attributes

bool err_nonconv
 If true, call the error handler if the solution does not converge (default true)
 

Protected Member Functions

virtual int print_iter (double x, size_t nv, mat_row_t &y)
 Print out iteration information.
 

Protected Attributes

astep_base< mat_row_t, mat_row_t, mat_row_t, func_t > * astp
 The adaptive stepper.
 

Main solver function

int verbose
 Set output level.
 
size_t ntrial
 Maximum number of applications of the adaptive stepper (default 1000)
 
size_t nsteps
 Number of adaptive steps employed.
 
template<class vec_t , class mat_t >
int solve_grid (double h, size_t n, size_t nsol, vec_t &xsol, mat_t &ysol, mat_t &err_sol, mat_t &dydx_sol, func_t &derivs)
 Solve the initial-value problem from x0 to x1 over a grid storing derivatives and errors. More...
 

The adaptive stepper

bool exit_on_fail
 If true, stop the solution if the adaptive stepper fails (default true)
 
astep_gsl< mat_row_t, mat_row_t, mat_row_t, func_t > gsl_astp
 The default adaptive stepper.
 
int set_astep (astep_base< mat_row_t, mat_row_t, mat_row_t, func_t > &as)
 Set the adaptive stepper to use.
 
virtual const char * type ()
 Return the type, "ode_iv_solve".
 

Member Function Documentation

◆ solve_grid()

template<class func_t = ode_funct_solve_grid, class mat_row_t = solve_grid_mat_row>
template<class vec_t , class mat_t >
int o2scl::ode_iv_solve_grid< func_t, mat_row_t >::solve_grid ( double  h,
size_t  n,
size_t  nsol,
vec_t &  xsol,
mat_t &  ysol,
mat_t &  err_sol,
mat_t &  dydx_sol,
func_t &  derivs 
)
inline

Initially, xsol should be an array of size nsol, and ysol should be a ubmatrix of size [nsol][n]. This function never takes a step larger than the grid size.

If verbose is greater than zero, The solution at each grid point will be written to std::cout. If verbose is greater than one, a character will be required after each point.

Idea for Future:
Consider making a version of grid which gives the same answers as solve_final_value(). After each proposed step, it would go back and fill in the grid points if the proposed step was past the next grid point.

Definition at line 733 of file ode_iv_solve.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).