mbsim  4.0.0
MBSim Kernel
seulex_integrator.h
1/* Copyright (C) 2004-2018 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 _SEULEX_INTEGRATOR_H_
24#define _SEULEX_INTEGRATOR_H_
25
26#include "dae_integrator.h"
27
28namespace MBSim {
29
33
34 private:
35 double delta(int i, double z) const override;
36 typedef void (*Fzdot)(int* n, double* t, double* y, double* yd, double* rpar, int* ipar);
37 typedef void (*Jac)(int* n, double *t, double *y, double *J, int *nn, double *rpar, int *ipar);
38 typedef void (*Mass)(int* n, double* m, int* lmas, double* rpar, int* ipar);
39 static Fzdot fzdot[2];
40 static Jac jac[2];
41 static Mass mass[2];
42 static void fzdotODE(int* n, double* t, double* z, double* zd, double* rpar, int* ipar);
43 static void fzdotDAE1(int* n, double* t, double* y, double* yd, double* rpar, int* ipar);
44 static void jacODE(int* n, double *t, double *z, double *J, int *nn, double *rpar, int *ipar);
45 static void jacDAE1(int* n, double *t, double *y, double *J, int *nn, double *rpar, int *ipar);
46 static void massFull(int* n, double* m, int* lmas, double* rpar, int* ipar);
47 static void massReduced(int* n, double* m, int* lmas, double* rpar, int* ipar);
48 static void plot(int* nr, double* told, double* x, double *y, double *rc, int* lrc, int* ic, int* lic, int* n, double* rpar, int* ipar, int* irtrn);
49
50 void init() override;
51 void reinit() override;
52
53 double tPlot{0};
54 double dtOut{0};
55 double s0;
56 double time{0};
57
59 double dt0{0};
61 int maxSteps{std::numeric_limits<int>::max()};
63 double dtMax{0};
65 bool autonom{false};
66
67 int mlJac, muJac;
68 fmatvec::VecInt iWork;
69 fmatvec::Vec work;
70
71 bool drift { false };
72
73 std::exception_ptr exception;
74
75 public:
76 ~SEULEXIntegrator() override = default;
77
78 void setInitialStepSize(double dt0_) { dt0 = dt0_; }
79 void setMaximumStepSize(double dtMax_) { dtMax = dtMax_; }
80 void setStepLimit(int maxSteps_) { maxSteps = maxSteps_; }
81 void setAutonomousSystem(bool autonom_) { autonom = autonom_; }
82
84 void integrate() override;
85
86 void initializeUsingXML(xercesc::DOMElement *element) override;
87 };
88
89}
90
91#endif
Base class for all DAE integrators.
Definition: dae_integrator.h:33
virtual void integrate()=0
start the integration of the system set by setSystem. Each class implemeting this function should cal...
DAE-Integrator SEULEX.
Definition: seulex_integrator.h:32
double dt0
Definition: seulex_integrator.h:59
int maxSteps
Definition: seulex_integrator.h:61
double dtMax
Definition: seulex_integrator.h:63
void integrate() override
start the integration of the system set by setSystem. Each class implemeting this function should cal...
Definition: seulex_integrator.cc:328
bool autonom
Definition: seulex_integrator.h:65
void initializeUsingXML(xercesc::DOMElement *element) override
initialize integrator
Definition: seulex_integrator.cc:479
namespace MBSim
Definition: bilateral_constraint.cc:30