]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | [auto_generated] | |
3 | boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp | |
4 | ||
5 | [begin_description] | |
6 | Implementation of the symplectic MacLachlan stepper for separable Hamiltonian system. | |
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_RKN_SB3A_MCLACHLAN_HPP_INCLUDED | |
19 | #define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_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/numeric/odeint/util/resizer.hpp> | |
30 | ||
31 | #include <boost/array.hpp> | |
32 | ||
33 | namespace boost { | |
34 | namespace numeric { | |
35 | namespace odeint { | |
36 | ||
37 | ||
38 | #ifndef DOXYGEN_SKIP | |
39 | namespace detail { | |
40 | namespace symplectic_rkn_sb3a_mclachlan { | |
41 | ||
42 | /* | |
43 | exp( a1 t A ) exp( b1 t B ) | |
44 | exp( a2 t A ) exp( b2 t B ) | |
45 | exp( a3 t A ) exp( b3 t B ) exp( a3 t A ) | |
46 | exp( b2 t B ) exp( a2 t A ) | |
47 | exp( b1 t B ) exp( a1 t A ) | |
48 | */ | |
49 | ||
50 | template< class Value > | |
51 | struct coef_a_type : public boost::array< Value , 6 > | |
52 | { | |
53 | coef_a_type( void ) | |
54 | { | |
55 | (*this)[0] = static_cast< Value >( 0.40518861839525227722 ); | |
56 | (*this)[1] = static_cast< Value >( -0.28714404081652408900 ); | |
57 | (*this)[2] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - ( (*this)[0] + (*this)[1] ); | |
58 | (*this)[3] = (*this)[2]; | |
59 | (*this)[4] = (*this)[1]; | |
60 | (*this)[5] = (*this)[0]; | |
61 | ||
62 | } | |
63 | }; | |
64 | ||
65 | template< class Value > | |
66 | struct coef_b_type : public boost::array< Value , 6 > | |
67 | { | |
68 | coef_b_type( void ) | |
69 | { | |
70 | (*this)[0] = static_cast< Value >( -3 ) / static_cast< Value >( 73 ); | |
71 | (*this)[1] = static_cast< Value >( 17 ) / static_cast< Value >( 59 ); | |
72 | (*this)[2] = static_cast< Value >( 1 ) - static_cast< Value >( 2 ) * ( (*this)[0] + (*this)[1] ); | |
73 | (*this)[3] = (*this)[1]; | |
74 | (*this)[4] = (*this)[0]; | |
75 | (*this)[5] = static_cast< Value >( 0 ); | |
76 | } | |
77 | }; | |
78 | ||
79 | } // namespace symplectic_rkn_sb3a_mclachlan | |
80 | } // namespace detail | |
81 | #endif // DOXYGEN_SKIP | |
82 | ||
83 | ||
84 | ||
85 | template< | |
86 | class Coor , | |
87 | class Momentum = Coor , | |
88 | class Value = double , | |
89 | class CoorDeriv = Coor , | |
90 | class MomentumDeriv = Coor , | |
91 | class Time = Value , | |
92 | class Algebra = typename algebra_dispatcher< Coor >::algebra_type , | |
93 | class Operations = typename operations_dispatcher< Coor >::operations_type , | |
94 | class Resizer = initially_resizer | |
95 | > | |
96 | #ifndef DOXYGEN_SKIP | |
97 | class symplectic_rkn_sb3a_mclachlan : | |
98 | public symplectic_nystroem_stepper_base | |
99 | < | |
100 | 6 , 4 , | |
101 | Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer | |
102 | > | |
103 | #else | |
104 | class symplectic_rkn_sb3a_mclachlan : public symplectic_nystroem_stepper_base | |
105 | #endif | |
106 | { | |
107 | public: | |
108 | #ifndef DOXYGEN_SKIP | |
109 | typedef symplectic_nystroem_stepper_base | |
110 | < | |
111 | 6 , 4 , | |
112 | Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer | |
113 | > stepper_base_type; | |
114 | #endif | |
115 | typedef typename stepper_base_type::algebra_type algebra_type; | |
116 | typedef typename stepper_base_type::value_type value_type; | |
117 | ||
118 | ||
119 | symplectic_rkn_sb3a_mclachlan( const algebra_type &algebra = algebra_type() ) | |
120 | : stepper_base_type( | |
121 | detail::symplectic_rkn_sb3a_mclachlan::coef_a_type< value_type >() , | |
122 | detail::symplectic_rkn_sb3a_mclachlan::coef_b_type< value_type >() , | |
123 | algebra ) | |
124 | { } | |
125 | }; | |
126 | ||
127 | ||
128 | /************* DOXYGEN ***********/ | |
129 | ||
130 | /** | |
131 | * \class symplectic_rkn_sb3a_mclachlan | |
132 | * \brief Implement of the symmetric B3A method of Runge-Kutta-Nystroem method of sixth order. | |
133 | * | |
134 | * The method is of fourth order and has six stages. It is described HERE. This method cannot be used | |
135 | * with multiprecision types since the coefficients are not defined analytically. | |
136 | * | |
137 | * ToDo Add reference to the paper. | |
138 | * | |
139 | * \tparam Order The order of the stepper. | |
140 | * \tparam Coor The type representing the coordinates q. | |
141 | * \tparam Momentum The type representing the coordinates p. | |
142 | * \tparam Value The basic value type. Should be something like float, double or a high-precision type. | |
143 | * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt. | |
144 | * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt. | |
145 | * \tparam Time The type representing the time t. | |
146 | * \tparam Algebra The algebra. | |
147 | * \tparam Operations The operations. | |
148 | * \tparam Resizer The resizer policy. | |
149 | */ | |
150 | ||
151 | /** | |
152 | * \fn symplectic_rkn_sb3a_mclachlan::symplectic_rkn_sb3a_mclachlan( const algebra_type &algebra ) | |
153 | * \brief Constructs the symplectic_rkn_sb3a_mclachlan. This constructor can be used as a default | |
154 | * constructor if the algebra has a default constructor. | |
155 | * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. | |
156 | */ | |
157 | ||
158 | } // namespace odeint | |
159 | } // namespace numeric | |
160 | } // namespace boost | |
161 | ||
162 | #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED |