ode_iv_solve Class Template Reference

#include <ode_iv_solve.h>


Detailed Description

template<class param_t, class func_t = ode_funct<void *>, class vec_t = ovector_view, class alloc_vec_t = ovector, class alloc_t = ovector_alloc, class adapt_step = gsl_astep<param_t,func_t,vec_t,alloc_vec_t,alloc_t>>
class ode_iv_solve< param_t, func_t, vec_t, alloc_vec_t, alloc_t, adapt_step >

Solve an initial-value ODE problems given an adaptive ODE stepper.

Todo:
(10/8/07) It's not clear to me that astepper shouldn't be a member pointer instead of having the type adapt_step be a template parameter. The present code certainly works, but prevents the user from changing the adaptive stepper for the ODE solver at runtime.
Todo:
Decide what to do if the adaptive stepper fails. (1/18/07: Two approaches: continue no matter what, or just stop. 10/8/07: should probably let the class user decide?)
Idea for future:
Convert to using astep_derivs()?
Idea for future:
Consider modifying so that this can handle tables which are two small by removing half the rows and doubling the stepsize.

Definition at line 60 of file ode_iv_solve.h.


Public Member Functions

template<class mat_t>
int solve_table (double x0, double x1, double h, size_t n, vec_t &ystart, size_t &nsol, vec_t &xsol, mat_t &ysol, param_t &pa, func_t &derivs)
 Solve the initial-value problem and output a table.
template<class mat_t>
int solve_grid (double x0, double x1, double h, size_t n, vec_t &ystart, size_t nsol, vec_t &xsol, mat_t &ysol, param_t &pa, func_t &derivs)
 Solve the initial-value problem from x0 to x1 over a grid.
int solve_final_value (double x0, double x1, double h, size_t n, vec_t &ystart, vec_t &yend, param_t &pa, func_t &derivs)
 Solve the initial-value problem to get the final value.
virtual const char * type ()
 Return the type, "ode_iv_solve".

Data Fields

int verbose
 Set output level.
int ntrial
 Maximum number of steps for solve_final_value() (default 1000).
adapt_step astepper
 The adaptive stepper utilized.

Protected Member Functions

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

Member Function Documentation

int solve_table ( double  x0,
double  x1,
double  h,
size_t  n,
vec_t &  ystart,
size_t &  nsol,
vec_t &  xsol,
mat_t &  ysol,
param_t &  pa,
func_t &  derivs 
) [inline]

Solve the initial-value problem and output a table.

Initially, xsol should be a vector of size nsol, and ysol should be a two-dimensional array (i.e. omatrix_view) of size [nsol][n]. On exit, nsol will will be the size of the solution table, less than or equal to the original value of nsol.

Definition at line 82 of file ode_iv_solve.h.

int solve_grid ( double  x0,
double  x1,
double  h,
size_t  n,
vec_t &  ystart,
size_t  nsol,
vec_t &  xsol,
mat_t &  ysol,
param_t &  pa,
func_t &  derivs 
) [inline]

Solve the initial-value problem from x0 to x1 over a grid.

Initially, xsol should be an array of size nsol, and ysol should be a omatrix of size [nsol][n].

This function never takes a step larger than the grid size. This could cause inaccuracy if the grid size is too fine.

Definition at line 127 of file ode_iv_solve.h.

int solve_final_value ( double  x0,
double  x1,
double  h,
size_t  n,
vec_t &  ystart,
vec_t &  yend,
param_t &  pa,
func_t &  derivs 
) [inline]

Solve the initial-value problem to get the final value.

For a partiular adaptive stepper, this will likely be the fastest approach, but it provides no information about the solution other than the final value at x=x1.

Definition at line 181 of file ode_iv_solve.h.


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

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page