File indexing completed on 2025-01-18 09:42:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
0020
0021
0022
0023
0024 namespace boost {
0025 namespace numeric {
0026 namespace odeint {
0027
0028
0029
0030
0031 template< class Stepper > struct get_controller { };
0032
0033
0034
0035
0036 template< class Stepper , class Controller >
0037 struct controller_factory
0038 {
0039 Controller operator()(
0040 typename Stepper::value_type abs_error ,
0041 typename Stepper::value_type rel_error ,
0042 const Stepper &stepper )
0043 {
0044 return Controller( abs_error , rel_error , stepper );
0045 }
0046
0047 Controller operator()(
0048 typename Stepper::value_type abs_error ,
0049 typename Stepper::value_type rel_error ,
0050 typename Stepper::time_type max_dt ,
0051 const Stepper &stepper )
0052 {
0053 return Controller( abs_error , rel_error , max_dt, stepper );
0054 }
0055 };
0056
0057
0058
0059
0060 namespace result_of
0061 {
0062 template< class Stepper >
0063 struct make_controlled
0064 {
0065 typedef typename get_controller< Stepper >::type type;
0066 };
0067 }
0068
0069
0070 template< class Stepper >
0071 typename result_of::make_controlled< Stepper >::type make_controlled(
0072 typename Stepper::value_type abs_error ,
0073 typename Stepper::value_type rel_error ,
0074 const Stepper & stepper = Stepper() )
0075 {
0076 typedef Stepper stepper_type;
0077 typedef typename result_of::make_controlled< stepper_type >::type controller_type;
0078 typedef controller_factory< stepper_type , controller_type > factory_type;
0079 factory_type factory;
0080 return factory( abs_error , rel_error , stepper );
0081 }
0082
0083
0084 template< class Stepper >
0085 typename result_of::make_controlled< Stepper >::type make_controlled(
0086 typename Stepper::value_type abs_error ,
0087 typename Stepper::value_type rel_error ,
0088 typename Stepper::time_type max_dt ,
0089 const Stepper & stepper = Stepper() )
0090 {
0091 typedef Stepper stepper_type;
0092 typedef typename result_of::make_controlled< stepper_type >::type controller_type;
0093 typedef controller_factory< stepper_type , controller_type > factory_type;
0094 factory_type factory;
0095 return factory( abs_error , rel_error , max_dt, stepper );
0096 }
0097
0098 }
0099 }
0100 }
0101
0102
0103 #endif