|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57581 - in sandbox/odeint: boost/numeric/odeint libs/numeric/odeint/stuff/gsl_compare
From: mario.mulansky_at_[hidden]
Date: 2009-11-11 16:10:36
Author: mariomulansky
Date: 2009-11-11 16:10:35 EST (Wed, 11 Nov 2009)
New Revision: 57581
URL: http://svn.boost.org/trac/boost/changeset/57581
Log:
small merges
Text files modified:
sandbox/odeint/boost/numeric/odeint/integrator.hpp | 12 +++++++-----
sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp | 8 ++++----
sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/lorenz_stepper_cmp.cpp | 14 +++++++-------
3 files changed, 18 insertions(+), 16 deletions(-)
Modified: sandbox/odeint/boost/numeric/odeint/integrator.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/integrator.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/integrator.hpp 2009-11-11 16:10:35 EST (Wed, 11 Nov 2009)
@@ -47,18 +47,20 @@
observer(t, state, system);
while( t < end_time )
- {
+ {
+ // do a controlled step
result = controller.controlled_step( stepper, system, state, t, dt_ );
if( result != STEP_SIZE_DECREASED )
- { // we actually did a step forward
+ { // we actually did a step forward (dt was small enough)
observer(t, state, system);
iterations++;
}
- while( result != SUCCESS )
- {
+ while( result != SUCCESS ) // as long as dt is too large/small
+ {
+ // do the controlled step
result = controller.controlled_step( stepper, system, state, t, dt_ );
if( result != STEP_SIZE_DECREASED )
- { // we did a step
+ { // we did a step
observer(t, state, system);
iterations++;
}
Modified: sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp 2009-11-11 16:10:35 EST (Wed, 11 Nov 2009)
@@ -72,11 +72,11 @@
T max_rel_err = 0.0;
while( x_start != x_tmp.end() ) {
- // get the maximal value of x_err/D where
- // D = eps_abs + eps_rel * (a_x*|x| + a_dxdt*|dxdt|);
- T err = eps_abs + eps_rel * (a_x * std::abs(*x_start++) +
+ // get the maximal value of x_err/D where
+ // D = eps_abs + eps_rel * (a_x*|x| + a_dxdt*|dxdt|);
+ T err = eps_abs + eps_rel * (a_x * std::abs(*x_start++) +
a_dxdt * dt * std::abs(*dxdt_start++));
- max_rel_err = max( std::abs(*x_err_start++)/err , max_rel_err );
+ max_rel_err = max( std::abs(*x_err_start++)/err , max_rel_err );
}
//std::cout<<max_rel_err<<std::endl;
Modified: sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/lorenz_stepper_cmp.cpp
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/lorenz_stepper_cmp.cpp (original)
+++ sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/lorenz_stepper_cmp.cpp 2009-11-11 16:10:35 EST (Wed, 11 Nov 2009)
@@ -109,7 +109,7 @@
start= clock();
t = 0.0;
for( size_t oi=0 ; oi<olen ; ++oi,t+=dt )
- stepper.next_step( lorenz , x1 , t , dt , x1_err );
+ stepper.next_step( lorenz , x1 , t , dt , x1_err );
end = clock();
clog << "odeint array : " << double ( end - start ) / double( CLOCKS_PER_SEC ) << endl;
@@ -124,7 +124,7 @@
start= clock();
t = 0.0;
for( size_t oi=0 ; oi<olen ; ++oi,t+=dt )
- gsl_odeiv_step_apply ( s , t , dt , x2 , x2_err , 0 , 0 , &sys );
+ gsl_odeiv_step_apply ( s , t , dt , x2 , x2_err , 0 , 0 , &sys );
end = clock();
clog << "gsl rk4 : " << double ( end - start ) / double( CLOCKS_PER_SEC ) << endl;
@@ -141,11 +141,11 @@
t = 0.0;
for( size_t i=0 ; i<tslen ; ++i,t+=dt )
{
- stepper.next_step( lorenz , x1 , t , dt , x1_err );
- gsl_odeiv_step_apply ( s , t , dt , x2 , x2_err , 0 , 0 , &sys );
- rk4_lorenz( x3 , 0.5*dt );
- rk4_lorenz( x3 , 0.5*dt );
- cout << t << tab << x1[0] << tab << x2[0] << tab << x3[0] << endl;
+ stepper.next_step( lorenz , x1 , t , dt , x1_err );
+ gsl_odeiv_step_apply ( s , t , dt , x2 , x2_err , 0 , 0 , &sys );
+ rk4_lorenz( x3 , 0.5*dt );
+ rk4_lorenz( x3 , 0.5*dt );
+ cout << t << tab << x1[0] << tab << x2[0] << tab << x3[0] << endl;
}
gsl_odeiv_step_free (s);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk