1 /*
2  [auto_generated]
3  boost/numeric/odeint/stepper/symplectic_euler.hpp
4 
5  [begin_description]
6  Implementation of the symplectic Euler for separable Hamiltonian systems.
7  [end_description]
8 
9  Copyright 2011-2013 Karsten Ahnert
10  Copyright 2011-2013 Mario Mulansky
11 
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)
15  */
16 
17 
18 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
20 
21 
22 #include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp>
23 
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>
28 
29 #include <boost/array.hpp>
30 
31 namespace boost {
32 namespace numeric {
33 namespace odeint {
34 
35 
36 #ifndef DOXYGEN_SKIP
37 namespace detail {
38 namespace symplectic_euler_coef {
39 
40 template< class Value >
41 struct coef_a_type : public boost::array< Value , 1 >
42 {
coef_a_typeboost::numeric::odeint::detail::symplectic_euler_coef::coef_a_type43     coef_a_type( void )
44     {
45         (*this)[0] = static_cast< Value >( 1 );
46     }
47 };
48 
49 template< class Value >
50 struct coef_b_type : public boost::array< Value , 1 >
51 {
coef_b_typeboost::numeric::odeint::detail::symplectic_euler_coef::coef_b_type52     coef_b_type( void )
53     {
54         (*this)[0] = static_cast< Value >( 1 );
55     }
56 };
57 
58 } // namespace symplectic_euler_coef
59 } // namespace detail
60 #endif
61 
62 
63 
64 template<
65 class Coor ,
66 class Momentum = Coor ,
67 class Value = double ,
68 class CoorDeriv = Coor ,
69 class MomentumDeriv = Coor ,
70 class Time = Value ,
71 class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
72 class Operations = typename operations_dispatcher< Coor >::operations_type ,
73 class Resizer = initially_resizer
74 >
75 #ifndef DOXYGEN_SKIP
76 class symplectic_euler :
77 public symplectic_nystroem_stepper_base
78 <
79 1 , 1 ,
80 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
81 >
82 #else
83 class symplectic_euler : public symplectic_nystroem_stepper_base
84 #endif
85 {
86 public:
87 
88 #ifndef DOXYGEN_SKIP
89     typedef symplectic_nystroem_stepper_base<
90     1 , 1 , Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > stepper_base_type;
91 #endif
92     typedef typename stepper_base_type::algebra_type algebra_type;
93     typedef typename stepper_base_type::value_type value_type;
94 
95 
symplectic_euler(const algebra_type & algebra=algebra_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 >() ,
99             algebra )
100     { }
101 };
102 
103 
104 /*************** DOXYGEN ***************/
105 
106 /**
107  * \class symplectic_euler
108  * \brief Implementation of the symplectic Euler method.
109  *
110  * The method is of first order and has one stage. It is described HERE.
111  *
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.
122  */
123 
124     /**
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.
129      */
130 
131 } // namespace odeint
132 } // namespace numeric
133 } // namespace boost
134 
135 
136 #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
137