3 boost/numeric/odeint/stepper/symplectic_euler.hpp
6 Implementation of the symplectic Euler for separable Hamiltonian systems.
9 Copyright 2011-2013 Karsten Ahnert
10 Copyright 2011-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_EULER_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
22 #include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp>
24 #include <boost/numeric/odeint/algebra/range_algebra.hpp>
25 #include <boost/numeric/odeint/algebra/default_operations.hpp>
26 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
27 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
29 #include <boost/array.hpp>
38 namespace symplectic_euler_coef {
40 template< class Value >
41 struct coef_a_type : public boost::array< Value , 1 >
45 (*this)[0] = static_cast< Value >( 1 );
49 template< class Value >
50 struct coef_b_type : public boost::array< Value , 1 >
54 (*this)[0] = static_cast< Value >( 1 );
58 } // namespace symplectic_euler_coef
66 class Momentum = Coor ,
67 class Value = double ,
68 class CoorDeriv = Coor ,
69 class MomentumDeriv = Coor ,
71 class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
72 class Operations = typename operations_dispatcher< Coor >::operations_type ,
73 class Resizer = initially_resizer
76 class symplectic_euler :
77 public symplectic_nystroem_stepper_base
80 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
83 class symplectic_euler : public symplectic_nystroem_stepper_base
89 typedef symplectic_nystroem_stepper_base<
90 1 , 1 , Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > stepper_base_type;
92 typedef typename stepper_base_type::algebra_type algebra_type;
93 typedef typename stepper_base_type::value_type value_type;
96 symplectic_euler( const algebra_type &algebra = algebra_type() )
97 : stepper_base_type( detail::symplectic_euler_coef::coef_a_type< value_type >() ,
98 detail::symplectic_euler_coef::coef_b_type< value_type >() ,
104 /*************** DOXYGEN ***************/
107 * \class symplectic_euler
108 * \brief Implementation of the symplectic Euler method.
110 * The method is of first order and has one stage. It is described HERE.
112 * \tparam Order The order of the stepper.
113 * \tparam Coor The type representing the coordinates q.
114 * \tparam Momentum The type representing the coordinates p.
115 * \tparam Value The basic value type. Should be something like float, double or a high-precision type.
116 * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
117 * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
118 * \tparam Time The type representing the time t.
119 * \tparam Algebra The algebra.
120 * \tparam Operations The operations.
121 * \tparam Resizer The resizer policy.
125 * \fn symplectic_euler::symplectic_euler( const algebra_type &algebra )
126 * \brief Constructs the symplectic_euler. This constructor can be used as a default
127 * constructor if the algebra has a default constructor.
128 * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
131 } // namespace odeint
132 } // namespace numeric
136 #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED