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