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