YANE-Framework 1.1.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

yane::OdeSolve::OdeConfig Class Reference

Class of configuration possibilities for the differential equation solvers. More...

Inheritance diagram for yane::OdeSolve::OdeConfig:
[legend]
Collaboration diagram for yane::OdeSolve::OdeConfig:
[legend]

List of all members.

Public Member Functions

virtual OdeConfigclone ()
 Function to clone the current yane::OdeSolve::OdeConfig object.
yane::Utils::UuidconfigID ()
 Function to obtain the ID of the current configuration.
void copyTo (OdeConfig *target)
 Function to copy default data to a supplied configuration object.
void getInitialStepsize (double &hinit)
 Function to obtain the initial step size of the used solution method for differential equations.
void getMaxSteps (int &steps)
 Function to obtain the current maximal number of steps allowed for the step size control methods.
void getMaxStepsize (double &stepsize)
 Function to obtain the maximal step size length.
void getSafetyFactor (double &safetyfactor)
 Function to obtain the safety factor used within the step size control method.
void getStepsizeSelectionParameters (double &fac1, double &fac2)
 Function to obtain the bounds for the allowed change in the step size.
void getTolerance (double &rtol, double &atol)
 Function to obtain the error tolerances.
void getToleranceVector (double *&rtol, double *&atol)
 Function to obtain the vectors of currently used error tolerances.
 OdeConfig ()
 Constructor setting all data to default values.
void setInitialStepsize (double hinit=0.0)
 Function to set the initial step size.
void setMaxSteps (int steps=10000000)
 Function to set the maximal numer of allowed.
void setMaxStepsize (double stepsize=0.0)
 Function to set the maximal step size length.
void setSafetyFactor (double safetyfactor=0.9)
 Function to set the safety factor used within the step size control method.
void setStepsizeSelectionParameters (double fac1=0.2, double fac2=10.0)
 Function to set the bounds for the allowed change in the step size

\[ \mbox{fac}_1 \leq \frac{h_{new}}{h_{old}} \leq \mbox{fac}_2 \]

.

void setTolerance (double rtol=1E-6, double atol=1E-6)
 Function to set scalar error tolerances for the adaptive step size control algorithms.
void setToleranceVector (double *rtol=0, double *atol=0)
 Function to set the vectors of error tolerances for the adaptive step size control algorithms.
virtual ~OdeConfig ()
 Destructor.

Static Public Member Functions

static void assertValidConfigObject (OdeConfig *config)
 Static function to check validity of the supplied configuration object.

Protected Member Functions

virtual void copyToNoInvalidation (OdeConfig *target)
 Function to copy all internal configuration data to the supplied configuration object.
void invalidateOldConfig ()
 Function to change the ID of the configuration object.

Protected Attributes

double _atol
 Absolute Tolerance.
double * _atol_vec
 Vector of absolute Tolerances.
double _initial_stepsize
 Initial step size.
int _max_steps
 Maximal number of steps of the iterative method.
double _max_stepsize
 Maximal step size.
double _rtol
 Relative tolerance.
double * _rtol_vec
 Vector of relative Tolerances.
double _safety_factor
 Safty factor.
yane::Utils::Uuid_setting_uuid
 ID of the yane::OdeSolve::OdeConfig object.
double _ss_fac1
 Lower bound for the change of the step size.
double _ss_fac2
 Upper bound for the change of the step size.

Detailed Description

This class can be used to access all the configuration possibilities of the differential equation solvers. On construction of an object of this class the configuration data is set to default values which are reasonable for standard usage. These values, however, should be adapted to the model to achieve efficiency and performance.


Constructor & Destructor Documentation

LIB_EXPORT yane::OdeSolve::OdeConfig::OdeConfig ( )

This function is the constructor of the class yane::OdeSolve::OdeConfig and initializes every constructed object of this type with default values for all configuration variables.


Member Function Documentation

LIB_EXPORT void yane::OdeSolve::OdeConfig::assertValidConfigObject ( OdeConfig config) [static]

