#include <RK4.h>
Inheritance diagram for OSCAR::RK4:

Public Methods | |
| RK4 () | |
| RK4 (const RK4 &rhs) | |
| RK4 & | operator= (const RK4 &rhs) |
| virtual | ~RK4 () |
| Matrix | NumIntegrate (Vector(*function)(double t, Vector x), Vector &x0) |
| void | SetTimes (double tbegin=0, double tend=10) |
| void | SetStepSize (double timestep=0.1) |
| double | GetTimeEnd () |
| double | GetStepSize () |
| unsigned int | ResultLength () |
Protected Attributes | |
| double | tbegin |
| double | tend |
| double | timestep |
|
|
Default Contructor. Constructs an RK4 object |
|
|
Copy Contructor. Constructs a copy of an RK4 object from an existing RK4 object |
|
|
Virtual Destructor. This is the Destructor for an object of type RK4. |
|
|
used to get the time step over which we integrate
|
|
|
used to get the time through which we integrate
|
|
||||||||||||
|
Numerical Integator which takes a function pointer as its argument. The function must be declared as shown (for example:Vector feval(double tt,Vector xx);) could be the function prototype, where xx are the states and tt is the time. Vector &x0 are the initial conditions for states.Here is a sample function:. Vector VanDerPol(double t,Vector xx){ Vector xdot(2); xdot[0] = 5*(1-xx[1]*xx[1])*xx[0] - xx[1];//xddot xdot[1] = xx[0];//xdot return xdot;} Which can be called as: NumIntegrate(VanDerPol,x0); The matrix NumIntegrate returns is of size (ResultLength,ODE + 1). Use the result length function after setting the times and step size to get the number of rows for the matrix, the columns contain ODE + 1 because the matrix integrates all of the states, but also in the first column of the returned matrix will be the time vector.
|
|
|
= operator. Used for copying objects of type RK4
|
|
|
used to get the length of the solution vector this is used to get the number of rows for the solution matrix in NumIntegrate
|
|
|
used to set time step size for integration The default is 0.1.
|
|
||||||||||||
|
used to set times for starting and ending integration The default is to begin at time zero and end at 10, but anyting can be used.
|
|
|
|
|
|
|
|
|
|
| RRG Homepage | OSCAR Overview | OSCAR Tutorials | Simulations |