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
31 class RKSuiteIntegrator : public RootFindingIntegrator {
32 public:
33 enum Method {
34 RK23=1,
35 RK45,
36 RK78,
37 unknownMethod
38 };
39
43 virtual ~RKSuiteIntegrator() override;
44
45 void preIntegrate() override;
46 void subIntegrate(double tStop) override;
47 void postIntegrate() override;
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 */
58 using Integrator::integrate;
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};
73 fmatvec::Vec thres;
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
MBSim::RKSuiteIntegrator
ODE-Integrator RKSuite.
Definition: rksuite_integrator.h:31
MBSim::RKSuiteIntegrator::initializeUsingXML
virtual void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: rksuite_integrator.cc:263
MBSim::RootFindingIntegrator
Integrator with root-finding.
Definition: root_finding_integrator.h:32
MBSim::RKSuiteIntegrator::thres
fmatvec::Vec thres
Definition: rksuite_integrator.h:73
MBSim::Integrator::integrate
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
MBSim::RKSuiteIntegrator::method
Method method
Definition: rksuite_integrator.h:71
MBSim::RKSuiteIntegrator::dt0
double dt0
Definition: rksuite_integrator.h:77
MBSim::RKSuiteIntegrator::rTol
double rTol
Definition: rksuite_integrator.h:75
MBSim::RKSuiteIntegrator::integrate
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: rksuite_integrator.cc:257
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30
MBSim::RKSuiteIntegrator::~RKSuiteIntegrator
virtual ~RKSuiteIntegrator() override
destructor
Definition: rksuite_integrator.cc:40