Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:57

0001 /*
0002   [auto_generated]
0003   boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp
0004 
0005   [begin_description]
0006   tba.
0007   [end_description]
0008 
0009   Copyright 2012-2013 Karsten Ahnert
0010   Copyright 2012-2013 Mario Mulansky
0011 
0012   Distributed under the Boost Software License, Version 1.0.
0013   (See accompanying file LICENSE_1_0.txt or
0014   copy at http://www.boost.org/LICENSE_1_0.txt)
0015 */
0016 
0017 
0018 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED
0019 #define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED
0020 
0021 #include <boost/numeric/odeint/algebra/default_operations.hpp>
0022 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
0023 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
0024 
0025 #include <boost/numeric/odeint/util/resizer.hpp>
0026 
0027 
0028 namespace boost {
0029 namespace numeric {
0030 namespace odeint {
0031 
0032 #ifndef DOXYGEN_SKIP
0033 namespace detail {
0034 namespace symplectic_rkn_sb3a_m4_mclachlan {
0035 
0036     /*
0037       exp( a1 t A ) exp( b1 t B )
0038       exp( a2 t A ) exp( b2 t B )
0039       exp( a3 t A )
0040       exp( b2 t B ) exp( a2 t A )
0041       exp( b1 t B ) exp( a1 t A )
0042     */
0043 
0044 
0045 
0046     template< class Value >
0047     struct coef_a_type : public boost::array< Value , 5 >
0048     {
0049         coef_a_type( void )
0050         {
0051             using std::sqrt;
0052 
0053             Value z = sqrt( static_cast< Value >( 7 ) / static_cast< Value >( 8 ) ) / static_cast< Value >( 3 );
0054             (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - z ;
0055             (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 3 ) + z ;
0056             (*this)[2] = static_cast< Value >( 2 ) / static_cast< Value >( 3 );
0057             (*this)[3] = (*this)[1];
0058             (*this)[4] = (*this)[0];
0059         }
0060     };
0061 
0062     template< class Value >
0063     struct coef_b_type : public boost::array< Value , 5 >
0064     {
0065         coef_b_type( void )
0066         {
0067             (*this)[0] = static_cast< Value >( 1 );
0068             (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 2 );
0069             (*this)[2] = (*this)[1];
0070             (*this)[3] = (*this)[0];
0071             (*this)[4] = static_cast< Value >( 0 );
0072         }
0073     };
0074 
0075 } // namespace symplectic_rkn_sb3a_m4_mclachlan
0076 } // namespace detail
0077 #endif // DOXYGEN_SKIP
0078 
0079 
0080 
0081 
0082 template<
0083     class Coor ,
0084     class Momentum = Coor ,
0085     class Value = double ,
0086     class CoorDeriv = Coor ,
0087     class MomentumDeriv = Coor ,
0088     class Time = Value ,
0089     class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
0090     class Operations = typename operations_dispatcher< Coor >::operations_type ,
0091     class Resizer = initially_resizer
0092     >
0093 #ifndef DOXYGEN_SKIP
0094 class symplectic_rkn_sb3a_m4_mclachlan :
0095         public symplectic_nystroem_stepper_base
0096 <
0097     5 , 4 ,
0098     Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
0099     >
0100 #else
0101 class symplectic_rkn_sb3a_m4_mclachlan : public symplectic_nystroem_stepper_base
0102 #endif
0103 {
0104 public:
0105 #ifndef DOXYGEN_SKIP
0106     typedef symplectic_nystroem_stepper_base
0107     <
0108     5 , 4 ,
0109     Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
0110     > stepper_base_type;
0111 #endif
0112     typedef typename stepper_base_type::algebra_type algebra_type;
0113     typedef typename stepper_base_type::value_type value_type;
0114 
0115 
0116     symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra = algebra_type() )
0117         : stepper_base_type(
0118             detail::symplectic_rkn_sb3a_m4_mclachlan::coef_a_type< value_type >() ,
0119             detail::symplectic_rkn_sb3a_m4_mclachlan::coef_b_type< value_type >() ,
0120             algebra )
0121     { }
0122 };
0123 
0124 
0125 /***************** DOXYGEN ***************/
0126 
0127 /**
0128  * \class symplectic_rkn_sb3a_m4_mclachlan
0129  * \brief Implementation of the symmetric B3A Runge-Kutta Nystroem method of fifth order.
0130  *
0131  * The method is of fourth order and has five stages. It is described HERE. This method can be used
0132  * with multiprecision types since the coefficients are defined analytically.
0133  *
0134  * ToDo: add reference to paper.
0135  *
0136  * \tparam Order The order of the stepper.
0137  * \tparam Coor The type representing the coordinates q.
0138  * \tparam Momentum The type representing the coordinates p.
0139  * \tparam Value The basic value type. Should be something like float, double or a high-precision type.
0140  * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
0141  * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
0142  * \tparam Time The type representing the time t.
0143  * \tparam Algebra The algebra.
0144  * \tparam Operations The operations.
0145  * \tparam Resizer The resizer policy.
0146  */
0147 
0148     /**
0149      * \fn symplectic_rkn_sb3a_m4_mclachlan::symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra )
0150      * \brief Constructs the symplectic_rkn_sb3a_m4_mclachlan. This constructor can be used as a default
0151      * constructor if the algebra has a default constructor.
0152      * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
0153      */
0154 
0155 } // namespace odeint
0156 } // namespace numeric
0157 } // namespace boost
0158 
0159 
0160 #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED