All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
dopri5_integrator.h
1 /* Copyright (C) 2004-2006 Martin Förg
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  *
18  * Contact:
19  * martin.o.foerg@googlemail.com
20  *
21  */
22 
23 #ifndef _DOPRI5_INTEGRATOR_H_
24 #define _DOPRI5_INTEGRATOR_H_
25 
26 #include "integrator.h"
27 
28 namespace MBSimIntegrator {
29 
33  class DOPRI5Integrator : public Integrator {
34 
35  private:
36 
37  static void fzdot(int* n, double* t, double* z, double* zd, double* rpar, int* ipar);
38  static void plot(int* nr, double* told, double* t,double* z, int* n, double* con, int* icomp, int* nd, double* rpar, int* ipar, int* irtrn);
39 
40  static double tPlot;
41  static double dtOut;
42  static bool output_;
43  static std::ofstream integPlot;
44  static double s0;
45  static double time;
46  //static int integrationSteps;
47 
53  double dt0;
55  int maxSteps;
57  double dtMax;
58 
59  public:
60 
62  ~DOPRI5Integrator() {}
63 
64  void setAbsoluteTolerance(const fmatvec::Vec &aTol_) {aTol = aTol_;}
65  void setAbsoluteTolerance(double aTol_) {aTol = fmatvec::Vec(1,fmatvec::INIT,aTol_);}
66  void setRelativeTolerance(const fmatvec::Vec &rTol_) {rTol = rTol_;}
67  void setRelativeTolerance(double rTol_) {rTol = fmatvec::Vec(1,fmatvec::INIT,rTol_);}
68  void setInitialStepSize(double dt0_) {dt0 = dt0_;}
69  void setMaxStepNumber(int maxSteps_) {maxSteps = maxSteps_;}
70  void setMaximalStepSize(double dtMax_) {dtMax = dtMax_;}
71  const fmatvec::Vec& getAbsoluteTolerance() const { return aTol; }
72  const fmatvec::Vec& getRelativeTolerance() const { return rTol; }
73  double getInitialStepSize() const { return dt0; }
74  int getMaxStepNumber() const { return maxSteps; }
75  double getMaximalStepSize() const { return dtMax; }
76 
78 
79  virtual void initializeUsingXML(xercesc::DOMElement *element);
80 
81  virtual std::string getType() const { return "DOPRI5Integrator"; }
82  };
83 
84 }
85 
86 #endif
virtual std::string getType() const
Definition: dopri5_integrator.h:81
ODE-Integrator DOPRI5.
Definition: dopri5_integrator.h:33
Vector< Ref, double > Vec
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:48
double dtMax
Definition: dopri5_integrator.h:57
fmatvec::Vec aTol
Definition: dopri5_integrator.h:49
double dt0
Definition: dopri5_integrator.h:53
virtual void initializeUsingXML(xercesc::DOMElement *element)
initialize integrator
Definition: dopri5_integrator.cc:169
fmatvec::Vec rTol
Definition: dopri5_integrator.h:51
int maxSteps
Definition: dopri5_integrator.h:55
integrator-interface for dynamic systems
Definition: integrator.h:40
void integrate(MBSim::DynamicSystemSolver &system)
start the integration
Definition: dopri5_integrator.cc:83
static DynamicSystemSolver * system
dynamic system
Definition: solver.h:65

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML