mbsim  4.0.0
MBSim Kernel
boost_odeint_integrator_predef.h
1 /* Copyright (C) 2017 Markus Friedrich
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 #include "boost_odeint_integrator.h"
19 
20 // runge_kutta_dopri5<Vec>
21 #include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
22 #include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp>
23 
24 // bulirsch_stoer<Vec>
25 #include <boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp>
26 
27 // euler<Vec>
28 #include <boost/numeric/odeint/stepper/euler.hpp>
29 
30 // rosenbrock4<double>
31 #include <boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp>
32 
33 namespace MBSim {
34 
35  namespace BoostOdeintHelper {
36 
37  // Definition of concepts of DOS. (see header file BoostOdeintDOS)
38 
39 
40 
41  // runge_kutta_dopri5<Vec>
42 
43  // type definitions
44  typedef boost::numeric::odeint::runge_kutta_dopri5<fmatvec::Vec> RKDOPRI5Stepper;
45  typedef boost::numeric::odeint::controlled_runge_kutta<RKDOPRI5Stepper> ControlledRK;
46  typedef boost::numeric::odeint::dense_output_runge_kutta<ControlledRK> DOSRK;
47 
48  // DOS concept for the boost odeint runge_kutta_dopri5<Vec> stepper
49  class RKDOPRI5 : public DOSRK {
50  public:
52  typedef typename ControlledRK::stepper_category UnderlayingStepperCategory;
53  RKDOPRI5(double aTol, double rTol, double dtMax) :
54  DOSRK(ControlledRK(ControlledRK::error_checker_type(aTol, rTol), ControlledRK::step_adjuster_type(dtMax), RKDOPRI5Stepper())) {}
55  };
56 
57 
58 
59  // bulirsch_stoer<Vec>
60 
61  // type definitions
62  typedef boost::numeric::odeint::bulirsch_stoer_dense_out<fmatvec::Vec> DOSBS;
63 
64  // DOS concept for the boost odeint bulirsch_stoer_dense_out<Vec> stepper.
65  class BulirschStoer : public DOSBS {
66  public:
68  typedef boost::numeric::odeint::controlled_stepper_tag UnderlayingStepperCategory;
69  BulirschStoer(double aTol, double rTol, double dtMax) : DOSBS(aTol, rTol, 1.0, 1.0, dtMax) {}
70  };
71 
72 
73 
74  // euler<Vec>
75 
76  // type definitions
77  typedef boost::numeric::odeint::euler<fmatvec::Vec> EulerStepper;
78  typedef boost::numeric::odeint::dense_output_runge_kutta<EulerStepper> DOSEuler;
79 
80  // DOS concept for the boost odeint euler<Vec> stepper
81  class Euler : public DOSEuler {
82  public:
84  typedef typename EulerStepper::stepper_category UnderlayingStepperCategory;
85  Euler(double aTol, double rTol, double dtMax) : DOSEuler() {}
86  };
87 
88 
89 
90  // rosenbrock4<double>
91 
92  // type definitions
93  typedef boost::numeric::odeint::rosenbrock4<double> RB4;
94  typedef boost::numeric::odeint::rosenbrock4_controller<RB4> ControlledRB4;
95  typedef boost::numeric::odeint::rosenbrock4_dense_output<ControlledRB4> DOSRB4;
96 
97  // DOS concept for the boost odeint rosenbrock4<double> stepper
98  class Rosenbrock4 : public DOSRB4 {
99  public:
101  typedef typename ControlledRB4::stepper_category UnderlayingStepperCategory;
102  Rosenbrock4(double aTol, double rTol, double dtMax) : DOSRB4(ControlledRB4(aTol, rTol, dtMax)) {}
103  };
104 
105  }
106 
107  // explicit integrators
110  // not working due to but in boost odeint, see https://github.com/boostorg/odeint/pull/27
111  // typedef BoostOdeintDOS<BoostOdeintHelper::Euler > BoostOdeintDOS_Euler;
112  // implicit integrators
114 
115 }
Definition: boost_odeint_integrator_predef.h:81
Definition: boost_odeint_integrator_predef.h:98
Definition: boost_odeint_integrator.h:69
Definition: boost_odeint_integrator_predef.h:49
Definition: boost_odeint_integrator.h:67
Definition: boost_odeint_integrator.h:103
Definition: boost_odeint_integrator_predef.h:65
namespace MBSim
Definition: eigenanalyzer.cc:47