1 /* 2 [auto_generated] 3 boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp 4 5 [begin_description] 6 tba. 7 [end_description] 8 9 Copyright 2012-2013 Karsten Ahnert 10 Copyright 2012-2013 Mario Mulansky 11 12 Distributed under the Boost Software License, Version 1.0. 13 (See accompanying file LICENSE_1_0.txt or 14 copy at http://www.boost.org/LICENSE_1_0.txt) 15 */ 16 17 18 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED 19 #define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED 20 21 #include <boost/numeric/odeint/algebra/default_operations.hpp> 22 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> 23 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> 24 25 #include <boost/numeric/odeint/util/resizer.hpp> 26 27 28 namespace boost { 29 namespace numeric { 30 namespace odeint { 31 32 #ifndef DOXYGEN_SKIP 33 namespace detail { 34 namespace symplectic_rkn_sb3a_m4_mclachlan { 35 36 /* 37 exp( a1 t A ) exp( b1 t B ) 38 exp( a2 t A ) exp( b2 t B ) 39 exp( a3 t A ) 40 exp( b2 t B ) exp( a2 t A ) 41 exp( b1 t B ) exp( a1 t A ) 42 */ 43 44 45 46 template< class Value > 47 struct coef_a_type : public boost::array< Value , 5 > 48 { coef_a_typeboost::numeric::odeint::detail::symplectic_rkn_sb3a_m4_mclachlan::coef_a_type49 coef_a_type( void ) 50 { 51 using std::sqrt; 52 53 Value z = sqrt( static_cast< Value >( 7 ) / static_cast< Value >( 8 ) ) / static_cast< Value >( 3 ); 54 (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - z ; 55 (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 3 ) + z ; 56 (*this)[2] = static_cast< Value >( 2 ) / static_cast< Value >( 3 ); 57 (*this)[3] = (*this)[1]; 58 (*this)[4] = (*this)[0]; 59 } 60 }; 61 62 template< class Value > 63 struct coef_b_type : public boost::array< Value , 5 > 64 { coef_b_typeboost::numeric::odeint::detail::symplectic_rkn_sb3a_m4_mclachlan::coef_b_type65 coef_b_type( void ) 66 { 67 (*this)[0] = static_cast< Value >( 1 ); 68 (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 2 ); 69 (*this)[2] = (*this)[1]; 70 (*this)[3] = (*this)[0]; 71 (*this)[4] = static_cast< Value >( 0 ); 72 } 73 }; 74 75 } // namespace symplectic_rkn_sb3a_m4_mclachlan 76 } // namespace detail 77 #endif // DOXYGEN_SKIP 78 79 80 81 82 template< 83 class Coor , 84 class Momentum = Coor , 85 class Value = double , 86 class CoorDeriv = Coor , 87 class MomentumDeriv = Coor , 88 class Time = Value , 89 class Algebra = typename algebra_dispatcher< Coor >::algebra_type , 90 class Operations = typename operations_dispatcher< Coor >::operations_type , 91 class Resizer = initially_resizer 92 > 93 #ifndef DOXYGEN_SKIP 94 class symplectic_rkn_sb3a_m4_mclachlan : 95 public symplectic_nystroem_stepper_base 96 < 97 5 , 4 , 98 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer 99 > 100 #else 101 class symplectic_rkn_sb3a_m4_mclachlan : public symplectic_nystroem_stepper_base 102 #endif 103 { 104 public: 105 #ifndef DOXYGEN_SKIP 106 typedef symplectic_nystroem_stepper_base 107 < 108 5 , 4 , 109 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer 110 > stepper_base_type; 111 #endif 112 typedef typename stepper_base_type::algebra_type algebra_type; 113 typedef typename stepper_base_type::value_type value_type; 114 115 symplectic_rkn_sb3a_m4_mclachlan(const algebra_type & algebra=algebra_type ())116 symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra = algebra_type() ) 117 : stepper_base_type( 118 detail::symplectic_rkn_sb3a_m4_mclachlan::coef_a_type< value_type >() , 119 detail::symplectic_rkn_sb3a_m4_mclachlan::coef_b_type< value_type >() , 120 algebra ) 121 { } 122 }; 123 124 125 /***************** DOXYGEN ***************/ 126 127 /** 128 * \class symplectic_rkn_sb3a_m4_mclachlan 129 * \brief Implementation of the symmetric B3A Runge-Kutta Nystroem method of fifth order. 130 * 131 * The method is of fourth order and has five stages. It is described HERE. This method can be used 132 * with multiprecision types since the coefficients are defined analytically. 133 * 134 * ToDo: add reference to paper. 135 * 136 * \tparam Order The order of the stepper. 137 * \tparam Coor The type representing the coordinates q. 138 * \tparam Momentum The type representing the coordinates p. 139 * \tparam Value The basic value type. Should be something like float, double or a high-precision type. 140 * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt. 141 * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt. 142 * \tparam Time The type representing the time t. 143 * \tparam Algebra The algebra. 144 * \tparam Operations The operations. 145 * \tparam Resizer The resizer policy. 146 */ 147 148 /** 149 * \fn symplectic_rkn_sb3a_m4_mclachlan::symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra ) 150 * \brief Constructs the symplectic_rkn_sb3a_m4_mclachlan. This constructor can be used as a default 151 * constructor if the algebra has a default constructor. 152 * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. 153 */ 154 155 } // namespace odeint 156 } // namespace numeric 157 } // namespace boost 158 159 160 #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED 161