|
||||
File indexing completed on 2025-01-18 09:42:54
0001 /* 0002 [auto_generated] 0003 boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp 0004 0005 [begin_description] 0006 Base class for all explicit first-same-as-last Runge Kutta steppers. 0007 [end_description] 0008 0009 Copyright 2010-2013 Karsten Ahnert 0010 Copyright 2010-2012 Mario Mulansky 0011 Copyright 2012 Christoph Koke 0012 0013 Distributed under the Boost Software License, Version 1.0. 0014 (See accompanying file LICENSE_1_0.txt or 0015 copy at http://www.boost.org/LICENSE_1_0.txt) 0016 */ 0017 0018 0019 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED 0020 #define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED 0021 0022 #include <boost/utility/enable_if.hpp> 0023 #include <boost/type_traits/is_same.hpp> 0024 0025 0026 #include <boost/numeric/odeint/util/bind.hpp> 0027 #include <boost/numeric/odeint/util/unwrap_reference.hpp> 0028 #include <boost/numeric/odeint/util/state_wrapper.hpp> 0029 #include <boost/numeric/odeint/util/is_resizeable.hpp> 0030 #include <boost/numeric/odeint/util/resizer.hpp> 0031 #include <boost/numeric/odeint/util/copy.hpp> 0032 0033 #include <boost/numeric/odeint/stepper/stepper_categories.hpp> 0034 0035 #include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp> 0036 0037 namespace boost { 0038 namespace numeric { 0039 namespace odeint { 0040 0041 /* 0042 * base class for explicit stepper and error steppers with the fsal property 0043 * models the stepper AND the error stepper fsal concept 0044 * 0045 * this class provides the following do_step overloads 0046 * do_step( sys , x , t , dt ) 0047 * do_step( sys , x , dxdt , t , dt ) 0048 * do_step( sys , in , t , out , dt ) 0049 * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt ) 0050 * do_step( sys , x , t , dt , xerr ) 0051 * do_step( sys , x , dxdt , t , dt , xerr ) 0052 * do_step( sys , in , t , out , dt , xerr ) 0053 * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr ) 0054 */ 0055 template< 0056 class Stepper , 0057 unsigned short Order , 0058 unsigned short StepperOrder , 0059 unsigned short ErrorOrder , 0060 class State , 0061 class Value , 0062 class Deriv , 0063 class Time , 0064 class Algebra , 0065 class Operations , 0066 class Resizer 0067 > 0068 class explicit_error_stepper_fsal_base : public algebra_stepper_base< Algebra , Operations > 0069 { 0070 public: 0071 0072 typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type; 0073 typedef typename algebra_stepper_base_type::algebra_type algebra_type; 0074 0075 typedef State state_type; 0076 typedef Value value_type; 0077 typedef Deriv deriv_type; 0078 typedef Time time_type; 0079 typedef Resizer resizer_type; 0080 typedef Stepper stepper_type; 0081 typedef explicit_error_stepper_fsal_tag stepper_category; 0082 0083 #ifndef DOXYGEN_SKIP 0084 typedef state_wrapper< state_type > wrapped_state_type; 0085 typedef state_wrapper< deriv_type > wrapped_deriv_type; 0086 typedef explicit_error_stepper_fsal_base< Stepper , Order , StepperOrder , ErrorOrder , 0087 State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type; 0088 #endif 0089 0090 0091 typedef unsigned short order_type; 0092 static const order_type order_value = Order; 0093 static const order_type stepper_order_value = StepperOrder; 0094 static const order_type error_order_value = ErrorOrder; 0095 0096 explicit_error_stepper_fsal_base( const algebra_type &algebra = algebra_type() ) 0097 : algebra_stepper_base_type( algebra ) , m_first_call( true ) 0098 { } 0099 0100 order_type order( void ) const 0101 { 0102 return order_value; 0103 } 0104 0105 order_type stepper_order( void ) const 0106 { 0107 return stepper_order_value; 0108 } 0109 0110 order_type error_order( void ) const 0111 { 0112 return error_order_value; 0113 } 0114 0115 0116 /* 0117 * version 1 : do_step( sys , x , t , dt ) 0118 * 0119 * the two overloads are needed in order to solve the forwarding problem 0120 */ 0121 template< class System , class StateInOut > 0122 void do_step( System system , StateInOut &x , time_type t , time_type dt ) 0123 { 0124 do_step_v1( system , x , t , dt ); 0125 } 0126 0127 /** 0128 * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. 0129 */ 0130 template< class System , class StateInOut > 0131 void do_step( System system , const StateInOut &x , time_type t , time_type dt ) 0132 { 0133 do_step_v1( system , x , t , dt ); 0134 } 0135 0136 0137 /* 0138 * version 2 : do_step( sys , x , dxdt , t , dt ) 0139 * 0140 * this version does not solve the forwarding problem, boost.range can not be used 0141 * 0142 * the disable is needed to avoid ambiguous overloads if state_type = time_type 0143 */ 0144 template< class System , class StateInOut , class DerivInOut > 0145 typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type 0146 do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt ) 0147 { 0148 m_first_call = true; 0149 this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt ); 0150 } 0151 0152 0153 /* 0154 * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt ) 0155 * 0156 * this version is needed when this stepper is used for initializing 0157 * multistep stepper like adams-bashforth. Hence we provide an explicitely 0158 * named version that is not disabled. Meant for internal use only. 0159 */ 0160 template< class System , class StateInOut , class DerivInOut > 0161 void do_step_dxdt_impl( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt ) 0162 { 0163 m_first_call = true; 0164 this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt ); 0165 } 0166 0167 /* 0168 * version 3 : do_step( sys , in , t , out , dt ) 0169 * 0170 * this version does not solve the forwarding problem, boost.range can not 0171 * be used. 0172 * 0173 * the disable is needed to avoid ambiguous overloads if 0174 * state_type = time_type 0175 */ 0176 template< class System , class StateIn , class StateOut > 0177 typename boost::disable_if< boost::is_same< StateIn , time_type > , void >::type 0178 do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) 0179 { 0180 if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) 0181 { 0182 initialize( system , in , t ); 0183 } 0184 this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt ); 0185 } 0186 0187 0188 /* 0189 * version 4 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt ) 0190 * 0191 * this version does not solve the forwarding problem, boost.range can not be used 0192 */ 0193 template< class System, class StateIn, class DerivIn, class StateOut, 0194 class DerivOut > 0195 void do_step( System system, const StateIn &in, const DerivIn &dxdt_in, 0196 time_type t, StateOut &out, DerivOut &dxdt_out, time_type dt ) 0197 { 0198 m_first_call = true; 0199 this->stepper().do_step_impl( system, in, dxdt_in, t, out, dxdt_out, 0200 dt ); 0201 } 0202 0203 0204 0205 0206 0207 /* 0208 * version 5 : do_step( sys , x , t , dt , xerr ) 0209 * 0210 * the two overloads are needed in order to solve the forwarding problem 0211 */ 0212 template< class System , class StateInOut , class Err > 0213 void do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) 0214 { 0215 do_step_v5( system , x , t , dt , xerr ); 0216 } 0217 0218 /** 0219 * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. 0220 */ 0221 template< class System , class StateInOut , class Err > 0222 void do_step( System system , const StateInOut &x , time_type t , time_type dt , Err &xerr ) 0223 { 0224 do_step_v5( system , x , t , dt , xerr ); 0225 } 0226 0227 0228 /* 0229 * version 6 : do_step( sys , x , dxdt , t , dt , xerr ) 0230 * 0231 * this version does not solve the forwarding problem, boost.range can not be used 0232 * 0233 * the disable is needed to avoid ambiguous overloads if state_type = time_type 0234 */ 0235 template< class System , class StateInOut , class DerivInOut , class Err > 0236 typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type 0237 do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt , Err &xerr ) 0238 { 0239 m_first_call = true; 0240 this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt , xerr ); 0241 } 0242 0243 0244 0245 0246 /* 0247 * version 7 : do_step( sys , in , t , out , dt , xerr ) 0248 * 0249 * this version does not solve the forwarding problem, boost.range can not be used 0250 */ 0251 template< class System , class StateIn , class StateOut , class Err > 0252 void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr ) 0253 { 0254 if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) 0255 { 0256 initialize( system , in , t ); 0257 } 0258 this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt , xerr ); 0259 } 0260 0261 0262 /* 0263 * version 8 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr ) 0264 * 0265 * this version does not solve the forwarding problem, boost.range can not be used 0266 */ 0267 template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err > 0268 void do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , 0269 StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr ) 0270 { 0271 m_first_call = true; 0272 this->stepper().do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr ); 0273 } 0274 0275 template< class StateIn > 0276 void adjust_size( const StateIn &x ) 0277 { 0278 resize_impl( x ); 0279 } 0280 0281 void reset( void ) 0282 { 0283 m_first_call = true; 0284 } 0285 0286 template< class DerivIn > 0287 void initialize( const DerivIn &deriv ) 0288 { 0289 boost::numeric::odeint::copy( deriv , m_dxdt.m_v ); 0290 m_first_call = false; 0291 } 0292 0293 template< class System , class StateIn > 0294 void initialize( System system , const StateIn &x , time_type t ) 0295 { 0296 typename odeint::unwrap_reference< System >::type &sys = system; 0297 sys( x , m_dxdt.m_v , t ); 0298 m_first_call = false; 0299 } 0300 0301 bool is_initialized( void ) const 0302 { 0303 return ! m_first_call; 0304 } 0305 0306 0307 0308 private: 0309 0310 template< class System , class StateInOut > 0311 void do_step_v1( System system , StateInOut &x , time_type t , time_type dt ) 0312 { 0313 if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) 0314 { 0315 initialize( system , x , t ); 0316 } 0317 this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt ); 0318 } 0319 0320 template< class System , class StateInOut , class Err > 0321 void do_step_v5( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) 0322 { 0323 if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) 0324 { 0325 initialize( system , x , t ); 0326 } 0327 this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt , xerr ); 0328 } 0329 0330 template< class StateIn > 0331 bool resize_impl( const StateIn &x ) 0332 { 0333 return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); 0334 } 0335 0336 0337 stepper_type& stepper( void ) 0338 { 0339 return *static_cast< stepper_type* >( this ); 0340 } 0341 0342 const stepper_type& stepper( void ) const 0343 { 0344 return *static_cast< const stepper_type* >( this ); 0345 } 0346 0347 0348 resizer_type m_resizer; 0349 bool m_first_call; 0350 0351 protected: 0352 0353 0354 wrapped_deriv_type m_dxdt; 0355 }; 0356 0357 0358 /******* DOXYGEN *******/ 0359 0360 /** 0361 * \class explicit_error_stepper_fsal_base 0362 * \brief Base class for explicit steppers with error estimation and stepper fulfilling the FSAL (first-same-as-last) 0363 * property. This class can be used with controlled steppers for step size control. 0364 * 0365 * This class serves as the base class for all explicit steppers with algebra and operations and which fulfill the FSAL 0366 * property. In contrast to explicit_stepper_base it also estimates the error and can be used in a controlled stepper 0367 * to provide step size control. 0368 * 0369 * The FSAL property means that the derivative of the system at t+dt is already used in the current step going from 0370 * t to t +dt. Therefore, some more do_steps method can be introduced and the controlled steppers can explicitly make use 0371 * of this property. 0372 * 0373 * \note This stepper provides `do_step` methods with and without error estimation. It has therefore three orders, 0374 * one for the order of a step if the error is not estimated. The other two orders are the orders of the step and 0375 * the error step if the error estimation is performed. 0376 * 0377 * explicit_error_stepper_fsal_base is used as the interface in a CRTP (currently recurring template 0378 * pattern). In order to work correctly the parent class needs to have a method 0379 * `do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr )`. 0380 * explicit_error_stepper_fsal_base derives from algebra_stepper_base. 0381 * 0382 * This class can have an intrinsic state depending on the explicit usage of the `do_step` method. This means that some 0383 * `do_step` methods are expected to be called in order. For example the `do_step( sys , x , t , dt , xerr )` will keep track 0384 * of the derivative of `x` which is the internal state. The first call of this method is recognized such that one 0385 * does not explicitly initialize the internal state, so it is safe to use this method like 0386 * 0387 * \code 0388 * stepper_type stepper; 0389 * stepper.do_step( sys , x , t , dt , xerr ); 0390 * stepper.do_step( sys , x , t , dt , xerr ); 0391 * stepper.do_step( sys , x , t , dt , xerr ); 0392 * \endcode 0393 * 0394 * But it is unsafe to call this method with different system functions after each other. Do do so, one must initialize the 0395 * internal state with the `initialize` method or reset the internal state with the `reset` method. 0396 * 0397 * explicit_error_stepper_fsal_base provides several overloaded `do_step` methods, see the list below. Only two of them are needed 0398 * to fulfill the Error Stepper concept. The other ones are for convenience and for better performance. Some of them 0399 * simply update the state out-of-place, while other expect that the first derivative at `t` is passed to the stepper. 0400 * 0401 * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fulfill the Error Stepper concept. The 0402 * state is updated in-place. A type modelling a Boost.Range can be used for x. 0403 * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state x and the derivative dxdt in-place. It is expected 0404 * that dxdt has the value of the derivative of x at time t. 0405 * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step 0406 * is stored in `out`. 0407 * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )` - This method updates the state and the derivative 0408 * out-of-place. It expects that the derivative at the point `t` is explicitly passed in `dxdt_in`. 0409 * - `do_step( sys , x , t , dt , xerr )` - This `do_step` method is needed to fulfill the Error Stepper concept. The 0410 * state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x. 0411 * - `do_step( sys , x , dxdt , t , dt , xerr )` - This method updates the state and the derivative in-place. It is assumed 0412 * that the dxdt has the value of the derivative of x at time t. An error estimate is calculated. 0413 * - `do_step( sys , in , t , out , dt , xerr )` - This method updates the state out-of-place and estimates the error 0414 * during the step. 0415 * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )` - This methods updates the state and the derivative 0416 * out-of-place and estimates the error during the step. It is assumed the dxdt_in is derivative of in at time t. 0417 * 0418 * \note The system is always passed as value, which might result in poor performance if it contains data. In this 0419 * case it can be used with `boost::ref` or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );` 0420 * 0421 * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate` 0422 * routines or `iterator`s. 0423 * 0424 * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base 0425 * provides the interface for the Stepper. 0426 * \tparam Order The order of a stepper if the stepper is used without error estimation. 0427 * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have 0428 * the same value. 0429 * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation. 0430 * \tparam State The state type for the stepper. 0431 * \tparam Value The value type for the stepper. This should be a floating point type, like float, 0432 * double, or a multiprecision type. It must not necessary be the value_type of the State. For example 0433 * the State can be a `vector< complex< double > >` in this case the Value must be double. 0434 * The default value is double. 0435 * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the 0436 * state type, only if used with Boost.Units both types differ. 0437 * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is 0438 * used, this type has usually a unit. 0439 * \tparam Algebra The algebra type which must fulfill the Algebra Concept. 0440 * \tparam Operations The type for the operations which must fulfill the Operations Concept. 0441 * \tparam Resizer The resizer policy class. 0442 */ 0443 0444 0445 0446 /** 0447 * \fn explicit_error_stepper_fsal_base::explicit_error_stepper_fsal_base( const algebra_type &algebra ) 0448 * \brief Constructs a explicit_stepper_fsal_base class. This constructor can be used as a default 0449 * constructor if the algebra has a default constructor. 0450 * \param algebra A copy of algebra is made and stored inside explicit_stepper_base. 0451 */ 0452 0453 0454 /** 0455 * \fn explicit_error_stepper_fsal_base::order( void ) const 0456 * \return Returns the order of the stepper if it used without error estimation. 0457 */ 0458 0459 /** 0460 * \fn explicit_error_stepper_fsal_base::stepper_order( void ) const 0461 * \return Returns the order of a step if the stepper is used without error estimation. 0462 */ 0463 0464 0465 /** 0466 * \fn explicit_error_stepper_fsal_base::error_order( void ) const 0467 * \return Returns the order of an error step if the stepper is used without error estimation. 0468 */ 0469 0470 /** 0471 * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , time_type t , time_type dt ) 0472 * \brief This method performs one step. It transforms the result in-place. 0473 * 0474 * \note This method uses the internal state of the stepper. 0475 * 0476 * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the 0477 * Simple System concept. 0478 * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. 0479 * \param t The value of the time, at which the step should be performed. 0480 * \param dt The step size. 0481 */ 0482 0483 0484 /** 0485 * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt ) 0486 * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other methods 0487 * the derivative of x is also passed to this method. Therefore, dxdt must be evaluated initially: 0488 * 0489 * \code 0490 * ode( x , dxdt , t ); 0491 * for( ... ) 0492 * { 0493 * stepper.do_step( ode , x , dxdt , t , dt ); 0494 * t += dt; 0495 * } 0496 * \endcode 0497 * 0498 * \note This method does NOT use the initial state, since the first derivative is explicitly passed to this method. 0499 * 0500 * The result is updated in place in x as well as the derivative dxdt. This method is disabled if 0501 * Time and StateInOut are of the same type. In this case the method could not be distinguished from other `do_step` 0502 * versions. 0503 * 0504 * \note This method does not solve the forwarding problem. 0505 * 0506 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the 0507 * Simple System concept. 0508 * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. 0509 * \param dxdt The derivative of x at t. After calling `do_step` dxdt is updated to the new value. 0510 * \param t The value of the time, at which the step should be performed. 0511 * \param dt The step size. 0512 */ 0513 0514 /** 0515 * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt ) 0516 * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. 0517 * This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from 0518 * other `do_step` variants. 0519 * 0520 * \note This method uses the internal state of the stepper. 0521 * 0522 * \note This method does not solve the forwarding problem. 0523 * 0524 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the 0525 * Simple System concept. 0526 * \param in The state of the ODE which should be solved. in is not modified in this method 0527 * \param t The value of the time, at which the step should be performed. 0528 * \param out The result of the step is written in out. 0529 * \param dt The step size. 0530 */ 0531 0532 /** 0533 * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt ) 0534 * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. 0535 * Furthermore, the derivative of x at t is passed to the stepper and updated by the stepper to its new value at 0536 * t+dt. 0537 * 0538 * \note This method does not solve the forwarding problem. 0539 * 0540 * \note This method does NOT use the internal state of the stepper. 0541 * 0542 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the 0543 * Simple System concept. 0544 * \param in The state of the ODE which should be solved. in is not modified in this method 0545 * \param dxdt_in The derivative of x at t. 0546 * \param t The value of the time, at which the step should be performed. 0547 * \param out The result of the step is written in out. 0548 * \param dxdt_out The updated derivative of `out` at `t+dt`. 0549 * \param dt The step size. 0550 */ 0551 0552 /** 0553 * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr ) 0554 * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE 0555 * is updated in-place. 0556 * 0557 * 0558 * \note This method uses the internal state of the stepper. 0559 * 0560 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the 0561 * Simple System concept. 0562 * \param x The state of the ODE which should be solved. x is updated by this method. 0563 * \param t The value of the time, at which the step should be performed. 0564 * \param dt The step size. 0565 * \param xerr The estimation of the error is stored in xerr. 0566 */ 0567 0568 /** 0569 * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt , Err &xerr ) 0570 * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method 0571 * the derivative of x is also passed to this method and updated by this method. 0572 * 0573 * \note This method does NOT use the internal state of the stepper. 0574 * 0575 * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this 0576 * case the method could not be distinguished from other `do_step` versions. This method is disabled if StateInOut and 0577 * Time are of the same type. 0578 * 0579 * \note This method does NOT use the internal state of the stepper. 0580 * 0581 * \note This method does not solve the forwarding problem. 0582 * 0583 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the 0584 * Simple System concept. 0585 * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x. 0586 * \param dxdt The derivative of x at t. After calling `do_step` this value is updated to the new value at `t+dt`. 0587 * \param t The value of the time, at which the step should be performed. 0588 * \param dt The step size. 0589 * \param xerr The error estimate is stored in xerr. 0590 */ 0591 0592 0593 /** 0594 * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr ) 0595 * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. 0596 * Furthermore, the error is estimated. 0597 * 0598 * \note This method uses the internal state of the stepper. 0599 * 0600 * \note This method does not solve the forwarding problem. 0601 * 0602 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the 0603 * Simple System concept. 0604 * \param in The state of the ODE which should be solved. in is not modified in this method 0605 * \param t The value of the time, at which the step should be performed. 0606 * \param out The result of the step is written in out. 0607 * \param dt The step size. 0608 * \param xerr The error estimate. 0609 */ 0610 0611 /** 0612 * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t , StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr ) 0613 * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. 0614 * Furthermore, the derivative of x at t is passed to the stepper and the error is estimated. 0615 * 0616 * \note This method does NOT use the internal state of the stepper. 0617 * 0618 * \note This method does not solve the forwarding problem. 0619 * 0620 * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the 0621 * Simple System concept. 0622 * \param in The state of the ODE which should be solved. in is not modified in this method 0623 * \param dxdt_in The derivative of x at t. 0624 * \param t The value of the time, at which the step should be performed. 0625 * \param out The result of the step is written in out. 0626 * \param dxdt_out The new derivative at `t+dt` is written into this variable. 0627 * \param dt The step size. 0628 * \param xerr The error estimate. 0629 */ 0630 0631 /** 0632 * \fn explicit_error_stepper_fsal_base::adjust_size( const StateIn &x ) 0633 * \brief Adjust the size of all temporaries in the stepper manually. 0634 * \param x A state from which the size of the temporaries to be resized is deduced. 0635 */ 0636 0637 /** 0638 * \fn explicit_error_stepper_fsal_base::reset( void ) 0639 * \brief Resets the internal state of this stepper. After calling this method it is safe to use all 0640 * `do_step` method without explicitly initializing the stepper. 0641 */ 0642 0643 /** 0644 * \fn explicit_error_stepper_fsal_base::initialize( const DerivIn &deriv ) 0645 * \brief Initializes the internal state of the stepper. 0646 * \param deriv The derivative of x. The next call of `do_step` expects that the derivative of `x` passed to `do_step` 0647 * has the value of `deriv`. 0648 */ 0649 0650 /** 0651 * \fn explicit_error_stepper_fsal_base::initialize( System system , const StateIn &x , time_type t ) 0652 * \brief Initializes the internal state of the stepper. 0653 * 0654 * This method is equivalent to 0655 * \code 0656 * Deriv dxdt; 0657 * system( x , dxdt , t ); 0658 * stepper.initialize( dxdt ); 0659 * \endcode 0660 * 0661 * \param system The system function for the next calls of `do_step`. 0662 * \param x The current state of the ODE. 0663 * \param t The current time of the ODE. 0664 */ 0665 0666 /** 0667 * \fn explicit_error_stepper_fsal_base::is_initialized( void ) const 0668 * \brief Returns if the stepper is already initialized. If the stepper is not initialized, the first 0669 * call of `do_step` will initialize the state of the stepper. If the stepper is already initialized 0670 * the system function can not be safely exchanged between consecutive `do_step` calls. 0671 */ 0672 0673 } // odeint 0674 } // numeric 0675 } // boost 0676 0677 #endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |