diff --git a/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp b/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp index ef547beb..afe1bf04 100644 --- a/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp +++ b/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp @@ -406,9 +406,7 @@ public: { if( m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) { - typename odeint::unwrap_reference< System >::type &sys = system; - sys( in , m_dxdt.m_v ,t ); - m_first_call = false; + initialize( system , in , t ); } return try_step( system , in , m_dxdt.m_v , t , out , dt ); } @@ -480,6 +478,32 @@ public: + void reset( void ) + { + m_first_call = true; + } + + template< class DerivIn > + void initialize( const DerivIn &deriv ) + { + boost::numeric::odeint::copy( deriv , m_dxdt.m_v ); + m_first_call = false; + } + + template< class System , class StateIn > + void initialize( System system , const StateIn &x , const time_type &t ) + { + typename odeint::unwrap_reference< System >::type &sys = system; + sys( x , m_dxdt.m_v , t ); + m_first_call = false; + } + + bool is_initialized( void ) const + { + return ! m_first_call; + } + + template< class StateType > void adjust_size( const StateType &x ) @@ -536,9 +560,7 @@ private: { if( m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call ) { - typename odeint::unwrap_reference< System >::type &sys = system; - sys( x , m_dxdt.m_v , t ); - m_first_call = false; + initialize( system , x , t ); } return try_step( system , x , m_dxdt.m_v , t , dt ); } diff --git a/doc/index.html b/doc/index.html index 0c2d3b48..770ca3cb 100644 --- a/doc/index.html +++ b/doc/index.html @@ -3,13 +3,11 @@
Copyright © 2009-2011 Karsten Ahnert and Mario Mulansky
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -94,7 +92,7 @@Last revised: May 23, 2012 at 20:24:00 GMT |
+Last revised: May 29, 2012 at 14:07:10 GMT |