IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Num.DifferentialFirstOrderSystemBase Class Referenceabstract

Base class for definition of a system of first order ordinary differential equations (initial problem). More...

+ Inheritance diagram for IG.Num.DifferentialFirstOrderSystemBase:

Public Member Functions

 DifferentialFirstOrderSystemBase ()
 Construct a system of first order ordinary differential equations, without specifying the number of equations. More...
 
 DifferentialFirstOrderSystemBase (int numEquations)
 Constructs a new definition of a system of numEquations first order ordinary differential equations. More...
 
abstract void InitializeAndReset ()
 Initializes and resets the state of the current problem definition. More...
 
abstract void CalculateFunctionDerivatives (double parameter, double[] functionValues, double[] resultDerivatives)
 Calculates derivatives fo searched functions for specific values of independent parameter and function values. More...
 
abstract void GetInitialFunctionValues (double[] initialFunctionValues)
 Stores the initial function values (initial conditions) for the problem. More...
 
abstract double GetInitialParameter ()
 Returns the initial value of the parameter (independent variable). More...
 
abstract double GetFinalParameter ()
 Returns the final value of the parameter (independent variable). More...
 
abstract void SetNextStep (double parameter, double[] functionValues)
 Sets parameters and function values for the next step. More...
 
abstract void SaveState (double[] state)
 Saves state to the specified array. More...
 
abstract void RestoreState (double[] state)
 Restores state from the specified array. More...
 

Protected Attributes

int _numEquations
 
int _numStateVariables
 
bool _isHistoryDependent = false
 

Properties

virtual int NumEquations [get, protected set]
 Number of equations in the system of first order equations. More...
 
int NumStateVariables [get, set]
 Number of state variables, including independent variable and function values. More...
 
bool IsHistoryDependent [get, set]
 Flag indicating whether the problem is history dependent (meaning that it has additional state variables that are not calculated by the solver). More...
 

Detailed Description

Base class for definition of a system of first order ordinary differential equations (initial problem).

Notes on storing the current state:

Solver is only aware of the parameter (independent variable) and function values. These are stored separately (function values are stored in an array) and define the current state of the problem for the solver (beside the step number and step length).

Problem definition may include additional state variables. Current state of the problem includes the current parameter (independent variable) and function values and eventually some additional state variables (such a history variables) but exclude step number and step length.

Problem definition object stores its state into (or restores from) a packed state array. In this array, the first element is always the vlue of independent variable (problem parameter), followed by values of searched functions (solutions of the problem), followed by eventual additional state variables.

When saving the state from the solver, the solver packs the state into an array that includes the complete problem state (as vould be stored by the problem definition object) plus the step number and step length. Sometimes this array does not include all the data, e.g. it may exclude additional values of state variables of the problem definition object (this is when the state that is saved was not created by the problem definition object but by solver, which is not aware of the additional state variables). However, the order of the saved parameters is always the same as that of the problem definition object, only some data may be unavailable. The solver gets the number of problem state parameters from the problem definition object when it is initialized.

In view of the above, the order of values in the saved state array is as follows

- value of independent variable (problem parameter, e.g. time).

- valus of functions that are searched for

- eventual additional state variables of the problem; these have unspecified values when the saved state is packed merely by the solver, without assistance of the problem definition object.

- step number; this has unspecified value when the saved state is packed by the problem definition object, since it is not aware of the solver.

- step size used to calculate the saved state; this has unspecified value when the saved state is packed by the problem definition object, since it is not aware of the solver.

$A Igor Mar2009;

Constructor & Destructor Documentation

IG.Num.DifferentialFirstOrderSystemBase.DifferentialFirstOrderSystemBase ( )
inline

Construct a system of first order ordinary differential equations, without specifying the number of equations.

IG.Num.DifferentialFirstOrderSystemBase.DifferentialFirstOrderSystemBase ( int  numEquations)
inline

Constructs a new definition of a system of numEquations first order ordinary differential equations.

Parameters
numEquationsNumber of first order differential equations in the system.

Member Function Documentation

abstract void IG.Num.DifferentialFirstOrderSystemBase.InitializeAndReset ( )
pure virtual

Initializes and resets the state of the current problem definition.

All variables are set to initial values.

Any history dependent state variables are reset to the initial state.

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

abstract void IG.Num.DifferentialFirstOrderSystemBase.CalculateFunctionDerivatives ( double  parameter,
double[]  functionValues,
double[]  resultDerivatives 
)
pure virtual

Calculates derivatives fo searched functions for specific values of independent parameter and function values.

Parameters
parameterValue of independent parameters.
functionValuesFunction values.
resultDerivativesArray where corresponding derivatives are written. Must be allocated and of correct size.

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

abstract void IG.Num.DifferentialFirstOrderSystemBase.GetInitialFunctionValues ( double[]  initialFunctionValues)
pure virtual

Stores the initial function values (initial conditions) for the problem.

Parameters
initialFunctionValuesStores the initial function values to the specified array.

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

abstract double IG.Num.DifferentialFirstOrderSystemBase.GetInitialParameter ( )
pure virtual

Returns the initial value of the parameter (independent variable).

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

abstract double IG.Num.DifferentialFirstOrderSystemBase.GetFinalParameter ( )
pure virtual

Returns the final value of the parameter (independent variable).

Returns

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

abstract void IG.Num.DifferentialFirstOrderSystemBase.SetNextStep ( double  parameter,
double[]  functionValues 
)
pure virtual

Sets parameters and function values for the next step.

Additional state variables (e.g. history variables) are updated if applicable.

Parameters
parameterParameter values in the next step.
functionValuesFunction values in the next step.

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

abstract void IG.Num.DifferentialFirstOrderSystemBase.SaveState ( double[]  state)
pure virtual

Saves state to the specified array.

Parameters
stateArray where state variables are stored.

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

abstract void IG.Num.DifferentialFirstOrderSystemBase.RestoreState ( double[]  state)
pure virtual

Restores state from the specified array.

Parameters
stateArray from which state variables are reatored.

Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.

Member Data Documentation

int IG.Num.DifferentialFirstOrderSystemBase._numEquations
protected
int IG.Num.DifferentialFirstOrderSystemBase._numStateVariables
protected
bool IG.Num.DifferentialFirstOrderSystemBase._isHistoryDependent = false
protected

Property Documentation

virtual int IG.Num.DifferentialFirstOrderSystemBase.NumEquations
getprotected set

Number of equations in the system of first order equations.

int IG.Num.DifferentialFirstOrderSystemBase.NumStateVariables
getset

Number of state variables, including independent variable and function values.

bool IG.Num.DifferentialFirstOrderSystemBase.IsHistoryDependent
getset

Flag indicating whether the problem is history dependent (meaning that it has additional state variables that are not calculated by the solver).


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