This function is a static method which allows a solver to guarantee that the pointer of a yane::OdeSolve::OdeConfig object reveals a valid configuration object.
Each solver, for which a yane::OdeSolve::OdeConfig object has been implemented, must make sure that such a configuration object has been supplied to it. To this end this method must be overloaded in the derived yane::OdeSolve::OdeConfig class and this method must check whether the keyelement of the supplied configuration object is an element of the set of keys of this class.

Parameters:
configConfiguration object to be checked

Reimplemented in yane::OdeSolve::DoPriConfig, yane::OdeSolve::Radau5913Config, yane::OdeSolve::RadauConfig, and yane::OdeSolve::RodasConfig.

LIB_EXPORT yane::OdeSolve::OdeConfig * yane::OdeSolve::OdeConfig::clone ( ) [virtual]

This function can be used to clone the current yane::OdeSolve::OdeConfig object.

Returns:
Cloned yane::OdeSolve::OdeConfig object

Reimplemented in yane::OdeSolve::DoPriConfig, yane::OdeSolve::Radau5913Config, yane::OdeSolve::RadauConfig, and yane::OdeSolve::RodasConfig.

LIB_EXPORT yane::Utils::Uuid * yane::OdeSolve::OdeConfig::configID ( )

This function can be used to obtain the ID of the current configuration. If one data values has been changed, then the ID is modified. Using this ID the solver can automatically recognize that it has to update itself using the new values.

Returns:
ID of the current configuration
LIB_EXPORT void yane::OdeSolve::OdeConfig::copyTo ( OdeConfig target)

This function can be used to copy current data of the object to a (different) supplied configuration object. It automatically resets the ID of the supplied object.

Parameters:
targetConfiguration object which shall be configured
LIB_EXPORT void yane::OdeSolve::OdeConfig::copyToNoInvalidation ( OdeConfig target) [protected, virtual]

This function copies all internal configuration data to the supplied configuration object.

Parameters:
targetConfiguration object to hold data of calling yane::OdeSolve::OdeConfig object

Reimplemented in yane::OdeSolve::DoPriConfig, yane::OdeSolve::Radau5913Config, yane::OdeSolve::RadauConfig, and yane::OdeSolve::RodasConfig.

LIB_EXPORT void yane::OdeSolve::OdeConfig::getInitialStepsize ( double &  hinit)

This function can be used to obtain the initial step size of the used solution method for differential equations.

Parameters:
hinitInitial step size
See also:
setInitialStepsize
LIB_EXPORT void yane::OdeSolve::OdeConfig::getMaxSteps ( int &  steps)

This function can be used to obtain the current maximal number of steps allowed for the step size control methods.

Parameters:
stepsMaximal number of computation steps of the differential equation solver
See also:
setMaxSteps
LIB_EXPORT void yane::OdeSolve::OdeConfig::getMaxStepsize ( double &  stepsize)

This function can be used to obtain the maximal set size length.

Parameters:
stepsizeMaximal step size length
See also:
setMaxStepsize
LIB_EXPORT void yane::OdeSolve::OdeConfig::getSafetyFactor ( double &  safetyfactor)

This function can be used to obtain the safety factor used within the step size control method.

Parameters:
safetyfactorSafety factor
See also:
setSafetyFactor
LIB_EXPORT void yane::OdeSolve::OdeConfig::getStepsizeSelectionParameters ( double &  fac1,
double &  fac2 
)

This function can be used to obtain the bounds for the allowed change in the step size.

Parameters:
fac1Lower bound
fac2Upper bound
See also:
setStepsizeSelectionParameters
LIB_EXPORT void yane::OdeSolve::OdeConfig::getTolerance ( double &  rtol,
double &  atol 
)

This function can be used to obtain the currently used error tolerances

Parameters:
rtolRelative tolerance
atolAbsolute tolerance
See also:
setTolerance
LIB_EXPORT void yane::OdeSolve::OdeConfig::getToleranceVector ( double *&  rtol,
double *&  atol 
)

