All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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 #if BOOST_VERSION >= 106000
54  RKDOPRI5(double aTol, double rTol, double dtMax) :
55  DOSRK(ControlledRK(ControlledRK::error_checker_type(aTol, rTol), ControlledRK::step_adjuster_type(dtMax), RKDOPRI5Stepper())) {}
56 #else // boost odeint < 1.60 does not support dtMax
57  RKDOPRI5(double aTol, double rTol) :
58  DOSRK(ControlledRK(ControlledRK::error_checker_type(aTol, rTol), RKDOPRI5Stepper())) {}
59 #endif
60  };
61 
62 
63 
64  // bulirsch_stoer<Vec>
65 
66  // type definitions
67  typedef boost::numeric::odeint::bulirsch_stoer_dense_out<fmatvec::Vec> DOSBS;
68 
69  // DOS concept for the boost odeint bulirsch_stoer_dense_out<Vec> stepper.
70  class BulirschStoer : public DOSBS {
71  public:
73  typedef boost::numeric::odeint::controlled_stepper_tag UnderlayingStepperCategory;
74 #if BOOST_VERSION >= 106000
75  BulirschStoer(double aTol, double rTol, double dtMax) : DOSBS(aTol, rTol, 1.0, 1.0, dtMax) {}
76 #endif
77  BulirschStoer(double aTol, double rTol) : DOSBS(aTol, rTol) {}
78  };
79 
80 
81 
82  // euler<Vec>
83 
84  // type definitions
85  typedef boost::numeric::odeint::euler<fmatvec::Vec> EulerStepper;
86  typedef boost::numeric::odeint::dense_output_runge_kutta<EulerStepper> DOSEuler;
87 
88  // DOS concept for the boost odeint euler<Vec> stepper
89  class Euler : public DOSEuler {
90  public:
92  typedef typename EulerStepper::stepper_category UnderlayingStepperCategory;
93 #if BOOST_VERSION >= 106000
94  Euler(double aTol, double rTol, double dtMax) : DOSEuler() {}
95 #else // boost odeint < 1.60 does not support dtMax
96  Euler(double aTol, double rTol) : DOSEuler() {}
97 #endif
98  };
99 
100 
101 
102  // rosenbrock4<double>
103 
104  // type definitions
105  typedef boost::numeric::odeint::rosenbrock4<double> RB4;
106  typedef boost::numeric::odeint::rosenbrock4_controller<RB4> ControlledRB4;
107  typedef boost::numeric::odeint::rosenbrock4_dense_output<ControlledRB4> DOSRB4;
108 
109  // DOS concept for the boost odeint rosenbrock4<double> stepper
110  class Rosenbrock4 : public DOSRB4 {
111  public:
113  typedef typename ControlledRB4::stepper_category UnderlayingStepperCategory;
114 #if BOOST_VERSION >= 106000
115  Rosenbrock4(double aTol, double rTol, double dtMax) : DOSRB4(ControlledRB4(aTol, rTol, dtMax)) {}
116 #endif
117  Rosenbrock4(double aTol, double rTol) : DOSRB4(ControlledRB4(aTol, rTol)) {}
118  };
119 
120  }
121 
122  // explicit integrators
125  // not working due to but in boost odeint, see https://github.com/boostorg/odeint/pull/27
126  // typedef BoostOdeintDOS<BoostOdeintHelper::Euler > BoostOdeintDOS_Euler;
127  // implicit integrators
129 
130 }
Definition: boost_odeint_integrator_predef.h:89
Definition: boost_odeint_integrator_predef.h:110
Definition: boost_odeint_integrator.h:68
Definition: boost_odeint_integrator_predef.h:49
Definition: boost_odeint_integrator.h:66
Definition: boost_odeint_integrator.h:103
Definition: boost_odeint_integrator_predef.h:70

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Home