symplectic_euler.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/stepper/symplectic_euler.hpp
  4. [begin_description]
  5. Implementation of the symplectic Euler for separable Hamiltonian systems.
  6. [end_description]
  7. Copyright 2011-2013 Karsten Ahnert
  8. Copyright 2011-2013 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
  15. #include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp>
  16. #include <boost/numeric/odeint/algebra/range_algebra.hpp>
  17. #include <boost/numeric/odeint/algebra/default_operations.hpp>
  18. #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
  19. #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
  20. #include <boost/array.hpp>
  21. namespace boost {
  22. namespace numeric {
  23. namespace odeint {
  24. #ifndef DOXYGEN_SKIP
  25. namespace detail {
  26. namespace symplectic_euler_coef {
  27. template< class Value >
  28. struct coef_a_type : public boost::array< Value , 1 >
  29. {
  30. coef_a_type( void )
  31. {
  32. (*this)[0] = static_cast< Value >( 1 );
  33. }
  34. };
  35. template< class Value >
  36. struct coef_b_type : public boost::array< Value , 1 >
  37. {
  38. coef_b_type( void )
  39. {
  40. (*this)[0] = static_cast< Value >( 1 );
  41. }
  42. };
  43. } // namespace symplectic_euler_coef
  44. } // namespace detail
  45. #endif
  46. template<
  47. class Coor ,
  48. class Momentum = Coor ,
  49. class Value = double ,
  50. class CoorDeriv = Coor ,
  51. class MomentumDeriv = Coor ,
  52. class Time = Value ,
  53. class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
  54. class Operations = typename operations_dispatcher< Coor >::operations_type ,
  55. class Resizer = initially_resizer
  56. >
  57. #ifndef DOXYGEN_SKIP
  58. class symplectic_euler :
  59. public symplectic_nystroem_stepper_base
  60. <
  61. 1 , 1 ,
  62. Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
  63. >
  64. #else
  65. class symplectic_euler : public symplectic_nystroem_stepper_base
  66. #endif
  67. {
  68. public:
  69. #ifndef DOXYGEN_SKIP
  70. typedef symplectic_nystroem_stepper_base<
  71. 1 , 1 , Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > stepper_base_type;
  72. #endif
  73. typedef typename stepper_base_type::algebra_type algebra_type;
  74. typedef typename stepper_base_type::value_type value_type;
  75. symplectic_euler( const algebra_type &algebra = algebra_type() )
  76. : stepper_base_type( detail::symplectic_euler_coef::coef_a_type< value_type >() ,
  77. detail::symplectic_euler_coef::coef_b_type< value_type >() ,
  78. algebra )
  79. { }
  80. };
  81. /*************** DOXYGEN ***************/
  82. /**
  83. * \class symplectic_euler
  84. * \brief Implementation of the symplectic Euler method.
  85. *
  86. * The method is of first order and has one stage. It is described HERE.
  87. *
  88. * \tparam Order The order of the stepper.
  89. * \tparam Coor The type representing the coordinates q.
  90. * \tparam Momentum The type representing the coordinates p.
  91. * \tparam Value The basic value type. Should be something like float, double or a high-precision type.
  92. * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
  93. * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
  94. * \tparam Time The type representing the time t.
  95. * \tparam Algebra The algebra.
  96. * \tparam Operations The operations.
  97. * \tparam Resizer The resizer policy.
  98. */
  99. /**
  100. * \fn symplectic_euler::symplectic_euler( const algebra_type &algebra )
  101. * \brief Constructs the symplectic_euler. This constructor can be used as a default
  102. * constructor if the algebra has a default constructor.
  103. * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
  104. */
  105. } // namespace odeint
  106. } // namespace numeric
  107. } // namespace boost
  108. #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED