explicit_error_stepper_fsal_base.hpp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp
  4. [begin_description]
  5. Base class for all explicit first-same-as-last Runge Kutta steppers.
  6. [end_description]
  7. Copyright 2010-2013 Karsten Ahnert
  8. Copyright 2010-2012 Mario Mulansky
  9. Copyright 2012 Christoph Koke
  10. Distributed under the Boost Software License, Version 1.0.
  11. (See accompanying file LICENSE_1_0.txt or
  12. copy at http://www.boost.org/LICENSE_1_0.txt)
  13. */
  14. #ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED
  15. #define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED
  16. #include <boost/utility/enable_if.hpp>
  17. #include <boost/type_traits/is_same.hpp>
  18. #include <boost/numeric/odeint/util/bind.hpp>
  19. #include <boost/numeric/odeint/util/unwrap_reference.hpp>
  20. #include <boost/numeric/odeint/util/state_wrapper.hpp>
  21. #include <boost/numeric/odeint/util/is_resizeable.hpp>
  22. #include <boost/numeric/odeint/util/resizer.hpp>
  23. #include <boost/numeric/odeint/util/copy.hpp>
  24. #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
  25. #include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
  26. namespace boost {
  27. namespace numeric {
  28. namespace odeint {
  29. /*
  30. * base class for explicit stepper and error steppers with the fsal property
  31. * models the stepper AND the error stepper fsal concept
  32. *
  33. * this class provides the following do_step overloads
  34. * do_step( sys , x , t , dt )
  35. * do_step( sys , x , dxdt , t , dt )
  36. * do_step( sys , in , t , out , dt )
  37. * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
  38. * do_step( sys , x , t , dt , xerr )
  39. * do_step( sys , x , dxdt , t , dt , xerr )
  40. * do_step( sys , in , t , out , dt , xerr )
  41. * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )
  42. */
  43. template<
  44. class Stepper ,
  45. unsigned short Order ,
  46. unsigned short StepperOrder ,
  47. unsigned short ErrorOrder ,
  48. class State ,
  49. class Value ,
  50. class Deriv ,
  51. class Time ,
  52. class Algebra ,
  53. class Operations ,
  54. class Resizer
  55. >
  56. class explicit_error_stepper_fsal_base : public algebra_stepper_base< Algebra , Operations >
  57. {
  58. public:
  59. typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type;
  60. typedef typename algebra_stepper_base_type::algebra_type algebra_type;
  61. typedef State state_type;
  62. typedef Value value_type;
  63. typedef Deriv deriv_type;
  64. typedef Time time_type;
  65. typedef Resizer resizer_type;
  66. typedef Stepper stepper_type;
  67. typedef explicit_error_stepper_fsal_tag stepper_category;
  68. #ifndef DOXYGEN_SKIP
  69. typedef state_wrapper< state_type > wrapped_state_type;
  70. typedef state_wrapper< deriv_type > wrapped_deriv_type;
  71. typedef explicit_error_stepper_fsal_base< Stepper , Order , StepperOrder , ErrorOrder ,
  72. State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type;
  73. #endif
  74. typedef unsigned short order_type;
  75. static const order_type order_value = Order;
  76. static const order_type stepper_order_value = StepperOrder;
  77. static const order_type error_order_value = ErrorOrder;
  78. explicit_error_stepper_fsal_base( const algebra_type &algebra = algebra_type() )
  79. : algebra_stepper_base_type( algebra ) , m_first_call( true )
  80. { }
  81. order_type order( void ) const
  82. {
  83. return order_value;
  84. }
  85. order_type stepper_order( void ) const
  86. {
  87. return stepper_order_value;
  88. }
  89. order_type error_order( void ) const
  90. {
  91. return error_order_value;
  92. }
  93. /*
  94. * version 1 : do_step( sys , x , t , dt )
  95. *
  96. * the two overloads are needed in order to solve the forwarding problem
  97. */
  98. template< class System , class StateInOut >
  99. void do_step( System system , StateInOut &x , time_type t , time_type dt )
  100. {
  101. do_step_v1( system , x , t , dt );
  102. }
  103. /**
  104. * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut.
  105. */
  106. template< class System , class StateInOut >
  107. void do_step( System system , const StateInOut &x , time_type t , time_type dt )
  108. {
  109. do_step_v1( system , x , t , dt );
  110. }
  111. /*
  112. * version 2 : do_step( sys , x , dxdt , t , dt )
  113. *
  114. * this version does not solve the forwarding problem, boost.range can not be used
  115. *
  116. * the disable is needed to avoid ambiguous overloads if state_type = time_type
  117. */
  118. template< class System , class StateInOut , class DerivInOut >
  119. typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type
  120. do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt )
  121. {
  122. m_first_call = true;
  123. this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt );
  124. }
  125. /*
  126. * named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt )
  127. *
  128. * this version is needed when this stepper is used for initializing
  129. * multistep stepper like adams-bashforth. Hence we provide an explicitely
  130. * named version that is not disabled. Meant for internal use only.
  131. */
  132. template< class System , class StateInOut , class DerivInOut >
  133. void do_step_dxdt_impl( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt )
  134. {
  135. m_first_call = true;
  136. this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt );
  137. }
  138. /*
  139. * version 3 : do_step( sys , in , t , out , dt )
  140. *
  141. * this version does not solve the forwarding problem, boost.range can not
  142. * be used.
  143. *
  144. * the disable is needed to avoid ambiguous overloads if
  145. * state_type = time_type
  146. */
  147. template< class System , class StateIn , class StateOut >
  148. typename boost::disable_if< boost::is_same< StateIn , time_type > , void >::type
  149. do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
  150. {
  151. if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
  152. {
  153. initialize( system , in , t );
  154. }
  155. this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt );
  156. }
  157. /*
  158. * version 4 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
  159. *
  160. * this version does not solve the forwarding problem, boost.range can not be used
  161. */
  162. template< class System, class StateIn, class DerivIn, class StateOut,
  163. class DerivOut >
  164. void do_step( System system, const StateIn &in, const DerivIn &dxdt_in,
  165. time_type t, StateOut &out, DerivOut &dxdt_out, time_type dt )
  166. {
  167. m_first_call = true;
  168. this->stepper().do_step_impl( system, in, dxdt_in, t, out, dxdt_out,
  169. dt );
  170. }
  171. /*
  172. * version 5 : do_step( sys , x , t , dt , xerr )
  173. *
  174. * the two overloads are needed in order to solve the forwarding problem
  175. */
  176. template< class System , class StateInOut , class Err >
  177. void do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
  178. {
  179. do_step_v5( system , x , t , dt , xerr );
  180. }
  181. /**
  182. * \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut.
  183. */
  184. template< class System , class StateInOut , class Err >
  185. void do_step( System system , const StateInOut &x , time_type t , time_type dt , Err &xerr )
  186. {
  187. do_step_v5( system , x , t , dt , xerr );
  188. }
  189. /*
  190. * version 6 : do_step( sys , x , dxdt , t , dt , xerr )
  191. *
  192. * this version does not solve the forwarding problem, boost.range can not be used
  193. *
  194. * the disable is needed to avoid ambiguous overloads if state_type = time_type
  195. */
  196. template< class System , class StateInOut , class DerivInOut , class Err >
  197. typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type
  198. do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt , Err &xerr )
  199. {
  200. m_first_call = true;
  201. this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt , xerr );
  202. }
  203. /*
  204. * version 7 : do_step( sys , in , t , out , dt , xerr )
  205. *
  206. * this version does not solve the forwarding problem, boost.range can not be used
  207. */
  208. template< class System , class StateIn , class StateOut , class Err >
  209. void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr )
  210. {
  211. if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
  212. {
  213. initialize( system , in , t );
  214. }
  215. this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt , xerr );
  216. }
  217. /*
  218. * version 8 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )
  219. *
  220. * this version does not solve the forwarding problem, boost.range can not be used
  221. */
  222. template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err >
  223. void do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t ,
  224. StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr )
  225. {
  226. m_first_call = true;
  227. this->stepper().do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr );
  228. }
  229. template< class StateIn >
  230. void adjust_size( const StateIn &x )
  231. {
  232. resize_impl( x );
  233. }
  234. void reset( void )
  235. {
  236. m_first_call = true;
  237. }
  238. template< class DerivIn >
  239. void initialize( const DerivIn &deriv )
  240. {
  241. boost::numeric::odeint::copy( deriv , m_dxdt.m_v );
  242. m_first_call = false;
  243. }
  244. template< class System , class StateIn >
  245. void initialize( System system , const StateIn &x , time_type t )
  246. {
  247. typename odeint::unwrap_reference< System >::type &sys = system;
  248. sys( x , m_dxdt.m_v , t );
  249. m_first_call = false;
  250. }
  251. bool is_initialized( void ) const
  252. {
  253. return ! m_first_call;
  254. }
  255. private:
  256. template< class System , class StateInOut >
  257. void do_step_v1( System system , StateInOut &x , time_type t , time_type dt )
  258. {
  259. if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
  260. {
  261. initialize( system , x , t );
  262. }
  263. this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt );
  264. }
  265. template< class System , class StateInOut , class Err >
  266. void do_step_v5( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
  267. {
  268. if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
  269. {
  270. initialize( system , x , t );
  271. }
  272. this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt , xerr );
  273. }
  274. template< class StateIn >
  275. bool resize_impl( const StateIn &x )
  276. {
  277. return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
  278. }
  279. stepper_type& stepper( void )
  280. {
  281. return *static_cast< stepper_type* >( this );
  282. }
  283. const stepper_type& stepper( void ) const
  284. {
  285. return *static_cast< const stepper_type* >( this );
  286. }
  287. resizer_type m_resizer;
  288. bool m_first_call;
  289. protected:
  290. wrapped_deriv_type m_dxdt;
  291. };
  292. /******* DOXYGEN *******/
  293. /**
  294. * \class explicit_error_stepper_fsal_base
  295. * \brief Base class for explicit steppers with error estimation and stepper fulfilling the FSAL (first-same-as-last)
  296. * property. This class can be used with controlled steppers for step size control.
  297. *
  298. * This class serves as the base class for all explicit steppers with algebra and operations and which fulfill the FSAL
  299. * property. In contrast to explicit_stepper_base it also estimates the error and can be used in a controlled stepper
  300. * to provide step size control.
  301. *
  302. * The FSAL property means that the derivative of the system at t+dt is already used in the current step going from
  303. * t to t +dt. Therefore, some more do_steps method can be introduced and the controlled steppers can explicitly make use
  304. * of this property.
  305. *
  306. * \note This stepper provides `do_step` methods with and without error estimation. It has therefore three orders,
  307. * one for the order of a step if the error is not estimated. The other two orders are the orders of the step and
  308. * the error step if the error estimation is performed.
  309. *
  310. * explicit_error_stepper_fsal_base is used as the interface in a CRTP (currently recurring template
  311. * pattern). In order to work correctly the parent class needs to have a method
  312. * `do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr )`.
  313. * explicit_error_stepper_fsal_base derives from algebra_stepper_base.
  314. *
  315. * This class can have an intrinsic state depending on the explicit usage of the `do_step` method. This means that some
  316. * `do_step` methods are expected to be called in order. For example the `do_step( sys , x , t , dt , xerr )` will keep track
  317. * of the derivative of `x` which is the internal state. The first call of this method is recognized such that one
  318. * does not explicitly initialize the internal state, so it is safe to use this method like
  319. *
  320. * \code
  321. * stepper_type stepper;
  322. * stepper.do_step( sys , x , t , dt , xerr );
  323. * stepper.do_step( sys , x , t , dt , xerr );
  324. * stepper.do_step( sys , x , t , dt , xerr );
  325. * \endcode
  326. *
  327. * But it is unsafe to call this method with different system functions after each other. Do do so, one must initialize the
  328. * internal state with the `initialize` method or reset the internal state with the `reset` method.
  329. *
  330. * explicit_error_stepper_fsal_base provides several overloaded `do_step` methods, see the list below. Only two of them are needed
  331. * to fulfill the Error Stepper concept. The other ones are for convenience and for better performance. Some of them
  332. * simply update the state out-of-place, while other expect that the first derivative at `t` is passed to the stepper.
  333. *
  334. * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fulfill the Error Stepper concept. The
  335. * state is updated in-place. A type modelling a Boost.Range can be used for x.
  336. * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state x and the derivative dxdt in-place. It is expected
  337. * that dxdt has the value of the derivative of x at time t.
  338. * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step
  339. * is stored in `out`.
  340. * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )` - This method updates the state and the derivative
  341. * out-of-place. It expects that the derivative at the point `t` is explicitly passed in `dxdt_in`.
  342. * - `do_step( sys , x , t , dt , xerr )` - This `do_step` method is needed to fulfill the Error Stepper concept. The
  343. * state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x.
  344. * - `do_step( sys , x , dxdt , t , dt , xerr )` - This method updates the state and the derivative in-place. It is assumed
  345. * that the dxdt has the value of the derivative of x at time t. An error estimate is calculated.
  346. * - `do_step( sys , in , t , out , dt , xerr )` - This method updates the state out-of-place and estimates the error
  347. * during the step.
  348. * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )` - This methods updates the state and the derivative
  349. * out-of-place and estimates the error during the step. It is assumed the dxdt_in is derivative of in at time t.
  350. *
  351. * \note The system is always passed as value, which might result in poor performance if it contains data. In this
  352. * case it can be used with `boost::ref` or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );`
  353. *
  354. * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate`
  355. * routines or `iterator`s.
  356. *
  357. * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base
  358. * provides the interface for the Stepper.
  359. * \tparam Order The order of a stepper if the stepper is used without error estimation.
  360. * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have
  361. * the same value.
  362. * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation.
  363. * \tparam State The state type for the stepper.
  364. * \tparam Value The value type for the stepper. This should be a floating point type, like float,
  365. * double, or a multiprecision type. It must not necessary be the value_type of the State. For example
  366. * the State can be a `vector< complex< double > >` in this case the Value must be double.
  367. * The default value is double.
  368. * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the
  369. * state type, only if used with Boost.Units both types differ.
  370. * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is
  371. * used, this type has usually a unit.
  372. * \tparam Algebra The algebra type which must fulfill the Algebra Concept.
  373. * \tparam Operations The type for the operations which must fulfill the Operations Concept.
  374. * \tparam Resizer The resizer policy class.
  375. */
  376. /**
  377. * \fn explicit_error_stepper_fsal_base::explicit_error_stepper_fsal_base( const algebra_type &algebra )
  378. * \brief Constructs a explicit_stepper_fsal_base class. This constructor can be used as a default
  379. * constructor if the algebra has a default constructor.
  380. * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
  381. */
  382. /**
  383. * \fn explicit_error_stepper_fsal_base::order( void ) const
  384. * \return Returns the order of the stepper if it used without error estimation.
  385. */
  386. /**
  387. * \fn explicit_error_stepper_fsal_base::stepper_order( void ) const
  388. * \return Returns the order of a step if the stepper is used without error estimation.
  389. */
  390. /**
  391. * \fn explicit_error_stepper_fsal_base::error_order( void ) const
  392. * \return Returns the order of an error step if the stepper is used without error estimation.
  393. */
  394. /**
  395. * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , time_type t , time_type dt )
  396. * \brief This method performs one step. It transforms the result in-place.
  397. *
  398. * \note This method uses the internal state of the stepper.
  399. *
  400. * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the
  401. * Simple System concept.
  402. * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
  403. * \param t The value of the time, at which the step should be performed.
  404. * \param dt The step size.
  405. */
  406. /**
  407. * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt )
  408. * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other methods
  409. * the derivative of x is also passed to this method. Therefore, dxdt must be evaluated initially:
  410. *
  411. * \code
  412. * ode( x , dxdt , t );
  413. * for( ... )
  414. * {
  415. * stepper.do_step( ode , x , dxdt , t , dt );
  416. * t += dt;
  417. * }
  418. * \endcode
  419. *
  420. * \note This method does NOT use the initial state, since the first derivative is explicitly passed to this method.
  421. *
  422. * The result is updated in place in x as well as the derivative dxdt. This method is disabled if
  423. * Time and StateInOut are of the same type. In this case the method could not be distinguished from other `do_step`
  424. * versions.
  425. *
  426. * \note This method does not solve the forwarding problem.
  427. *
  428. * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
  429. * Simple System concept.
  430. * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
  431. * \param dxdt The derivative of x at t. After calling `do_step` dxdt is updated to the new value.
  432. * \param t The value of the time, at which the step should be performed.
  433. * \param dt The step size.
  434. */
  435. /**
  436. * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
  437. * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
  438. * This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from
  439. * other `do_step` variants.
  440. *
  441. * \note This method uses the internal state of the stepper.
  442. *
  443. * \note This method does not solve the forwarding problem.
  444. *
  445. * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
  446. * Simple System concept.
  447. * \param in The state of the ODE which should be solved. in is not modified in this method
  448. * \param t The value of the time, at which the step should be performed.
  449. * \param out The result of the step is written in out.
  450. * \param dt The step size.
  451. */
  452. /**
  453. * \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 )
  454. * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
  455. * Furthermore, the derivative of x at t is passed to the stepper and updated by the stepper to its new value at
  456. * t+dt.
  457. *
  458. * \note This method does not solve the forwarding problem.
  459. *
  460. * \note This method does NOT use the internal state of the stepper.
  461. *
  462. * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
  463. * Simple System concept.
  464. * \param in The state of the ODE which should be solved. in is not modified in this method
  465. * \param dxdt_in The derivative of x at t.
  466. * \param t The value of the time, at which the step should be performed.
  467. * \param out The result of the step is written in out.
  468. * \param dxdt_out The updated derivative of `out` at `t+dt`.
  469. * \param dt The step size.
  470. */
  471. /**
  472. * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
  473. * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE
  474. * is updated in-place.
  475. *
  476. *
  477. * \note This method uses the internal state of the stepper.
  478. *
  479. * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
  480. * Simple System concept.
  481. * \param x The state of the ODE which should be solved. x is updated by this method.
  482. * \param t The value of the time, at which the step should be performed.
  483. * \param dt The step size.
  484. * \param xerr The estimation of the error is stored in xerr.
  485. */
  486. /**
  487. * \fn explicit_error_stepper_fsal_base::do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt , Err &xerr )
  488. * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method
  489. * the derivative of x is also passed to this method and updated by this method.
  490. *
  491. * \note This method does NOT use the internal state of the stepper.
  492. *
  493. * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this
  494. * case the method could not be distinguished from other `do_step` versions. This method is disabled if StateInOut and
  495. * Time are of the same type.
  496. *
  497. * \note This method does NOT use the internal state of the stepper.
  498. *
  499. * \note This method does not solve the forwarding problem.
  500. *
  501. * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
  502. * Simple System concept.
  503. * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
  504. * \param dxdt The derivative of x at t. After calling `do_step` this value is updated to the new value at `t+dt`.
  505. * \param t The value of the time, at which the step should be performed.
  506. * \param dt The step size.
  507. * \param xerr The error estimate is stored in xerr.
  508. */
  509. /**
  510. * \fn explicit_error_stepper_fsal_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr )
  511. * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
  512. * Furthermore, the error is estimated.
  513. *
  514. * \note This method uses the internal state of the stepper.
  515. *
  516. * \note This method does not solve the forwarding problem.
  517. *
  518. * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
  519. * Simple System concept.
  520. * \param in The state of the ODE which should be solved. in is not modified in this method
  521. * \param t The value of the time, at which the step should be performed.
  522. * \param out The result of the step is written in out.
  523. * \param dt The step size.
  524. * \param xerr The error estimate.
  525. */
  526. /**
  527. * \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 )
  528. * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
  529. * Furthermore, the derivative of x at t is passed to the stepper and the error is estimated.
  530. *
  531. * \note This method does NOT use the internal state of the stepper.
  532. *
  533. * \note This method does not solve the forwarding problem.
  534. *
  535. * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
  536. * Simple System concept.
  537. * \param in The state of the ODE which should be solved. in is not modified in this method
  538. * \param dxdt_in The derivative of x at t.
  539. * \param t The value of the time, at which the step should be performed.
  540. * \param out The result of the step is written in out.
  541. * \param dxdt_out The new derivative at `t+dt` is written into this variable.
  542. * \param dt The step size.
  543. * \param xerr The error estimate.
  544. */
  545. /**
  546. * \fn explicit_error_stepper_fsal_base::adjust_size( const StateIn &x )
  547. * \brief Adjust the size of all temporaries in the stepper manually.
  548. * \param x A state from which the size of the temporaries to be resized is deduced.
  549. */
  550. /**
  551. * \fn explicit_error_stepper_fsal_base::reset( void )
  552. * \brief Resets the internal state of this stepper. After calling this method it is safe to use all
  553. * `do_step` method without explicitly initializing the stepper.
  554. */
  555. /**
  556. * \fn explicit_error_stepper_fsal_base::initialize( const DerivIn &deriv )
  557. * \brief Initializes the internal state of the stepper.
  558. * \param deriv The derivative of x. The next call of `do_step` expects that the derivative of `x` passed to `do_step`
  559. * has the value of `deriv`.
  560. */
  561. /**
  562. * \fn explicit_error_stepper_fsal_base::initialize( System system , const StateIn &x , time_type t )
  563. * \brief Initializes the internal state of the stepper.
  564. *
  565. * This method is equivalent to
  566. * \code
  567. * Deriv dxdt;
  568. * system( x , dxdt , t );
  569. * stepper.initialize( dxdt );
  570. * \endcode
  571. *
  572. * \param system The system function for the next calls of `do_step`.
  573. * \param x The current state of the ODE.
  574. * \param t The current time of the ODE.
  575. */
  576. /**
  577. * \fn explicit_error_stepper_fsal_base::is_initialized( void ) const
  578. * \brief Returns if the stepper is already initialized. If the stepper is not initialized, the first
  579. * call of `do_step` will initialize the state of the stepper. If the stepper is already initialized
  580. * the system function can not be safely exchanged between consecutive `do_step` calls.
  581. */
  582. } // odeint
  583. } // numeric
  584. } // boost
  585. #endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED