Solver Class Reference
[ODE Solvers]

Generic Solver interface. More...

#include <solver.h>

Inheritance diagram for Solver:

Object GenericEulerSolver GslGenericSolver AdaptiveEulerSolver EulerSolver GslAdaptiveSolver GslSolver List of all members.

Public Types

typedef int(*) Function (double t, const double y[], double f[], void *params)

Public Member Functions

 Solver (int dimension=0, Function function=NULL, void *params=NULL)
QString solverType () const
int dimension () const
virtual void setDimension (int dimension)
Function function () const
virtual void setFunction (Function function)
void * params () const
virtual void setParams (void *params)
double toleranceAbs () const
virtual void setToleranceAbs (double toleranceAbs)
double toleranceRel () const
virtual void setToleranceRel (double toleranceRel)
double localError () const
double localErrorRatio () const
virtual void doCalcFn (double *t, double y[], double f[]=0)=0
virtual bool doEvolve (double *t, double t1, double y[], double yerr[])=0
const QString & name () const
void setName (const QString &name)

Detailed Description

Generic Solver interface.

Provides generic interface suitable for large variety of ordinaty differential equations integration algorithms.

It solves system of the first order differential equations:

\begin{eqnarray*} \frac{dy_i(t)}{dt} &=& f(y_i(t), t) \\ y_i(t_0) &=& y^0_i \end{eqnarray*}

Dimension of system is provided via setDimension(), function $f$ is provided via setFunction().

It also provides interface for setting allowed local tolerance. It can be defined using two properties: toleranceAbs and toleranceRel.

On each step solver calculates local error estimation (which depends on used integration method) and local error ratio for each variable using the following formula:

\[ \mbox{localErrorRatio}_i = \frac{|\mbox{localError}_i|} {\mbox{toleranceAbs} + \mbox{toleranceRel} \cdot | y_i |} \]

Non-adaptive solvers cancel current step if maximal local error ratio is bigger than 1.1 (exact value depends on solver) and doEvolve() function returns false.

Adaptive solvers use maximal local error ratio to change time step until the ratio becomes almost equal 1. If it can't be made smaller than 1.1 (exact value depends on solver), solvers cancel current step and doEvolve() function returns false.

Maximal (over all variables) error estimation and error ratio from last time step can be obtained using localError() and localErrorRatio() methods.


Member Typedef Documentation

typedef int(*) Function(double t, const double y[], double f[], void *params)

Callback function type


Constructor & Destructor Documentation

Solver ( int  dimension = 0,
Function  function = NULL,
void *  params = NULL 
) [inline]

Cunstructs a solver


Member Function Documentation

QString solverType (  )  const [inline]

Get solver type

int dimension (  )  const [inline]

Get ODE dimension

virtual void setDimension ( int  dimension  )  [inline, virtual]

Set ODE dimension

Reimplemented in GenericEulerSolver, and GslGenericSolver.

Function function (  )  const [inline]

Get callback function

virtual void setFunction ( Function  function  )  [inline, virtual]

Set callback function

void* params (  )  const [inline]

Get callback function params

virtual void setParams ( void *  params  )  [inline, virtual]

Set callback function params

Reimplemented in GslGenericSolver.

double toleranceAbs (  )  const [inline]

Get absolute allowed local tolerance

virtual void setToleranceAbs ( double  toleranceAbs  )  [inline, virtual]

Set absolute allowed local tolerance

Reimplemented in GslGenericSolver.

double toleranceRel (  )  const [inline]

Get relative allowed local tolerance

virtual void setToleranceRel ( double  toleranceRel  )  [inline, virtual]

Set relative allowed local tolerance

Reimplemented in GslGenericSolver.

double localError (  )  const [inline]

Get error estimation from last step

double localErrorRatio (  )  const [inline]

Get local tolerance calculated at last step

virtual void doCalcFn ( double *  t,
double  y[],
double  f[] = 0 
) [pure virtual]

Calculate function value

Implemented in GenericEulerSolver, and GslGenericSolver.

virtual bool doEvolve ( double *  t,
double  t1,
double  y[],
double  yerr[] 
) [pure virtual]

Integrate.

Parameters:
t Current time (will be updated by the new value)
t1 Target time
y[] Current function value
yerr[] Array to store local errors
Returns:
true on success, false on failure (too big local error)
Todo:
Provide error message

Implemented in GenericEulerSolver, and GslGenericSolver.

const QString& name (  )  const [inline, inherited]

Returns name of the object

void setName ( const QString &  name  )  [inline, inherited]

Set name of the object


The documentation for this class was generated from the following file:
Generated on Thu Mar 15 14:23:37 2007 for StepCore by  doxygen 1.5.1