RKF45method.h

00001 //
00002 //#####################################################################
00003 //                          RKF45method.h 
00004 //#####################################################################
00005 /*! 
00006     \class RKF45method 
00007     \brief RKF45method is a  class for creating approximate 
00008     solutions of systems of autonomous ordinary differential equations using 
00009     an implementation of the Runge-Kutta Fehlberg method of order 4 and 5.  
00010   
00011    <p>The solution procedure is a  Runge-Kutta Fehlberg method whose 
00012    mplementation is provided by the routine rkf45 written by 
00013    H.A. Watts and L.F. Shampine at Sandia Laboratories, 
00014    Albuquerque, New Mexico. 
00015  
00016    <p>The version used is an f2c translation of the fortran routine 
00017    obtained from www.netlib.org. This translated version has
00018    been appended with the f2c support routines required for 
00019    compilation (so that the complete f2c support libraries need
00020    not be included). 
00021    <p>
00022        
00023    @author Chris Anderson 
00024    @version 01/22/09
00025 */ 
00026 //
00027 //#####################################################################
00028 // Chris Anderson (C) UCLA                             Jan. 22, 2009
00029 //#####################################################################
00030 //
00031 #include "VectorFunction.h"
00032 #include "DoubleVector.h"
00033 
00034 #ifndef __RKF45method__
00035 #define __RKF45method__
00036 
00037 class RKF45method
00038 {
00039 
00040 public : 
00041 
00042     RKF45method();
00043 
00044     /// Sets the relative and absolute error tolerance of the solution value after one step of size dt
00045     
00046     void   setErrorTolerance(double tol);
00047     
00048     /// Returns the current error tolerance 
00049     
00050     double getErrorTolerance() const;
00051  
00052     /// Returns the error code associated with the RK 45 procedure 
00053     
00054     int    getErrorCode() const;
00055     
00056     /// The value of yk is updated with the solution of the ODE starting from yk and advancing one timestep dt.
00057     
00058     int  advance(DoubleVector& yk, double dt, VectorFunction* fPtr);
00059     
00060 protected :
00061 
00062 
00063     double errorTolerance;
00064     int         errorCode;
00065 
00066 };
00067 #endif

Generated on Fri Jan 23 08:16:07 2009 for RKF45 by  doxygen 1.5.1-p1