mirror of
https://github.com/boostorg/odeint.git
synced 2026-01-19 04:22:12 +00:00
consistent counting of failed steps
the code in integrate_times for a controlled stepper and in the dense out stepper was inconsistent in terms of when exactly to throw the exception. See #173 for some discussion on this.
This commit is contained in:
@@ -99,6 +99,8 @@ size_t integrate_times(
|
||||
if( st.try_step( system , start_state , current_time , current_dt ) == success )
|
||||
{
|
||||
++steps;
|
||||
// successful step -> reset the fail counter, see #173
|
||||
fail_steps = 0;
|
||||
// continue with the original step size if dt was reduced due to observation
|
||||
dt = max_abs( dt , current_dt );
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
res = m_stepper.try_step( system , get_current_state() , get_current_deriv() , m_t ,
|
||||
get_old_state() , get_old_deriv() , m_dt );
|
||||
if( count++ == max_count )
|
||||
BOOST_THROW_EXCEPTION( std::overflow_error( "dense_output_controlled_explicit : too much iterations!") );
|
||||
BOOST_THROW_EXCEPTION( std::overflow_error( "dense_output_controlled_explicit : too many iterations!") );
|
||||
}
|
||||
while( res == fail );
|
||||
toggle_current_state();
|
||||
|
||||
Reference in New Issue
Block a user