symplectic_euler.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 2009-2011 Karsten Ahnert
  8. Copyright 2009-2011 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/array.hpp>
  19. namespace boost {
  20. namespace numeric {
  21. namespace odeint {
  22. #ifndef DOXYGEN_SKIP
  23. namespace detail {
  24. namespace symplectic_euler_coef {
  25. template< class Value >
  26. struct coef_a_type : public boost::array< Value , 1 >
  27. {
  28. coef_a_type( void )
  29. {
  30. (*this)[0] = static_cast< Value >( 1 );
  31. }
  32. };
  33. template< class Value >
  34. struct coef_b_type : public boost::array< Value , 1 >
  35. {
  36. coef_b_type( void )
  37. {
  38. (*this)[0] = static_cast< Value >( 1 );
  39. }
  40. };
  41. } // namespace symplectic_euler_coef
  42. } // namespace detail
  43. #endif
  44. template<
  45. class Coor ,
  46. class Momentum = Coor ,
  47. class Value = double ,
  48. class CoorDeriv = Coor ,
  49. class MomentumDeriv = Coor ,
  50. class Time = Value ,
  51. class Algebra = range_algebra ,
  52. class Operations = default_operations ,
  53. class Resizer = initially_resizer
  54. >
  55. #ifndef DOXYGEN_SKIP
  56. class symplectic_euler :
  57. public symplectic_nystroem_stepper_base
  58. <
  59. 1 , 1 ,
  60. Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
  61. >
  62. #else
  63. class symplectic_euler : public symplectic_nystroem_stepper_base
  64. #endif
  65. {
  66. public:
  67. #ifndef DOXYGEN_SKIP
  68. typedef symplectic_nystroem_stepper_base<
  69. 1 , 1 , Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > stepper_base_type;
  70. #endif
  71. typedef typename stepper_base_type::algebra_type algebra_type;
  72. typedef typename stepper_base_type::value_type value_type;
  73. symplectic_euler( const algebra_type &algebra = algebra_type() )
  74. : stepper_base_type( detail::symplectic_euler_coef::coef_a_type< value_type >() ,
  75. detail::symplectic_euler_coef::coef_b_type< value_type >() ,
  76. algebra )
  77. { }
  78. };
  79. /*************** DOXYGEN ***************/
  80. /**
  81. * \class symplectic_euler
  82. * \brief Implementation of the symplectic Euler method.
  83. *
  84. * The method is of first order and has one stage. It is described HERE.
  85. *
  86. * \tparam Order The order of the stepper.
  87. * \tparam Coor The type representing the coordinates q.
  88. * \tparam Momentum The type representing the coordinates p.
  89. * \tparam Value The basic value type. Should be something like float, double or a high-precision type.
  90. * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
  91. * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
  92. * \tparam Time The type representing the time t.
  93. * \tparam Algebra The algebra.
  94. * \tparam Operations The operations.
  95. * \tparam Resizer The resizer policy.
  96. */
  97. /**
  98. * \fn symplectic_euler::symplectic_euler( const algebra_type &algebra )
  99. * \brief Constructs the symplectic_euler. This constructor can be used as a default
  100. * constructor if the algebra has a default constructor.
  101. * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
  102. */
  103. } // namespace odeint
  104. } // namespace numeric
  105. } // namespace boost
  106. #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED