00001 #pragma ident "$Id: RungeKutta4.hpp 1957 2009-06-19 14:39:39Z afarris $"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef GPSTK_RUNGEKUTTA4_H
00037 #define GPSTK_RUNGEKUTTA4_H
00038
00039 #include "Matrix.hpp"
00040
00041 namespace gpstk
00042 {
00043
00046
00050 class RungeKutta4
00051 {
00052 public:
00060 RungeKutta4(const Matrix<double>& initialState,
00061 double initialTime=0,
00062 double timeEpsilon=1e-18)
00063 : currentState(initialState), currentTime(initialTime),
00064 teps(timeEpsilon), M(initialState.rows()), N(initialState.cols()),
00065 k1(M,N), k2(M,N), k3(M,N), k4(M,N), yn(M,N), tempy(M,N)
00066 { }
00067
00074 void integrateTo (double nextTime,
00075 double stepSize = 0);
00076
00087 void integrateTo (double nextTime,
00088 Matrix<double>& error,
00089 double stepSize = 0);
00090
00097 virtual gpstk::Matrix<double>&
00098 derivative(long double time,
00099 const gpstk::Matrix<double>& inState,
00100 gpstk::Matrix<double>& inStateDot) = 0;
00101
00103 double getTime(void)
00104 { return currentTime; }
00105
00107 const Matrix<double>& getState(void)
00108 { return currentState; }
00109
00110 protected:
00111
00113 double currentTime;
00114
00116 gpstk::Matrix<double> currentState;
00117
00118 double teps;
00119 int M;
00120 int N;
00121
00122 private:
00123
00125 RungeKutta4(const RungeKutta4& cloneDonor);
00126
00128 RungeKutta4& operator= (const RungeKutta4& right);
00129
00134 Matrix<double> k1, k2, k3, k4, yn, tempy;
00135
00136 };
00137
00139
00140 }
00141
00142 #endif
00143
00144