MBSim

Project Page
theta_time_stepping_integrator.h
00001 /* Copyright (C) 2004-2009 MBSim Development Team
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  * Contact: martin.o.foerg@googlemail.com
00018  *          rzander@users.berlios.de
00019  */
00020 
00021 #ifndef _MU_TIME_STEPPING_INTEGRATOR_H_ 
00022 #define _MU_TIME_STEPPING_INTEGRATOR_H_
00023 
00024 #include "integrator.h"
00025 
00026 namespace MBSim {
00027 
00037   class ThetaTimeSteppingIntegrator : public Integrator { 
00038     public:
00042       ThetaTimeSteppingIntegrator();
00043 
00047       virtual ~ThetaTimeSteppingIntegrator() {}
00048 
00049       /* INHERITED INTERFACE OF INTEGRATOR */
00050       void integrate(DynamicSystemSolver& system);
00051       virtual void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00052       /***************************************************/
00053 
00054       /* GETTER / SETTER */
00055       void setStepSize(double dt_) { dt = dt_; }
00056       void setTheta(double theta_ ) { theta  = theta_; }
00057       void setDriftCompensation(bool dc) { driftCompensation = dc; }
00058       /***************************************************/
00059 
00066       void update(DynamicSystemSolver& system, const fmatvec::Vec& z, double t);
00067 
00072       void preIntegrate(DynamicSystemSolver& system);
00073       
00080       void subIntegrate(DynamicSystemSolver& system, double tStop);
00085       void postIntegrate(DynamicSystemSolver& system);
00086 
00087     private:
00091       double dt;
00092 
00096       double theta;
00097 
00101       double t, tPlot;
00102 
00106       int iter,step, integrationSteps, maxIter, sumIter;
00107 
00111       double s0, time;
00112 
00116       int stepPlot;
00117 
00121       fmatvec::Vec z, q, u, x;
00122 
00126       std::ofstream integPlot;
00127 
00131       bool driftCompensation;    
00132   };
00133 
00134 }
00135 
00136 #endif /* _MU_TIME_STEPPING_INTEGRATOR_H_ */
00137