00001
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 #ifndef _RUNGEKUTTAFEHLBERGIVPODESOLVER_HPP_
00030 #define _RUNGEKUTTAFEHLBERGIVPODESOLVER_HPP_
00031
00032 #include <boost/serialization/access.hpp>
00033 #include <boost/serialization/base_object.hpp>
00034
00035 #include "AbstractOneStepIvpOdeSolver.hpp"
00036
00037
00038 #include <boost/serialization/export.hpp>
00039
00052 class RungeKuttaFehlbergIvpOdeSolver : public AbstractIvpOdeSolver
00053 {
00054 friend class TestRungeKuttaFehlbergIvpOdeSolver;
00055
00056 private:
00058 friend class boost::serialization::access;
00065 template<class Archive>
00066 void serialize(Archive & archive, const unsigned int version)
00067 {
00068
00069 archive & boost::serialization::base_object<AbstractIvpOdeSolver>(*this);
00070 }
00071
00072
00073
00074
00075
00076
00077 double m1932o2197;
00078 double m7200o2197;
00079 double m7296o2197;
00080 double m12o13;
00081 double m439o216;
00082 double m3680o513;
00083 double m845o4104;
00084 double m8o27;
00085 double m3544o2565;
00086 double m1859o4104;
00087 double m1o360;
00088 double m128o4275;
00089 double m2197o75240;
00090 double m2o55;
00091 double m25o216;
00092 double m1408o2565;
00093 double m2197o4104;
00095 std::vector<double> mError;
00097 std::vector<double> mk1;
00098 std::vector<double> mk2;
00099 std::vector<double> mk3;
00100 std::vector<double> mk4;
00101 std::vector<double> mk5;
00102 std::vector<double> mk6;
00103 std::vector<double> myk2;
00104 std::vector<double> myk3;
00105 std::vector<double> myk4;
00106 std::vector<double> myk5;
00107 std::vector<double> myk6;
00109 protected:
00110
00125 void InternalSolve(OdeSolution& rSolution,
00126 AbstractOdeSystem* pAbstractOdeSystem,
00127 std::vector<double>& rCurrentYValues,
00128 std::vector<double>& rWorkingMemory,
00129 double startTime,
00130 double endTime,
00131 double maxTimeStep,
00132 double minTimeStep,
00133 double tolerance,
00134 bool outputSolution);
00135
00146 void CalculateNextYValue(AbstractOdeSystem* pAbstractOdeSystem,
00147 double timeStep,
00148 double time,
00149 std::vector<double>& rCurrentYValues,
00150 std::vector<double>& rNextYValues);
00151
00162 void AdjustStepSize(double& rCurrentStepSize,
00163 const double& rError,
00164 const double& rTolerance,
00165 const double& rMaxTimeStep,
00166 const double& rMinTimeStep);
00167
00168 public:
00169
00173 RungeKuttaFehlbergIvpOdeSolver();
00174
00195 OdeSolution Solve(AbstractOdeSystem* pAbstractOdeSystem,
00196 std::vector<double>& rYValues,
00197 double startTime,
00198 double endTime,
00199 double timeStep,
00200 double ignoredSamplingTime);
00201
00217 void Solve(AbstractOdeSystem* pAbstractOdeSystem,
00218 std::vector<double>& rYValues,
00219 double startTime,
00220 double endTime,
00221 double timeStep);
00222
00223 };
00224
00225 BOOST_CLASS_EXPORT(RungeKuttaFehlbergIvpOdeSolver);
00226
00227 #endif //_RUNGEKUTTAFEHLBERGIVPODESOLVER_HPP_