VPTissue Reference Manual
OdeintFactories2Map.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "OdeintFactories2Map.h"
21 
22 #include <boost/functional/value_factory.hpp>
23 #include <boost/numeric/odeint.hpp>
24 
25 using namespace std;
26 using namespace boost::numeric::odeint;
27 using boost::value_factory;
28 
29 namespace {
30 
34 template<typename System, typename State, typename Stepper>
35 class Solver2
36 {
37 public:
38  Solver2(double& eps_abs, double& eps_rel)
39  : m_eps_abs(eps_abs), m_eps_rel(eps_rel)
40  {}
41 
42  void operator()(System system, State& start_state,
43  double start_time, double end_time, double dt)
44  {
45  integrate_adaptive(make_controlled<Stepper>(m_eps_abs, m_eps_rel),
46  system, start_state, start_time, end_time, dt);
47  }
48 
49 private:
50  double m_eps_abs;
51  double m_eps_rel;
52 };
53 
54 } // anonymous namespace
55 
56 namespace SimPT_Sim {
57 
58 OdeintFactories2Map::OdeintFactories2Map()
59 : MapType({
60  make_pair("runge_kutta_cash_karp54",
61  value_factory<Solver2<System, State, runge_kutta_cash_karp54<State>>>()),
62  make_pair("runge_kutta_dopri5",
63  value_factory<Solver2<System, State, runge_kutta_dopri5<State>>>()),
64  make_pair("runge_kutta_fehlberg78",
65  value_factory<Solver2<System, State, runge_kutta_fehlberg78<State>>>())
66 })
67 {}
68 
69 } // namespace
STL namespace.
Namespace for the core simulator.
Interface for OdeintFactories2Map.