This function can be used to obtain the vectors of currently used error tolerances

Parameters:
rtolPointer of the relative error tolerance vector
atolPointer of the absolute error tolerance vector
See also:
setToleranceVector
LIB_EXPORT void yane::OdeSolve::OdeConfig::invalidateOldConfig ( ) [protected]

This function changes the ID of the configuration object. Hence, all solvers which use this configuration object will notice that they need to be reconfigured using the new configuration data. Each derived class must call this method if any of its set-methods is called.

LIB_EXPORT void yane::OdeSolve::OdeConfig::setInitialStepsize ( double  hinit = 0.0)

This function sets the initial step size which is used upon start of the used solution method for differential equations. If the value is set to zero then a guess for the initial step size is computed numerically.

Parameters:
hinitInitial step size
Exceptions:
WrongSolverInputExceptionIs thrown if unapplicable data values are supplied
See also:
getInitialStepsize
LIB_EXPORT void yane::OdeSolve::OdeConfig::setMaxSteps ( int  steps = 10000000)

This function sets the maximal number of allowed integration steps of the differential equation solver. If a computation requires more iteration steps then the method yane::OdeSolve::OdeSolve::calc is terminated with exception yane::OdeSolve::TooManyStepsException.

Parameters:
stepsMaximal number of computation steps of the differential equation solver
Exceptions:
WrongSolverInputExceptionIs thrown if unapplicable data values are supplied
See also:
getMaxSteps
LIB_EXPORT void yane::OdeSolve::OdeConfig::setMaxStepsize ( double  stepsize = 0.0)

This function sets the maximal step size length. If zero is supplied to this method, then the maximal step size is set to the length of the integration interval.

Parameters:
stepsizeMaximal step size length
Exceptions:
WrongSolverInputExceptionIs thrown if unapplicable data values are supplied
See also:
getMaxStepsize
LIB_EXPORT void yane::OdeSolve::OdeConfig::setSafetyFactor ( double  safetyfactor = 0.9)

This function sets the safety factor used within the step size control method.

Parameters:
safetyfactorSafety factor
See also:
getSafetyFactor
Exceptions:
WrongSolverInputExceptionIs thrown if unapplicable data values are supplied
LIB_EXPORT void yane::OdeSolve::OdeConfig::setStepsizeSelectionParameters ( double  fac1 = 0.2,
double  fac2 = 10.0 
)

This function sets the bounds for the allowed change in the step size. Within the algorithms the condition

\[ \mbox{fac}_1 \leq \frac{h_{new}}{h_{old}} \leq \mbox{fac}_2 \]

is checked and the new step size is set accordingly.

Parameters:
fac1Lower bound
fac2Upper bound
Exceptions:
WrongSolverInputExceptionIs thrown if unapplicable data values are supplied
See also:
getStepsizeSelectionParameters
LIB_EXPORT void yane::OdeSolve::OdeConfig::setTolerance ( double  rtol = 1E-6,
double  atol = 1E-6 
)

This function sets scalar error tolerances for the adaptive step size control algorithms.

Parameters:
rtolRelative tolerance
atolAbsolute tolerance
See also:
getTolerance
Exceptions:
WrongSolverInputExceptionIs thrown if unapplicable data values are supplied
LIB_EXPORT void yane::OdeSolve::OdeConfig::setToleranceVector ( double *  rtol = 0,
double *  atol = 0 
)

This function sets vectors of error tolerances for the adaptive step size control algorithms. Here, the dimension of the vectors of error tolerances are required to be identical to the dimension of the state variable.
If a null pointer is supplied to this routine, then the usage of error tolerance vectors is switched to scalar error tolerances base on the internally stored values.

Parameters:
rtolPointer of the relative error tolerances
atolPointer of the absolute error tolerances
Exceptions:
WrongSolverInputExceptionIs thrown if unapplicable data values are supplied
See also:
getToleranceVector