IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Base class for definition of a system of first order ordinary differential equations (initial problem). More...
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... | |
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;
|
inline |
Construct a system of first order ordinary differential equations, without specifying the number of equations.
|
inline |
Constructs a new definition of a system of numEquations first order ordinary differential equations.
numEquations | Number of first order differential equations in the system. |
|
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.
|
pure virtual |
Calculates derivatives fo searched functions for specific values of independent parameter and function values.
parameter | Value of independent parameters. |
functionValues | Function values. |
resultDerivatives | Array where corresponding derivatives are written. Must be allocated and of correct size. |
Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.
|
pure virtual |
Stores the initial function values (initial conditions) for the problem.
initialFunctionValues | Stores the initial function values to the specified array. |
Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.
|
pure virtual |
Returns the initial value of the parameter (independent variable).
Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.
|
pure virtual |
Returns the final value of the parameter (independent variable).
Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.
|
pure virtual |
Sets parameters and function values for the next step.
Additional state variables (e.g. history variables) are updated if applicable.
parameter | Parameter values in the next step. |
functionValues | Function values in the next step. |
Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.
|
pure virtual |
Saves state to the specified array.
state | Array where state variables are stored. |
Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.
|
pure virtual |
Restores state from the specified array.
state | Array from which state variables are reatored. |
Implemented in IG.Num.DifferentialHarmonicOscillation, and IG.Num.DiffLorenzOscillator.
|
protected |
|
protected |
|
protected |
|
getprotected set |
Number of equations in the system of first order equations.
|
getset |
Number of state variables, including independent variable and function values.
|
getset |
Flag indicating whether the problem is history dependent (meaning that it has additional state variables that are not calculated by the solver).