18 #include "boost_odeint_integrator.h" 21 #include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp> 22 #include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp> 25 #include <boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp> 28 #include <boost/numeric/odeint/stepper/euler.hpp> 31 #include <boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp> 35 namespace BoostOdeintHelper {
44 typedef boost::numeric::odeint::runge_kutta_dopri5<fmatvec::Vec> RKDOPRI5Stepper;
45 typedef boost::numeric::odeint::default_error_checker<double, boost::numeric::odeint::range_algebra,
46 boost::numeric::odeint::default_operations> RKDOPRI5Checker;
47 class RKDOPRI5Adjuster :
public boost::numeric::odeint::default_step_adjuster<double, double> {
49 RKDOPRI5Adjuster(
double dtMax) : boost::numeric::odeint::default_step_adjuster<double, double>(dtMax) {}
50 #if BOOST_VERSION >= 107100 51 void setDtMax(
double dtMax) { m_max_dt = dtMax; }
54 #if BOOST_VERSION >= 107100 55 typedef boost::numeric::odeint::controlled_runge_kutta<RKDOPRI5Stepper, RKDOPRI5Checker,
56 boost::reference_wrapper<RKDOPRI5Adjuster>> ControlledRK;
58 typedef boost::numeric::odeint::controlled_runge_kutta<RKDOPRI5Stepper, RKDOPRI5Checker,
61 typedef boost::numeric::odeint::dense_output_runge_kutta<ControlledRK> DOSRK;
67 typedef typename ControlledRK::stepper_category UnderlayingStepperCategory;
68 RKDOPRI5(
double aTol,
double rTol,
double dtMax) :
69 #if BOOST_VERSION >= 107100 70 DOSRK(ControlledRK(RKDOPRI5Checker(aTol, rTol), boost::ref(rkdopri5Adjuster), RKDOPRI5Stepper())), rkdopri5Adjuster(dtMax) {}
72 DOSRK(ControlledRK(RKDOPRI5Checker(aTol, rTol),
RKDOPRI5Adjuster(dtMax), RKDOPRI5Stepper())) {}
74 #if BOOST_VERSION >= 107100 75 void setDtMax(
double dtMax) { rkdopri5Adjuster.setDtMax(dtMax); }
86 typedef boost::numeric::odeint::bulirsch_stoer_dense_out<fmatvec::Vec> DOSBS;
92 typedef boost::numeric::odeint::controlled_stepper_tag UnderlayingStepperCategory;
93 BulirschStoer(
double aTol,
double rTol,
double dtMax) : DOSBS(aTol, rTol, 1.0, 1.0, dtMax) {}
94 #if BOOST_VERSION >= 107100 95 void setDtMax(
double dtMax) { m_max_dt = dtMax; }
104 typedef boost::numeric::odeint::euler<fmatvec::Vec> EulerStepper;
105 typedef boost::numeric::odeint::dense_output_runge_kutta<EulerStepper> DOSEuler;
111 typedef typename EulerStepper::stepper_category UnderlayingStepperCategory;
112 Euler(
double aTol,
double rTol,
double dtMax) : DOSEuler() {}
113 #if BOOST_VERSION >= 107100 114 void setDtMax(
double) {}
123 typedef boost::numeric::odeint::rosenbrock4<double> RB4;
124 class ControlledRB4 :
public boost::numeric::odeint::rosenbrock4_controller<RB4> {
126 ControlledRB4(
double aTol,
double rTol,
double dtMax) : boost::numeric::odeint::rosenbrock4_controller<RB4>(aTol, rTol, dtMax) {}
127 #if BOOST_VERSION >= 107100 128 void setDtMax(
double dtMax) { m_max_dt = dtMax; }
131 #if BOOST_VERSION >= 107100 132 typedef boost::numeric::odeint::rosenbrock4_dense_output<boost::reference_wrapper<ControlledRB4>> DOSRB4;
134 typedef boost::numeric::odeint::rosenbrock4_dense_output<ControlledRB4> DOSRB4;
141 typedef typename ControlledRB4::stepper_category UnderlayingStepperCategory;
142 #if BOOST_VERSION >= 107100 143 Rosenbrock4(
double aTol,
double rTol,
double dtMax) : DOSRB4(boost::ref(controlledRB4)), controlledRB4(aTol, rTol, dtMax) {}
147 #if BOOST_VERSION >= 107100 148 void setDtMax(
double dtMax) { controlledRB4.setDtMax(dtMax); }
Definition: boost_odeint_integrator_predef.h:108
Definition: boost_odeint_integrator_predef.h:138
Definition: boost_odeint_integrator.h:69
Definition: boost_odeint_integrator_predef.h:64
Definition: boost_odeint_integrator_predef.h:124
Definition: boost_odeint_integrator.h:67
Definition: boost_odeint_integrator.h:103
Definition: boost_odeint_integrator_predef.h:89
Definition: boost_odeint_integrator_predef.h:47
namespace MBSim
Definition: bilateral_constraint.cc:29