Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/numeric/odeint/integrate/detail/integrate_const.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/numeric/odeint/integrate/detail/integrate_const.hpp Fri Sep 04 12:01:02 2015 +0100 +++ b/DEPENDENCIES/generic/include/boost/numeric/odeint/integrate/detail/integrate_const.hpp Mon Sep 07 11:12:49 2015 +0100 @@ -6,8 +6,9 @@ integrate const implementation [end_description] - Copyright 2009-2012 Karsten Ahnert - Copyright 2009-2012 Mario Mulansky + Copyright 2012 Mario Mulansky + Copyright 2012 Christoph Koke + Copyright 2012 Karsten Ahnert Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or @@ -46,14 +47,15 @@ ) { typename odeint::unwrap_reference< Observer >::type &obs = observer; + typename odeint::unwrap_reference< Stepper >::type &st = stepper; Time time = start_time; int step = 0; - - while( less_eq_with_sign( time+dt , end_time , dt ) ) + // cast time+dt explicitely in case of expression templates (e.g. multiprecision) + while( less_eq_with_sign( static_cast<Time>(time+dt) , end_time , dt ) ) { obs( start_state , time ); - stepper.do_step( system , start_state , time , dt ); + st.do_step( system , start_state , time , dt ); // direct computation of the time avoids error propagation happening when using time += dt // we need clumsy type analysis to get boost units working here ++step; @@ -77,21 +79,22 @@ Time time = start_time; const Time time_step = dt; + int real_steps = 0; int step = 0; - while( less_eq_with_sign( time+time_step , end_time , dt ) ) + while( less_eq_with_sign( static_cast<Time>(time+time_step) , end_time , dt ) ) { obs( start_state , time ); - detail::integrate_adaptive( stepper , system , start_state , time , time+time_step , dt , + real_steps += detail::integrate_adaptive( stepper , system , start_state , time , time+time_step , dt , null_observer() , controlled_stepper_tag() ); // direct computation of the time avoids error propagation happening when using time += dt // we need clumsy type analysis to get boost units working here - ++step; + step++; time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * time_step; } obs( start_state , time ); - - return step; + + return real_steps; } @@ -103,21 +106,22 @@ ) { typename odeint::unwrap_reference< Observer >::type &obs = observer; + typename odeint::unwrap_reference< Stepper >::type &st = stepper; Time time = start_time; - stepper.initialize( start_state , time , dt ); + st.initialize( start_state , time , dt ); obs( start_state , time ); time += dt; int obs_step( 1 ); int real_step( 0 ); - while( less_with_sign( time+dt , end_time , dt ) ) + while( less_with_sign( static_cast<Time>(time+dt) , end_time , dt ) ) { - while( less_eq_with_sign( time , stepper.current_time() , dt ) ) + while( less_eq_with_sign( time , st.current_time() , dt ) ) { - stepper.calc_state( time , start_state ); + st.calc_state( time , start_state ); obs( start_state , time ); ++obs_step; // direct computation of the time avoids error propagation happening when using time += dt @@ -125,20 +129,20 @@ time = start_time + static_cast< typename unit_value_type<Time>::type >(obs_step) * dt; } // we have not reached the end, do another real step - if( less_with_sign( stepper.current_time()+stepper.current_time_step() , + if( less_with_sign( static_cast<Time>(st.current_time()+st.current_time_step()) , end_time , - stepper.current_time_step() ) ) + st.current_time_step() ) ) { - while( less_eq_with_sign( stepper.current_time() , time , dt ) ) + while( less_eq_with_sign( st.current_time() , time , dt ) ) { - stepper.do_step( system ); + st.do_step( system ); ++real_step; } } - else if( less_with_sign( stepper.current_time() , end_time , stepper.current_time_step() ) ) + else if( less_with_sign( st.current_time() , end_time , st.current_time_step() ) ) { // do the last step ending exactly on the end point - stepper.initialize( stepper.current_state() , stepper.current_time() , end_time - stepper.current_time() ); - stepper.do_step( system ); + st.initialize( st.current_state() , st.current_time() , end_time - st.current_time() ); + st.do_step( system ); ++real_step; } @@ -146,7 +150,7 @@ // last observation, if we are still in observation interval if( less_eq_with_sign( time , end_time , dt ) ) { - stepper.calc_state( time , start_state ); + st.calc_state( time , start_state ); obs( start_state , time ); }