Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57785 - sandbox/odeint/boost/numeric/odeint
From: mario.mulansky_at_[hidden]
Date: 2009-11-19 07:56:10


Author: mariomulansky
Date: 2009-11-19 07:56:10 EST (Thu, 19 Nov 2009)
New Revision: 57785
URL: http://svn.boost.org/trac/boost/changeset/57785

Log:
changed enum to lowercase
Text files modified:
   sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp | 2 +-
   sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp | 26 ++++++++++++++++++++------
   sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp | 8 ++++----
   3 files changed, 25 insertions(+), 11 deletions(-)

Modified: sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp 2009-11-19 07:56:10 EST (Thu, 19 Nov 2009)
@@ -52,7 +52,7 @@
             // do a controlled step
             result = controller.controlled_step( stepper, system, state, t, dt_ );
 
- if( result != STEP_SIZE_DECREASED )
+ if( result != step_size_decreased )
             { // we actually did a step forward (dt was small enough)
                 observer(t, state, system);
                 iterations++;

Modified: sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp 2009-11-19 07:56:10 EST (Thu, 19 Nov 2009)
@@ -60,26 +60,40 @@
     private:
         resizer_type m_resizer;
 
+ unsigned short m_stepcount;
+
         container_type m_x0;
         container_type m_x1;
         container_type m_dxdt;
 
     public:
+
+ stepper_midpoint( unsigned short stepcount = 2 )
+ { }
         
         order_type order() const { return 2; }
 
+ void set_stepcount( unsigned short stepcount )
+ {
+ if( stepcount > 1 )
+ m_stepcount = stepcount;
+ }
+
+ unsigned short get_step_count()
+ {
+ return m_stepcount;
+ }
+
         template< class DynamicalSystem >
         void next_step(
                 DynamicalSystem &system ,
                 container_type &x ,
                 container_type &dxdt ,
                 time_type t ,
- time_type dt ,
- unsigned short n = 2 )
+ time_type dt
+ )
         {
- if( n < 2 ) return;
-
- const time_type h = dt/static_cast<time_type>( n );
+ const time_type h = dt/static_cast<time_type>( m_stepcount );
             const time_type h2 = static_cast<time_type>( 2.0 )*h;
             const time_type t_1 = static_cast<time_type>( 1.0 );
             const time_type t_05 = static_cast<time_type>( 0.5 );
@@ -100,7 +114,7 @@
             m_x1 = x;
 
             unsigned short i = 1;
- while( i != n )
+ while( i != m_stepcount )
             { // general step
                 //tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp
                 scale_sum_swap( m_x1.begin(), m_x1.end(),

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-19 07:56:10 EST (Thu, 19 Nov 2009)
@@ -26,7 +26,7 @@
 namespace numeric {
 namespace odeint {
 
- typedef enum{SUCCESS, STEP_SIZE_DECREASED, STEP_SIZE_INCREASED} controlled_step_result;
+ typedef enum{success, step_size_decreased, step_size_increased} controlled_step_result;
 
     /*
        The initial state is given in x.
@@ -116,15 +116,15 @@
                 dt *= max( 0.9*pow(max_rel_err , -1.0/(stepper.order_error()-1.0)) , 0.2 );
                 // reset state
                 x = x_tmp;
- return STEP_SIZE_DECREASED;
+ return step_size_decreased;
             } else if( max_rel_err < 0.5 ) { //error too small - increase dt
                 t += dt; // we keep the evolution -> increase time
                 // limit scaling factor to 5.0
                 dt *= min( 0.9*pow(max_rel_err , -1.0/stepper.order()), 5.0 );
- return STEP_SIZE_INCREASED;
+ return step_size_increased;
             } else {
                 t += dt;
- return SUCCESS;
+ return success;
             }
         }
     };


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