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