Chris@16
|
1 /*
|
Chris@16
|
2 [auto_generated]
|
Chris@16
|
3 boost/numeric/odeint/stepper/generation/make_controlled.hpp
|
Chris@16
|
4
|
Chris@16
|
5 [begin_description]
|
Chris@16
|
6 Factory function to simplify the creation of controlled steppers from error steppers.
|
Chris@16
|
7 [end_description]
|
Chris@16
|
8
|
Chris@101
|
9 Copyright 2011-2012 Karsten Ahnert
|
Chris@101
|
10 Copyright 2011-2012 Mario Mulansky
|
Chris@16
|
11
|
Chris@16
|
12 Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
13 (See accompanying file LICENSE_1_0.txt or
|
Chris@16
|
14 copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
15 */
|
Chris@16
|
16
|
Chris@16
|
17
|
Chris@16
|
18 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
|
Chris@16
|
19 #define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
|
Chris@16
|
20
|
Chris@16
|
21
|
Chris@16
|
22
|
Chris@16
|
23
|
Chris@16
|
24 namespace boost {
|
Chris@16
|
25 namespace numeric {
|
Chris@16
|
26 namespace odeint {
|
Chris@16
|
27
|
Chris@16
|
28
|
Chris@16
|
29
|
Chris@16
|
30 // default template for the controller
|
Chris@16
|
31 template< class Stepper > struct get_controller { };
|
Chris@16
|
32
|
Chris@16
|
33
|
Chris@16
|
34
|
Chris@16
|
35 // default controller factory
|
Chris@16
|
36 template< class Stepper , class Controller >
|
Chris@16
|
37 struct controller_factory
|
Chris@16
|
38 {
|
Chris@16
|
39 Controller operator()(
|
Chris@16
|
40 typename Stepper::value_type abs_error ,
|
Chris@16
|
41 typename Stepper::value_type rel_error ,
|
Chris@16
|
42 const Stepper &stepper )
|
Chris@16
|
43 {
|
Chris@16
|
44 return Controller( abs_error , rel_error , stepper );
|
Chris@16
|
45 }
|
Chris@16
|
46 };
|
Chris@16
|
47
|
Chris@16
|
48
|
Chris@16
|
49
|
Chris@16
|
50
|
Chris@16
|
51 namespace result_of
|
Chris@16
|
52 {
|
Chris@16
|
53 template< class Stepper >
|
Chris@16
|
54 struct make_controlled
|
Chris@16
|
55 {
|
Chris@16
|
56 typedef typename get_controller< Stepper >::type type;
|
Chris@16
|
57 };
|
Chris@16
|
58 }
|
Chris@16
|
59
|
Chris@16
|
60
|
Chris@16
|
61 template< class Stepper >
|
Chris@16
|
62 typename result_of::make_controlled< Stepper >::type make_controlled(
|
Chris@16
|
63 typename Stepper::value_type abs_error ,
|
Chris@16
|
64 typename Stepper::value_type rel_error ,
|
Chris@16
|
65 const Stepper & stepper = Stepper() )
|
Chris@16
|
66 {
|
Chris@16
|
67 typedef Stepper stepper_type;
|
Chris@16
|
68 typedef typename result_of::make_controlled< stepper_type >::type controller_type;
|
Chris@16
|
69 typedef controller_factory< stepper_type , controller_type > factory_type;
|
Chris@16
|
70 factory_type factory;
|
Chris@16
|
71 return factory( abs_error , rel_error , stepper );
|
Chris@16
|
72 }
|
Chris@16
|
73
|
Chris@16
|
74
|
Chris@16
|
75
|
Chris@16
|
76 } // odeint
|
Chris@16
|
77 } // numeric
|
Chris@16
|
78 } // boost
|
Chris@16
|
79
|
Chris@16
|
80
|
Chris@16
|
81 #endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
|