All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
integrator.h
1 /* Copyright (C) 2004-2014 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 #include <fmatvec/fmatvec.h>
24 #include <fmatvec/atom.h>
25 #include <mbxmlutilshelper/dom.h>
26 #include <mbsim/mbsim_event.h>
27 #include <mbsim/solver.h>
28 #include <string>
29 #include <iostream>
30 
31 namespace MBSimIntegrator {
32 
33  const MBXMLUtils::NamespaceURI MBSIMINT("http://www.mbsim-env.de/MBSimIntegrator");
34 
40  class Integrator : public MBSim::Solver {
41  public:
45  Integrator();
46 
50  virtual ~Integrator() {};
51 
52  /* GETTER / SETTER */
53  void setStartTime(double tStart_) { tStart=tStart_; }
54  void setEndTime(double tEnd_) { tEnd = tEnd_; }
55  void setPlotStepSize(double dtPlot_) { dtPlot = dtPlot_; }
56  void setInitialState(const fmatvec::Vec &z0_) { z0 = z0_; }
57  void setWarnLevel(int level) { warnLevel = level; }
58  void setOutput(bool flag) { output = flag; }
59  double getStartTime() const { return tStart; }
60  double getEndTime() const { return tEnd; }
61  double getPlotStepSize() const { return dtPlot; }
62  const fmatvec::Vec& getInitialState() const { return z0; }
63  int getWarnLevel() const { return warnLevel; }
64  bool getOutput() const { return output; }
65  /***************************************************/
66 
68 
69  /* INTERFACE FOR DERIVED CLASSES */
75  virtual void integrate(MBSim::DynamicSystemSolver& system) = 0;
76 
82  void debugInit();
83 
84  virtual void preIntegrate(MBSim::DynamicSystemSolver& system) { throw MBSim::MBSimError("preIntegrate is not defined"); }
85  virtual void subIntegrate(MBSim::DynamicSystemSolver& system, double tStop) { throw MBSim::MBSimError("subIntegrate is not defined"); }
86  virtual void postIntegrate(MBSim::DynamicSystemSolver& system) { throw MBSim::MBSimError("postIntegrate is not defined"); }
87 
92  virtual void initializeUsingXML(xercesc::DOMElement *element);
93 
94  static Integrator* readXMLFile(const std::string &filename);
95 
96  /***************************************************/
97 
101  virtual std::string getType() const { return "Integrator"; }
102 
103 // static void plot(const fmatvec::Vec& z, double t);
104 
105  protected:
109  double tStart, tEnd, dtPlot;
110 
115 
120 
124  bool output;
125 
129  std::string name;
130 
131  };
132 
133 }
134 
135 #endif /* _INTEGRATOR_H_ */
136 
void debugInit()
Definition: integrator.cc:58
solver-interface for dynamic systems
Definition: solver.h:38
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:48
virtual ~Integrator()
destructor
Definition: integrator.h:50
fmatvec::Vec z0
initial state
Definition: integrator.h:114
virtual void integrate(MBSim::DynamicSystemSolver &system)=0
start the integration
Integrator()
constructor
Definition: integrator.cc:34
virtual std::string getType() const
Definition: integrator.h:101
void execute(MBSim::DynamicSystemSolver &system)
start solving the dynamic system
Definition: integrator.h:67
bool output
flag for ouput printing
Definition: integrator.h:124
std::string name
name of integrator
Definition: integrator.h:129
int warnLevel
warn level
Definition: integrator.h:119
double tStart
start, end, plot time
Definition: integrator.h:109
basic error class for mbsim
Definition: mbsim_event.h:38
integrator-interface for dynamic systems
Definition: integrator.h:40
static DynamicSystemSolver * system
dynamic system
Definition: solver.h:65
virtual void initializeUsingXML(xercesc::DOMElement *element)
initialize integrator
Definition: integrator.cc:36

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML