MBSim

Project Page
integrator.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _INTEGRATOR_H_
21 #define _INTEGRATOR_H_
22 
23 #define MBSIMINTNS "{http://mbsim.berlios.de/MBSimIntegrator}"
24 
25 #include<fmatvec.h>
26 #include"mbsimtinyxml/tinyxml-src/tinyxml.h"
27 #include<string>
28 #include<iostream>
29 
30 namespace MBSim {
31 
32  class DynamicSystemSolver;
33 
39  class Integrator {
40  public:
44  Integrator();
45 
49  virtual ~Integrator() {};
50 
51  /* GETTER / SETTER */
52  void setStartTime(double tStart_) { tStart=tStart_; }
53  void setEndTime(double tEnd_) { tEnd = tEnd_; }
54  void setPlotStepSize(double dtPlot_) { dtPlot = dtPlot_; }
55  void setInitialState(const fmatvec::Vec &z0_) { z0 = z0_; }
56  void setWarnLevel(int level) { warnLevel = level; }
57  void setOutput(bool flag) { output = flag; }
58  double getStartTime() { return tStart; }
59  /***************************************************/
60 
61  /* INTERFACE FOR DERIVED CLASSES */
66  virtual void integrate(DynamicSystemSolver& system) = 0;
67 
68  virtual void preIntegrate(DynamicSystemSolver& system) { std::cout<<"preIntegrate is not defined\n"<<std::endl; }
69  virtual void subIntegrate(DynamicSystemSolver& system, double tStop) { std::cout<<"subIntegrate is not defined\n"<<std::endl; }
70  virtual void postIntegrate(DynamicSystemSolver& system) { std::cout<<"postIntegrate is not defined\n"<<std::endl; }
71 
76  virtual void initializeUsingXML(TiXmlElement *element);
77  /***************************************************/
78 
79  protected:
84 
88  double tStart, tEnd, dtPlot;
89 
93  fmatvec::Vec z0;
94 
98  int warnLevel;
99 
103  bool output;
104 
108  std::string name;
109 
110  };
111 
112 }
113 
114 #endif /* _INTEGRATOR_H_ */
115