MBSim

Project Page
lsoder_integrator.h
00001 /* Copyright (C) 2004-2006  Martin Förg
00002  
00003  * This library is free software; you can redistribute it and/or 
00004  * modify it under the terms of the GNU Lesser General Public 
00005  * License as published by the Free Software Foundation; either 
00006  * version 2.1 of the License, or (at your option) any later version. 
00007  *  
00008  * This library is distributed in the hope that it will be useful, 
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011  * Lesser General Public License for more details. 
00012  *  
00013  * You should have received a copy of the GNU Lesser General Public 
00014  * License along with this library; if not, write to the Free Software 
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016 
00017  *
00018  * Contact:
00019  *   martin.o.foerg@googlemail.com
00020  *
00021  */
00022 
00023 #ifndef _LSODER_INTEGRATOR_H_
00024 #define _LSODER_INTEGRATOR_H_
00025 
00026 #include "integrator.h"
00027 
00028 namespace MBSimIntegrator {
00029 
00033   class LSODERIntegrator : public Integrator {
00034 
00035     private:
00036 
00037       static void fzdot(int* zSize, double* t, double* z_, double* zd_);
00038       static void fsv(int* zSize, double* t, double* z_, int* nsv, double* sv_);
00039 
00041       double dtMax;
00043       double dtMin;
00045       fmatvec::Vec aTol;
00047       double rTol;
00049       double dt0;
00050 
00051       bool plotOnRoot;
00052 
00053     public:
00054 
00055       LSODERIntegrator();
00056       ~LSODERIntegrator() {}
00057 
00058       void setMaximalStepSize(double dtMax_) {dtMax = dtMax_;}
00059       void setMinimalStepSize(double dtMin_) {dtMin = dtMin_;}
00060       void setAbsoluteTolerance(const fmatvec::Vec &aTol_) {aTol = aTol_;}
00061       void setAbsoluteTolerance(double aTol_) {aTol = fmatvec::Vec(1,fmatvec::INIT,aTol_);}
00062       void setRelativeTolernace(double rTol_) {rTol = rTol_;}
00063       void setInitialStepSize(double dt0_) {dt0 = dt0_;}
00064 
00065       void setPlotOnRoot(bool b) {plotOnRoot = b;}
00066 
00067       void integrate(MBSim::DynamicSystemSolver& system);
00068 
00069   };
00070 
00071 }
00072 
00073 
00074 #endif