mbsim  4.0.0
MBSim Kernel
rksuite_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 _RKSUITE_INTEGRATOR_H_
21 #define _RKSUITE_INTEGRATOR_H_
22 
23 #include "root_finding_integrator.h"
24 
25 namespace MBSim {
26 
32  public:
33  enum Method {
34  RK23=1,
35  RK45,
36  RK78,
37  unknownMethod
38  };
39 
43  virtual ~RKSuiteIntegrator() override;
44 
45  void preIntegrate();
46  void subIntegrate(double tStop);
47  void postIntegrate();
48 
49  /* GETTER / SETTER */
50  void setMethod(Method method_) { method = method_; }
51  void setRelativeTolerance(double rTol_) { rTol = rTol_; }
52  void setThreshold(const fmatvec::Vec &thres_) { thres <<= thres_; }
53  void setThreshold(double thres_) { thres.resize(1,fmatvec::INIT,thres_); }
54  void setInitialStepSize(double dt0_) { dt0 = dt0_; }
55  /***************************************************/
56 
57  /* INHERITED INTERFACE OF INTEGRATOR */
59  void integrate() override;
60  virtual void initializeUsingXML(xercesc::DOMElement *element) override;
61  /***************************************************/
62 
63  private:
64 
65  static void fzdot(double* t, double* z_, double* zd_);
66 
67  int zSize;
68  static RKSuiteIntegrator *selfStatic;
69 
71  Method method{RK45};
75  double rTol{1e-6};
77  double dt0{0};
78 
79  int lenwrk, messages{0}, integrationSteps{0}, lenint;
80  double t{0}, tPlot{0}, s0{0}, time{0};
81  double *work{nullptr};
82  double *workint{nullptr};
83  fmatvec::Vec z, zd, zMax, zWant, zdWant;
84  };
85 
86 }
87 
88 #endif
ODE-Integrator RKSuite.
Definition: rksuite_integrator.h:31
virtual void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: rksuite_integrator.cc:260
Integrator with root-finding.
Definition: root_finding_integrator.h:32
fmatvec::Vec thres
Definition: rksuite_integrator.h:73
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Method method
Definition: rksuite_integrator.h:71
double dt0
Definition: rksuite_integrator.h:77
double rTol
Definition: rksuite_integrator.h:75
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: rksuite_integrator.cc:254
namespace MBSim
Definition: eigenanalyzer.cc:47
virtual ~RKSuiteIntegrator() override
destructor
Definition: rksuite_integrator.cc:40