mbsim  4.0.0
MBSim Kernel
odex_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 _ODEX_INTEGRATOR_H_
24#define _ODEX_INTEGRATOR_H_
25
26#include "root_finding_integrator.h"
27
28namespace MBSim {
29
33
34 private:
35
36 static void fzdot(int* n, double* t, double* z, double* zd, double* rpar, int* ipar);
37 static void plot(int* nr, double* told, double* t,double* z, int* n, double* con, int *ncon, int* icomp, int* nd, double* rpar, int* ipar, int* irtrn);
38
39 double tPlot{0};
40 double dtOut{0};
41 double s0;
42 double time{0};
43
45 fmatvec::Vec aTol;
47 fmatvec::Vec rTol;
49 double dt0{0};
51 int maxSteps{std::numeric_limits<int>::max()};
53 double dtMax{0};
54
55 bool drift { false };
56
57 std::exception_ptr exception;
58
59 public:
60
61 ~ODEXIntegrator() override = default;
62
63 const fmatvec::Vec& getAbsoluteTolerance() const { return aTol; }
64 const fmatvec::Vec& getRelativeTolerance() const { return rTol; }
65 double getInitialStepSize() const { return dt0; }
66 int getStepLimit() const { return maxSteps; }
67 double getMaximumStepSize() const { return dtMax; }
68
69 void setAbsoluteTolerance(const fmatvec::Vec &aTol_) { aTol <<= aTol_; }
70 void setAbsoluteTolerance(double aTol_) { aTol.resize(1,fmatvec::INIT,aTol_); }
71 void setRelativeTolerance(const fmatvec::Vec &rTol_) { rTol <<= rTol_; }
72 void setRelativeTolerance(double rTol_) { rTol.resize(1,fmatvec::INIT,rTol_); }
73 void setInitialStepSize(double dt0_) { dt0 = dt0_; }
74 void setStepLimit(int maxSteps_) { maxSteps = maxSteps_; }
75 void setMaximumStepSize(double dtMax_) { dtMax = dtMax_; }
76
78 void integrate() override;
79
80 void initializeUsingXML(xercesc::DOMElement *element) override;
81 };
82
83}
84
85#endif
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
ODE-Integrator ODEX.
Definition: odex_integrator.h:32
fmatvec::Vec aTol
Definition: odex_integrator.h:45
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: odex_integrator.cc:182
fmatvec::Vec rTol
Definition: odex_integrator.h:47
double dt0
Definition: odex_integrator.h:49
void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: odex_integrator.cc:280
double dtMax
Definition: odex_integrator.h:53
int maxSteps
Definition: odex_integrator.h:51
Integrator with root-finding.
Definition: root_finding_integrator.h:32
namespace MBSim
Definition: bilateral_constraint.cc:30