3 boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp
9 Copyright 2012-2013 Karsten Ahnert
10 Copyright 2012-2013 Mario Mulansky
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)
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
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>
25 #include <boost/numeric/odeint/util/resizer.hpp>
34 namespace symplectic_rkn_sb3a_m4_mclachlan {
37 exp( a1 t A ) exp( b1 t B )
38 exp( a2 t A ) exp( b2 t B )
40 exp( b2 t B ) exp( a2 t A )
41 exp( b1 t B ) exp( a1 t A )
46 template< class Value >
47 struct coef_a_type : public boost::array< Value , 5 >
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];
62 template< class Value >
63 struct coef_b_type : public boost::array< Value , 5 >
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 );
75 } // namespace symplectic_rkn_sb3a_m4_mclachlan
77 #endif // DOXYGEN_SKIP
84 class Momentum = Coor ,
85 class Value = double ,
86 class CoorDeriv = Coor ,
87 class MomentumDeriv = Coor ,
89 class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
90 class Operations = typename operations_dispatcher< Coor >::operations_type ,
91 class Resizer = initially_resizer
94 class symplectic_rkn_sb3a_m4_mclachlan :
95 public symplectic_nystroem_stepper_base
98 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
101 class symplectic_rkn_sb3a_m4_mclachlan : public symplectic_nystroem_stepper_base
106 typedef symplectic_nystroem_stepper_base
109 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
112 typedef typename stepper_base_type::algebra_type algebra_type;
113 typedef typename stepper_base_type::value_type value_type;
116 symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra = algebra_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 >() ,
125 /***************** DOXYGEN ***************/
128 * \class symplectic_rkn_sb3a_m4_mclachlan
129 * \brief Implementation of the symmetric B3A Runge-Kutta Nystroem method of fifth order.
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.
134 * ToDo: add reference to paper.
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.
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.
155 } // namespace odeint
156 } // namespace numeric
160 #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED