Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/numeric/odeint/stepper/adams_moulton.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
5 [begin_description] | 5 [begin_description] |
6 Implementation of the Adams-Moulton method. This is method is not a real stepper, it is more a helper class | 6 Implementation of the Adams-Moulton method. This is method is not a real stepper, it is more a helper class |
7 which computes the corrector step in the Adams-Bashforth-Moulton method. | 7 which computes the corrector step in the Adams-Bashforth-Moulton method. |
8 [end_description] | 8 [end_description] |
9 | 9 |
10 Copyright 2009-2011 Karsten Ahnert | 10 Copyright 2011-2012 Karsten Ahnert |
11 Copyright 2009-2011 Mario Mulansky | 11 Copyright 2011-2013 Mario Mulansky |
12 Copyright 2012 Christoph Koke | |
12 | 13 |
13 Distributed under the Boost Software License, Version 1.0. | 14 Distributed under the Boost Software License, Version 1.0. |
14 (See accompanying file LICENSE_1_0.txt or | 15 (See accompanying file LICENSE_1_0.txt or |
15 copy at http://www.boost.org/LICENSE_1_0.txt) | 16 copy at http://www.boost.org/LICENSE_1_0.txt) |
16 */ | 17 */ |
22 | 23 |
23 #include <boost/numeric/odeint/util/bind.hpp> | 24 #include <boost/numeric/odeint/util/bind.hpp> |
24 | 25 |
25 #include <boost/numeric/odeint/algebra/range_algebra.hpp> | 26 #include <boost/numeric/odeint/algebra/range_algebra.hpp> |
26 #include <boost/numeric/odeint/algebra/default_operations.hpp> | 27 #include <boost/numeric/odeint/algebra/default_operations.hpp> |
28 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> | |
29 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> | |
27 | 30 |
28 #include <boost/numeric/odeint/util/state_wrapper.hpp> | 31 #include <boost/numeric/odeint/util/state_wrapper.hpp> |
29 #include <boost/numeric/odeint/util/is_resizeable.hpp> | 32 #include <boost/numeric/odeint/util/is_resizeable.hpp> |
30 #include <boost/numeric/odeint/util/resizer.hpp> | 33 #include <boost/numeric/odeint/util/resizer.hpp> |
31 | 34 |
33 #include <boost/numeric/odeint/stepper/runge_kutta4_classic.hpp> | 36 #include <boost/numeric/odeint/stepper/runge_kutta4_classic.hpp> |
34 | 37 |
35 #include <boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp> | 38 #include <boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp> |
36 #include <boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp> | 39 #include <boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp> |
37 #include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp> | 40 #include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp> |
38 | |
39 | |
40 | 41 |
41 | 42 |
42 | 43 |
43 | 44 |
44 namespace boost { | 45 namespace boost { |
53 size_t Steps , | 54 size_t Steps , |
54 class State , | 55 class State , |
55 class Value = double , | 56 class Value = double , |
56 class Deriv = State , | 57 class Deriv = State , |
57 class Time = Value , | 58 class Time = Value , |
58 class Algebra = range_algebra , | 59 class Algebra = typename algebra_dispatcher< State >::algebra_type , |
59 class Operations = default_operations , | 60 class Operations = typename operations_dispatcher< State >::operations_type , |
60 class Resizer = initially_resizer | 61 class Resizer = initially_resizer |
61 > | 62 > |
62 class adams_moulton | 63 class adams_moulton |
63 { | 64 { |
64 private: | 65 private: |
110 /* | 111 /* |
111 * Version 1 : do_step( system , x , t , dt , buf ); | 112 * Version 1 : do_step( system , x , t , dt , buf ); |
112 * | 113 * |
113 * solves the forwarding problem | 114 * solves the forwarding problem |
114 */ | 115 */ |
115 template< class System , class StateInOut , class ABBuf > | 116 template< class System , class StateInOut , class StateIn , class ABBuf > |
116 void do_step( System system , StateInOut &in , time_type t , time_type dt , const ABBuf &buf ) | 117 void do_step( System system , StateInOut &x , StateIn const & pred , time_type t , time_type dt , const ABBuf &buf ) |
117 { | 118 { |
118 do_step( system , in , t , in , dt , buf ); | 119 do_step( system , x , pred , t , x , dt , buf ); |
119 } | 120 } |
120 | 121 |
121 template< class System , class StateInOut , class ABBuf > | 122 template< class System , class StateInOut , class StateIn , class ABBuf > |
122 void do_step( System system , const StateInOut &in , time_type t , time_type dt , const ABBuf &buf ) | 123 void do_step( System system , const StateInOut &x , StateIn const & pred , time_type t , time_type dt , const ABBuf &buf ) |
123 { | 124 { |
124 do_step( system , in , t , in , dt , buf ); | 125 do_step( system , x , pred , t , x , dt , buf ); |
125 } | 126 } |
126 | 127 |
127 | 128 |
128 | 129 |
129 /* | 130 /* |
130 * Version 2 : do_step( system , in , t , out , dt , buf ); | 131 * Version 2 : do_step( system , in , t , out , dt , buf ); |
131 * | 132 * |
132 * solves the forwarding problem | 133 * solves the forwarding problem |
133 */ | 134 */ |
134 template< class System , class StateIn , class StateOut , class ABBuf > | 135 template< class System , class StateIn , class PredIn , class StateOut , class ABBuf > |
135 void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , const ABBuf &buf ) | 136 void do_step( System system , const StateIn &in , const PredIn &pred , time_type t , StateOut &out , time_type dt , const ABBuf &buf ) |
137 { | |
138 do_step_impl( system , in , pred , t , out , dt , buf ); | |
139 } | |
140 | |
141 template< class System , class StateIn , class PredIn , class StateOut , class ABBuf > | |
142 void do_step( System system , const StateIn &in , const PredIn &pred , time_type t , const StateOut &out , time_type dt , const ABBuf &buf ) | |
143 { | |
144 do_step_impl( system , in , pred , t , out , dt , buf ); | |
145 } | |
146 | |
147 | |
148 | |
149 template< class StateType > | |
150 void adjust_size( const StateType &x ) | |
151 { | |
152 resize_impl( x ); | |
153 } | |
154 | |
155 algebra_type& algebra() | |
156 { return m_algebra; } | |
157 | |
158 const algebra_type& algebra() const | |
159 { return m_algebra; } | |
160 | |
161 | |
162 private: | |
163 | |
164 | |
165 template< class System , class StateIn , class PredIn , class StateOut , class ABBuf > | |
166 void do_step_impl( System system , const StateIn &in , const PredIn &pred , time_type t , StateOut &out , time_type dt , const ABBuf &buf ) | |
136 { | 167 { |
137 typename odeint::unwrap_reference< System >::type &sys = system; | 168 typename odeint::unwrap_reference< System >::type &sys = system; |
138 m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); | 169 m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); |
139 sys( in , m_dxdt.m_v , t ); | 170 sys( pred , m_dxdt.m_v , t ); |
140 detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( m_algebra , in , out , m_dxdt.m_v , buf , m_coefficients , dt ); | 171 detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( m_algebra , in , out , m_dxdt.m_v , buf , m_coefficients , dt ); |
141 } | 172 } |
142 | 173 |
143 template< class System , class StateIn , class StateOut , class ABBuf > | |
144 void do_step( System system , const StateIn &in , time_type t , const StateOut &out , time_type dt , const ABBuf &buf ) | |
145 { | |
146 typename odeint::unwrap_reference< System >::type &sys = system; | |
147 m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ); | |
148 sys( in , m_dxdt.m_v , t ); | |
149 detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( m_algebra , in , out , m_dxdt.m_v , buf , m_coefficients , dt ); | |
150 } | |
151 | |
152 | |
153 | |
154 template< class StateType > | |
155 void adjust_size( const StateType &x ) | |
156 { | |
157 resize_impl( x ); | |
158 } | |
159 | |
160 algebra_type& algebra() | |
161 { return m_algebra; } | |
162 | |
163 const algebra_type& algebra() const | |
164 { return m_algebra; } | |
165 | |
166 | |
167 private: | |
168 | 174 |
169 template< class StateIn > | 175 template< class StateIn > |
170 bool resize_impl( const StateIn &x ) | 176 bool resize_impl( const StateIn &x ) |
171 { | 177 { |
172 return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); | 178 return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); |