00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _LSODAR_INTEGRATOR_H_
00024 #define _LSODAR_INTEGRATOR_H_
00025
00026 #include "integrator.h"
00027
00028 namespace MBSim {
00029
00033 class LSODARIntegrator : public Integrator {
00034 private:
00035
00036 static void fzdot(int* zSize, double* t, double* z_, double* zd_);
00037 static void fsv(int* zSize, double* t, double* z_, int* nsv, double* sv_);
00038
00040 double dtMax;
00042 double dtMin;
00044 fmatvec::Vec aTol;
00046 double rTol;
00048 double dt0;
00049
00050 bool plotOnRoot;
00051
00052 int zSize, iTol, istate, nsv, lrWork, liWork, integrationSteps;
00053 double t, tPlot, s0, time;
00054 fmatvec::Vec z, rWork;
00055 fmatvec::VecInt iWork, jsv;
00056 std::ofstream integPlot;
00057 public:
00058
00059 LSODARIntegrator();
00060 ~LSODARIntegrator() {}
00061
00062 void setMaximalStepSize(double dtMax_) {dtMax = dtMax_;}
00063 void setMinimalStepSize(double dtMin_) {dtMin = dtMin_;}
00064 void setAbsoluteTolerance(const fmatvec::Vec &aTol_) {aTol = aTol_;}
00065 void setAbsoluteTolerance(double aTol_) {aTol = fmatvec::Vec(1,fmatvec::INIT,aTol_);}
00066 void setRelativeTolerance(double rTol_) {rTol = rTol_;}
00067 void setInitialStepSize(double dt0_) {dt0 = dt0_;}
00068
00069 void setPlotOnRoot(bool b) {plotOnRoot = b;}
00070
00071 void integrate(DynamicSystemSolver& system);
00072 void preIntegrate(DynamicSystemSolver& system);
00073 void subIntegrate(DynamicSystemSolver& system, double tStop);
00074 void postIntegrate(DynamicSystemSolver& system);
00075
00076 virtual void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00077 virtual MBXMLUtils::TiXmlElement* writeXMLFile(MBXMLUtils::TiXmlNode *element);
00078
00079 virtual std::string getType() const { return "LSODARIntegrator"; }
00080 };
00081
00082 }
00083
00084 #endif