annotate DEPENDENCIES/generic/include/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /*
Chris@16 2 [auto_generated]
Chris@16 3 boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp
Chris@16 4
Chris@16 5 [begin_description]
Chris@16 6 Implementation of the Dormand-Prince 5(4) method. This stepper can also be used with the dense-output controlled stepper.
Chris@16 7 [end_description]
Chris@16 8
Chris@101 9 Copyright 2010-2013 Karsten Ahnert
Chris@101 10 Copyright 2010-2013 Mario Mulansky
Chris@101 11 Copyright 2012 Christoph Koke
Chris@16 12
Chris@16 13 Distributed under the Boost Software License, Version 1.0.
Chris@16 14 (See accompanying file LICENSE_1_0.txt or
Chris@16 15 copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 16 */
Chris@16 17
Chris@16 18
Chris@16 19 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
Chris@16 20 #define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
Chris@16 21
Chris@16 22
Chris@16 23 #include <boost/numeric/odeint/util/bind.hpp>
Chris@16 24
Chris@16 25 #include <boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp>
Chris@16 26 #include <boost/numeric/odeint/algebra/range_algebra.hpp>
Chris@16 27 #include <boost/numeric/odeint/algebra/default_operations.hpp>
Chris@101 28 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
Chris@101 29 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
Chris@16 30 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
Chris@16 31
Chris@16 32 #include <boost/numeric/odeint/util/state_wrapper.hpp>
Chris@16 33 #include <boost/numeric/odeint/util/is_resizeable.hpp>
Chris@16 34 #include <boost/numeric/odeint/util/resizer.hpp>
Chris@16 35 #include <boost/numeric/odeint/util/same_instance.hpp>
Chris@16 36
Chris@16 37 namespace boost {
Chris@16 38 namespace numeric {
Chris@16 39 namespace odeint {
Chris@16 40
Chris@16 41
Chris@16 42
Chris@16 43 template<
Chris@16 44 class State ,
Chris@16 45 class Value = double ,
Chris@16 46 class Deriv = State ,
Chris@16 47 class Time = Value ,
Chris@101 48 class Algebra = typename algebra_dispatcher< State >::algebra_type ,
Chris@101 49 class Operations = typename operations_dispatcher< State >::operations_type ,
Chris@16 50 class Resizer = initially_resizer
Chris@16 51 >
Chris@16 52 class runge_kutta_dopri5
Chris@16 53 #ifndef DOXYGEN_SKIP
Chris@16 54 : public explicit_error_stepper_fsal_base<
Chris@16 55 runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
Chris@16 56 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
Chris@16 57 #else
Chris@16 58 : public explicit_error_stepper_fsal_base
Chris@16 59 #endif
Chris@16 60 {
Chris@16 61
Chris@16 62 public :
Chris@16 63
Chris@16 64 #ifndef DOXYGEN_SKIP
Chris@16 65 typedef explicit_error_stepper_fsal_base<
Chris@16 66 runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
Chris@16 67 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
Chris@16 68 #else
Chris@16 69 typedef explicit_error_stepper_fsal_base< runge_kutta_dopri5< ... > , ... > stepper_base_type;
Chris@16 70 #endif
Chris@16 71
Chris@16 72 typedef typename stepper_base_type::state_type state_type;
Chris@16 73 typedef typename stepper_base_type::value_type value_type;
Chris@16 74 typedef typename stepper_base_type::deriv_type deriv_type;
Chris@16 75 typedef typename stepper_base_type::time_type time_type;
Chris@16 76 typedef typename stepper_base_type::algebra_type algebra_type;
Chris@16 77 typedef typename stepper_base_type::operations_type operations_type;
Chris@16 78 typedef typename stepper_base_type::resizer_type resizer_type;
Chris@16 79
Chris@16 80 #ifndef DOXYGEN_SKIP
Chris@16 81 typedef typename stepper_base_type::stepper_type stepper_type;
Chris@16 82 typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
Chris@16 83 typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
Chris@16 84 #endif // DOXYGEN_SKIP
Chris@16 85
Chris@16 86
Chris@16 87 runge_kutta_dopri5( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
Chris@16 88 { }
Chris@16 89
Chris@16 90
Chris@16 91 template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
Chris@16 92 void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t ,
Chris@16 93 StateOut &out , DerivOut &dxdt_out , time_type dt )
Chris@16 94 {
Chris@16 95 const value_type a2 = static_cast<value_type> ( 1 ) / static_cast<value_type>( 5 );
Chris@16 96 const value_type a3 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 10 );
Chris@16 97 const value_type a4 = static_cast<value_type> ( 4 ) / static_cast<value_type> ( 5 );
Chris@16 98 const value_type a5 = static_cast<value_type> ( 8 )/static_cast<value_type> ( 9 );
Chris@16 99
Chris@16 100 const value_type b21 = static_cast<value_type> ( 1 ) / static_cast<value_type> ( 5 );
Chris@16 101
Chris@16 102 const value_type b31 = static_cast<value_type> ( 3 ) / static_cast<value_type>( 40 );
Chris@16 103 const value_type b32 = static_cast<value_type> ( 9 ) / static_cast<value_type>( 40 );
Chris@16 104
Chris@16 105 const value_type b41 = static_cast<value_type> ( 44 ) / static_cast<value_type> ( 45 );
Chris@16 106 const value_type b42 = static_cast<value_type> ( -56 ) / static_cast<value_type> ( 15 );
Chris@16 107 const value_type b43 = static_cast<value_type> ( 32 ) / static_cast<value_type> ( 9 );
Chris@16 108
Chris@16 109 const value_type b51 = static_cast<value_type> ( 19372 ) / static_cast<value_type>( 6561 );
Chris@16 110 const value_type b52 = static_cast<value_type> ( -25360 ) / static_cast<value_type> ( 2187 );
Chris@16 111 const value_type b53 = static_cast<value_type> ( 64448 ) / static_cast<value_type>( 6561 );
Chris@16 112 const value_type b54 = static_cast<value_type> ( -212 ) / static_cast<value_type>( 729 );
Chris@16 113
Chris@16 114 const value_type b61 = static_cast<value_type> ( 9017 ) / static_cast<value_type>( 3168 );
Chris@16 115 const value_type b62 = static_cast<value_type> ( -355 ) / static_cast<value_type>( 33 );
Chris@16 116 const value_type b63 = static_cast<value_type> ( 46732 ) / static_cast<value_type>( 5247 );
Chris@16 117 const value_type b64 = static_cast<value_type> ( 49 ) / static_cast<value_type>( 176 );
Chris@16 118 const value_type b65 = static_cast<value_type> ( -5103 ) / static_cast<value_type>( 18656 );
Chris@16 119
Chris@16 120 const value_type c1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 );
Chris@16 121 const value_type c3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 );
Chris@16 122 const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 );
Chris@16 123 const value_type c5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 );
Chris@16 124 const value_type c6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 );
Chris@16 125
Chris@16 126 typename odeint::unwrap_reference< System >::type &sys = system;
Chris@16 127
Chris@16 128 m_k_x_tmp_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_k_x_tmp_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
Chris@16 129
Chris@16 130 //m_x_tmp = x + dt*b21*dxdt
Chris@16 131 stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , dxdt_in ,
Chris@16 132 typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) );
Chris@16 133
Chris@16 134 sys( m_x_tmp.m_v , m_k2.m_v , t + dt*a2 );
Chris@16 135 // m_x_tmp = x + dt*b31*dxdt + dt*b32*m_k2
Chris@16 136 stepper_base_type::m_algebra.for_each4( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v ,
Chris@16 137 typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
Chris@16 138
Chris@16 139 sys( m_x_tmp.m_v , m_k3.m_v , t + dt*a3 );
Chris@16 140 // m_x_tmp = x + dt * (b41*dxdt + b42*m_k2 + b43*m_k3)
Chris@16 141 stepper_base_type::m_algebra.for_each5( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v ,
Chris@16 142 typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
Chris@16 143
Chris@16 144 sys( m_x_tmp.m_v, m_k4.m_v , t + dt*a4 );
Chris@16 145 stepper_base_type::m_algebra.for_each6( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v , m_k4.m_v ,
Chris@16 146 typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
Chris@16 147
Chris@16 148 sys( m_x_tmp.m_v , m_k5.m_v , t + dt*a5 );
Chris@16 149 stepper_base_type::m_algebra.for_each7( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v ,
Chris@16 150 typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
Chris@16 151
Chris@16 152 sys( m_x_tmp.m_v , m_k6.m_v , t + dt );
Chris@16 153 stepper_base_type::m_algebra.for_each7( out , in , dxdt_in , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v ,
Chris@16 154 typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c5 , dt*c6 ));
Chris@16 155
Chris@16 156 // the new derivative
Chris@16 157 sys( out , dxdt_out , t + dt );
Chris@16 158 }
Chris@16 159
Chris@16 160
Chris@16 161
Chris@16 162 template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err >
Chris@16 163 void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t ,
Chris@16 164 StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr )
Chris@16 165 {
Chris@16 166 const value_type c1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 );
Chris@16 167 const value_type c3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 );
Chris@16 168 const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 );
Chris@16 169 const value_type c5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 );
Chris@16 170 const value_type c6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 );
Chris@16 171
Chris@16 172 const value_type dc1 = c1 - static_cast<value_type> ( 5179 ) / static_cast<value_type>( 57600 );
Chris@16 173 const value_type dc3 = c3 - static_cast<value_type> ( 7571 ) / static_cast<value_type>( 16695 );
Chris@16 174 const value_type dc4 = c4 - static_cast<value_type> ( 393 ) / static_cast<value_type>( 640 );
Chris@16 175 const value_type dc5 = c5 - static_cast<value_type> ( -92097 ) / static_cast<value_type>( 339200 );
Chris@16 176 const value_type dc6 = c6 - static_cast<value_type> ( 187 ) / static_cast<value_type>( 2100 );
Chris@16 177 const value_type dc7 = static_cast<value_type>( -1 ) / static_cast<value_type> ( 40 );
Chris@16 178
Chris@16 179 /* ToDo: copy only if &dxdt_in == &dxdt_out ? */
Chris@16 180 if( same_instance( dxdt_in , dxdt_out ) )
Chris@16 181 {
Chris@16 182 m_dxdt_tmp_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_dxdt_tmp_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
Chris@16 183 boost::numeric::odeint::copy( dxdt_in , m_dxdt_tmp.m_v );
Chris@16 184 do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
Chris@16 185 //error estimate
Chris@16 186 stepper_base_type::m_algebra.for_each7( xerr , m_dxdt_tmp.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , dxdt_out ,
Chris@16 187 typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) );
Chris@16 188
Chris@16 189 }
Chris@16 190 else
Chris@16 191 {
Chris@16 192 do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
Chris@16 193 //error estimate
Chris@16 194 stepper_base_type::m_algebra.for_each7( xerr , dxdt_in , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , dxdt_out ,
Chris@16 195 typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) );
Chris@16 196
Chris@16 197 }
Chris@16 198
Chris@16 199 }
Chris@16 200
Chris@16 201
Chris@16 202 /*
Chris@16 203 * Calculates Dense-Output for Dopri5
Chris@16 204 *
Chris@16 205 * See Hairer, Norsett, Wanner: Solving Ordinary Differential Equations, Nonstiff Problems. I, p.191/192
Chris@16 206 *
Chris@16 207 * y(t+theta) = y(t) + h * sum_i^7 b_i(theta) * k_i
Chris@16 208 *
Chris@16 209 * A = theta^2 * ( 3 - 2 theta )
Chris@16 210 * B = theta^2 * ( theta - 1 )
Chris@16 211 * C = theta^2 * ( theta - 1 )^2
Chris@16 212 * D = theta * ( theta - 1 )^2
Chris@16 213 *
Chris@16 214 * b_1( theta ) = A * b_1 - C * X1( theta ) + D
Chris@16 215 * b_2( theta ) = 0
Chris@16 216 * b_3( theta ) = A * b_3 + C * X3( theta )
Chris@16 217 * b_4( theta ) = A * b_4 - C * X4( theta )
Chris@16 218 * b_5( theta ) = A * b_5 + C * X5( theta )
Chris@16 219 * b_6( theta ) = A * b_6 - C * X6( theta )
Chris@16 220 * b_7( theta ) = B + C * X7( theta )
Chris@16 221 *
Chris@16 222 * An alternative Method is described in:
Chris@16 223 *
Chris@16 224 * www-m2.ma.tum.de/homepages/simeon/numerik3/kap3.ps
Chris@16 225 */
Chris@16 226 template< class StateOut , class StateIn1 , class DerivIn1 , class StateIn2 , class DerivIn2 >
Chris@16 227 void calc_state( time_type t , StateOut &x ,
Chris@16 228 const StateIn1 &x_old , const DerivIn1 &deriv_old , time_type t_old ,
Chris@16 229 const StateIn2 & /* x_new */ , const DerivIn2 &deriv_new , time_type t_new ) const
Chris@16 230 {
Chris@16 231 const value_type b1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 );
Chris@16 232 const value_type b3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 );
Chris@16 233 const value_type b4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 );
Chris@16 234 const value_type b5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 );
Chris@16 235 const value_type b6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 );
Chris@16 236
Chris@16 237 const time_type dt = ( t_new - t_old );
Chris@16 238 const value_type theta = ( t - t_old ) / dt;
Chris@16 239 const value_type X1 = static_cast< value_type >( 5 ) * ( static_cast< value_type >( 2558722523LL ) - static_cast< value_type >( 31403016 ) * theta ) / static_cast< value_type >( 11282082432LL );
Chris@16 240 const value_type X3 = static_cast< value_type >( 100 ) * ( static_cast< value_type >( 882725551 ) - static_cast< value_type >( 15701508 ) * theta ) / static_cast< value_type >( 32700410799LL );
Chris@16 241 const value_type X4 = static_cast< value_type >( 25 ) * ( static_cast< value_type >( 443332067 ) - static_cast< value_type >( 31403016 ) * theta ) / static_cast< value_type >( 1880347072LL ) ;
Chris@16 242 const value_type X5 = static_cast< value_type >( 32805 ) * ( static_cast< value_type >( 23143187 ) - static_cast< value_type >( 3489224 ) * theta ) / static_cast< value_type >( 199316789632LL );
Chris@16 243 const value_type X6 = static_cast< value_type >( 55 ) * ( static_cast< value_type >( 29972135 ) - static_cast< value_type >( 7076736 ) * theta ) / static_cast< value_type >( 822651844 );
Chris@16 244 const value_type X7 = static_cast< value_type >( 10 ) * ( static_cast< value_type >( 7414447 ) - static_cast< value_type >( 829305 ) * theta ) / static_cast< value_type >( 29380423 );
Chris@16 245
Chris@16 246 const value_type theta_m_1 = theta - static_cast< value_type >( 1 );
Chris@16 247 const value_type theta_sq = theta * theta;
Chris@16 248 const value_type A = theta_sq * ( static_cast< value_type >( 3 ) - static_cast< value_type >( 2 ) * theta );
Chris@16 249 const value_type B = theta_sq * theta_m_1;
Chris@16 250 const value_type C = theta_sq * theta_m_1 * theta_m_1;
Chris@16 251 const value_type D = theta * theta_m_1 * theta_m_1;
Chris@16 252
Chris@16 253 const value_type b1_theta = A * b1 - C * X1 + D;
Chris@16 254 const value_type b3_theta = A * b3 + C * X3;
Chris@16 255 const value_type b4_theta = A * b4 - C * X4;
Chris@16 256 const value_type b5_theta = A * b5 + C * X5;
Chris@16 257 const value_type b6_theta = A * b6 - C * X6;
Chris@16 258 const value_type b7_theta = B + C * X7;
Chris@16 259
Chris@16 260 // const state_type &k1 = *m_old_deriv;
Chris@16 261 // const state_type &k3 = dopri5().m_k3;
Chris@16 262 // const state_type &k4 = dopri5().m_k4;
Chris@16 263 // const state_type &k5 = dopri5().m_k5;
Chris@16 264 // const state_type &k6 = dopri5().m_k6;
Chris@16 265 // const state_type &k7 = *m_current_deriv;
Chris@16 266
Chris@16 267 stepper_base_type::m_algebra.for_each8( x , x_old , deriv_old , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , deriv_new ,
Chris@16 268 typename operations_type::template scale_sum7< value_type , time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt * b1_theta , dt * b3_theta , dt * b4_theta , dt * b5_theta , dt * b6_theta , dt * b7_theta ) );
Chris@16 269 }
Chris@16 270
Chris@16 271
Chris@16 272 template< class StateIn >
Chris@16 273 void adjust_size( const StateIn &x )
Chris@16 274 {
Chris@16 275 resize_k_x_tmp_impl( x );
Chris@16 276 resize_dxdt_tmp_impl( x );
Chris@16 277 stepper_base_type::adjust_size( x );
Chris@16 278 }
Chris@16 279
Chris@16 280
Chris@16 281 private:
Chris@16 282
Chris@16 283 template< class StateIn >
Chris@16 284 bool resize_k_x_tmp_impl( const StateIn &x )
Chris@16 285 {
Chris@16 286 bool resized = false;
Chris@16 287 resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() );
Chris@16 288 resized |= adjust_size_by_resizeability( m_k2 , x , typename is_resizeable<deriv_type>::type() );
Chris@16 289 resized |= adjust_size_by_resizeability( m_k3 , x , typename is_resizeable<deriv_type>::type() );
Chris@16 290 resized |= adjust_size_by_resizeability( m_k4 , x , typename is_resizeable<deriv_type>::type() );
Chris@16 291 resized |= adjust_size_by_resizeability( m_k5 , x , typename is_resizeable<deriv_type>::type() );
Chris@16 292 resized |= adjust_size_by_resizeability( m_k6 , x , typename is_resizeable<deriv_type>::type() );
Chris@16 293 return resized;
Chris@16 294 }
Chris@16 295
Chris@16 296 template< class StateIn >
Chris@16 297 bool resize_dxdt_tmp_impl( const StateIn &x )
Chris@16 298 {
Chris@16 299 return adjust_size_by_resizeability( m_dxdt_tmp , x , typename is_resizeable<deriv_type>::type() );
Chris@16 300 }
Chris@16 301
Chris@16 302
Chris@16 303
Chris@16 304 wrapped_state_type m_x_tmp;
Chris@16 305 wrapped_deriv_type m_k2 , m_k3 , m_k4 , m_k5 , m_k6 ;
Chris@16 306 wrapped_deriv_type m_dxdt_tmp;
Chris@16 307 resizer_type m_k_x_tmp_resizer;
Chris@16 308 resizer_type m_dxdt_tmp_resizer;
Chris@16 309 };
Chris@16 310
Chris@16 311
Chris@16 312
Chris@16 313 /************* DOXYGEN ************/
Chris@16 314 /**
Chris@16 315 * \class runge_kutta_dopri5
Chris@16 316 * \brief The Runge-Kutta Dormand-Prince 5 method.
Chris@16 317 *
Chris@16 318 * The Runge-Kutta Dormand-Prince 5 method is a very popular method for solving ODEs, see
Chris@16 319 * <a href=""></a>.
Chris@16 320 * The method is explicit and fulfills the Error Stepper concept. Step size control
Chris@16 321 * is provided but continuous output is available which make this method favourable for many applications.
Chris@16 322 *
Chris@16 323 * This class derives from explicit_error_stepper_fsal_base and inherits its interface via CRTP (current recurring
Chris@16 324 * template pattern). The method possesses the FSAL (first-same-as-last) property. See
Chris@16 325 * explicit_error_stepper_fsal_base for more details.
Chris@16 326 *
Chris@16 327 * \tparam State The state type.
Chris@16 328 * \tparam Value The value type.
Chris@16 329 * \tparam Deriv The type representing the time derivative of the state.
Chris@16 330 * \tparam Time The time representing the independent variable - the time.
Chris@16 331 * \tparam Algebra The algebra type.
Chris@16 332 * \tparam Operations The operations type.
Chris@16 333 * \tparam Resizer The resizer policy type.
Chris@16 334 */
Chris@16 335
Chris@16 336
Chris@16 337 /**
Chris@16 338 * \fn runge_kutta_dopri5::runge_kutta_dopri5( const algebra_type &algebra )
Chris@16 339 * \brief Constructs the runge_kutta_dopri5 class. This constructor can be used as a default
Chris@16 340 * constructor if the algebra has a default constructor.
Chris@16 341 * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
Chris@16 342 */
Chris@16 343
Chris@16 344 /**
Chris@16 345 * \fn runge_kutta_dopri5::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt )
Chris@16 346 * \brief This method performs one step. The derivative `dxdt_in` of `in` at the time `t` is passed to the
Chris@16 347 * method. The result is updated out-of-place, hence the input is in `in` and the output in `out`. Furthermore,
Chris@16 348 * the derivative is update out-of-place, hence the input is assumed to be in `dxdt_in` and the output in
Chris@16 349 * `dxdt_out`.
Chris@16 350 * Access to this step functionality is provided by explicit_error_stepper_fsal_base and
Chris@16 351 * `do_step_impl` should not be called directly.
Chris@16 352 *
Chris@16 353 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
Chris@16 354 * Simple System concept.
Chris@16 355 * \param in The state of the ODE which should be solved. in is not modified in this method
Chris@16 356 * \param dxdt_in The derivative of x at t. dxdt_in is not modified by this method
Chris@16 357 * \param t The value of the time, at which the step should be performed.
Chris@16 358 * \param out The result of the step is written in out.
Chris@16 359 * \param dxdt_out The result of the new derivative at time t+dt.
Chris@16 360 * \param dt The step size.
Chris@16 361 */
Chris@16 362
Chris@16 363 /**
Chris@16 364 * \fn runge_kutta_dopri5::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr )
Chris@16 365 * \brief This method performs one step. The derivative `dxdt_in` of `in` at the time `t` is passed to the
Chris@16 366 * method. The result is updated out-of-place, hence the input is in `in` and the output in `out`. Furthermore,
Chris@16 367 * the derivative is update out-of-place, hence the input is assumed to be in `dxdt_in` and the output in
Chris@16 368 * `dxdt_out`.
Chris@16 369 * Access to this step functionality is provided by explicit_error_stepper_fsal_base and
Chris@16 370 * `do_step_impl` should not be called directly.
Chris@16 371 * An estimation of the error is calculated.
Chris@16 372 *
Chris@16 373 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
Chris@16 374 * Simple System concept.
Chris@16 375 * \param in The state of the ODE which should be solved. in is not modified in this method
Chris@16 376 * \param dxdt_in The derivative of x at t. dxdt_in is not modified by this method
Chris@16 377 * \param t The value of the time, at which the step should be performed.
Chris@16 378 * \param out The result of the step is written in out.
Chris@16 379 * \param dxdt_out The result of the new derivative at time t+dt.
Chris@16 380 * \param dt The step size.
Chris@16 381 * \param xerr An estimation of the error.
Chris@16 382 */
Chris@16 383
Chris@16 384 /**
Chris@16 385 * \fn runge_kutta_dopri5::calc_state( time_type t , StateOut &x , const StateIn1 &x_old , const DerivIn1 &deriv_old , time_type t_old , const StateIn2 & , const DerivIn2 &deriv_new , time_type t_new ) const
Chris@16 386 * \brief This method is used for continuous output and it calculates the state `x` at a time `t` from the
Chris@16 387 * knowledge of two states `old_state` and `current_state` at time points `t_old` and `t_new`. It also uses
Chris@16 388 * internal variables to calculate the result. Hence this method must be called after two successful `do_step`
Chris@16 389 * calls.
Chris@16 390 */
Chris@16 391
Chris@16 392 /**
Chris@16 393 * \fn runge_kutta_dopri5::adjust_size( const StateIn &x )
Chris@16 394 * \brief Adjust the size of all temporaries in the stepper manually.
Chris@16 395 * \param x A state from which the size of the temporaries to be resized is deduced.
Chris@16 396 */
Chris@16 397
Chris@16 398 } // odeint
Chris@16 399 } // numeric
Chris@16 400 } // boost
Chris@16 401
Chris@16 402
Chris@16 403 #endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED