Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64304 - in sandbox/odeint/branches/karsten: boost/numeric/odeint/algebra boost/numeric/odeint/algebra/external boost/numeric/odeint/stepper libs/numeric/odeint/examples libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2010-07-23 10:59:50


Author: karsten
Date: 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
New Revision: 64304
URL: http://svn.boost.org/trac/boost/changeset/64304

Log:
* added construct and destruct possibilities for state types
* added controlled stepper
Added:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/gsl_vector_adaptor.hpp (contents, props changed)
      - copied, changed from r64052, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/gsl_vector_adaptor.hpp
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp (contents, props changed)
      - copied, changed from r64036, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/thrust_algebra.hpp
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp (contents, props changed)
      - copied, changed from r64036, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/thrust_operations.hpp
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_resize.hpp (contents, props changed)
      - copied, changed from r64036, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/thrust_resize.hpp
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/error_checker.hpp (contents, props changed)
Removed:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/test_gsl_vector.cpp
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/test_gsl_vector_with_euler.cpp
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/gsl_vector_adaptor.hpp | 32 ++++++++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp | 19 ++++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp | 111 ++++++++++++++++++-----------------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp | 16 +++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp | 12 +++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp | 32 ++++++++++
   sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile | 1
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile | 3
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp | 121 ++++++++++++++++++++++++++++++++++++++-
   9 files changed, 284 insertions(+), 63 deletions(-)

Copied: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/gsl_vector_adaptor.hpp (from r64052, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/gsl_vector_adaptor.hpp)
==============================================================================
--- /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/gsl_vector_adaptor.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/gsl_vector_adaptor.hpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -168,11 +168,34 @@
         const static bool value = type::value;
 };
 
+template<>
+void construct( gsl_vector &x )
+{
+ x.owner = 0;
+ x.size = 0;
+ x.stride = 0;
+ x.block = 0;
+ x.data = 0;
+}
+
+template<>
+void destruct( gsl_vector &x )
+{
+ if( x.owner != 0 )
+ {
+ gsl_block_free( x.block );
+ }
+ x.owner = 0;
+ x.size = 0;
+ x.stride = 0;
+ x.block = 0;
+ x.data = 0;
+}
+
 
 template<>
 void resize( const gsl_vector &x , gsl_vector &dxdt )
 {
- // ToDo : the vector could be uninitialized
         if( dxdt.owner != 0 )
         {
                 gsl_block_free( dxdt.block );
@@ -203,6 +226,13 @@
         if( !same_size( x1 , x2 ) ) resize( x1 , x2 );
 }
 
+template<>
+void copy( const gsl_vector &from , gsl_vector &to )
+{
+ adjust_size( from , to );
+ gsl_vector_memcpy( &to , &from );
+}
+
 
 } // odeint
 } // numeric

Copied: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp (from r64036, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/thrust_algebra.hpp)
==============================================================================

Copied: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp (from r64036, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/thrust_operations.hpp)
==============================================================================

Copied: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_resize.hpp (from r64036, /sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/thrust_resize.hpp)
==============================================================================

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -54,6 +54,18 @@
 };
 
 
+
+
+template< class Container >
+void construct( Container &x )
+{
+}
+
+template< class Container >
+void destruct( Container &x )
+{
+}
+
 template< class Container >
 void resize( const Container &x , Container &dxdt )
 {
@@ -73,6 +85,13 @@
 }
 
 
+template< class Container >
+void copy( const Container &from , Container &to )
+{
+ to = from;
+}
+
+
 
 } // odeint
 } // numeric

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -13,11 +13,10 @@
 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_ERROR_STEPPER_HPP_INCLUDED
 #define BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_ERROR_STEPPER_HPP_INCLUDED
 
-#include <boost/numeric/odeint/algebra/standard_algebra.hpp>
-#include <boost/numeric/odeint/algebra/standard_operations.hpp>
+#include <cmath>
 
-#include <boost/numeric/odeint/stepper/explicit_stepper_base.hpp>
-#include <boost/numeric/odeint/stepper/detail/macros.hpp>
+#include <boost/numeric/odeint/stepper/adjust_size.hpp>
+#include <boost/numeric/odeint/stepper/error_checker.hpp>
 
 namespace boost {
 namespace numeric {
@@ -33,8 +32,7 @@
 
 template<
         class ErrorStepper ,
-
-
+ class ErrorChecker = error_checker_standard< typename ErrorStepper::state_type , typename ErrorStepper::time_type >
>
 class controlled_error_stepper
 {
@@ -45,41 +43,62 @@
         typedef typename error_stepper_type::time_type time_type;
         typedef typename error_stepper_type::order_type order_type;
 
+ // ToDo : check if the next line can be avoided
+ typedef typename error_stepper_type::adjust_size_policy adjust_size_policy;
+
+ typedef ErrorChecker error_checker_type;
+
+ // ToDo : check if stepper could be constructed by the controlled stepper
+ controlled_error_stepper(
+ error_stepper_type &stepper ,
+ const error_checker_type &error_checker = error_checker_type()
+ )
+ : m_stepper( stepper ) , m_error_checker( error_checker ) ,
+ m_dxdt_size_adjuster() , m_xerr_size_adjuster() ,
+ m_dxdt() , m_x_old() , m_x_err()
+ {
+ boost::numeric::odeint::construct( m_dxdt );
+ boost::numeric::odeint::construct( m_x_err );
+ boost::numeric::odeint::construct( m_x_old );
+ m_dxdt_size_adjuster.register_state( 0 , m_dxdt );
+ m_xerr_size_adjuster.register_state( 0 , m_x_err );
+ }
+
+ ~controlled_error_stepper( void )
+ {
+ boost::numeric::odeint::destruct( m_dxdt );
+ boost::numeric::odeint::destruct( m_x_err );
+ boost::numeric::odeint::destruct( m_x_old );
+ }
+
 
 
         template< class System >
         controlled_step_result try_step( System &sys , state_type &x , const state_type &dxdt , time_type &t , time_type &dt )
         {
                 using std::max;
+ using std::pow;
 
- // adjust size
-
- m_error_checker.fill_scale( x , dxdt , dt , m_x_scale );
+ m_xerr_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
+ boost::numeric::odeint::copy( x , m_x_old );
+ m_stepper.do_step( sys , x , dxdt , t , dt , m_x_err );
 
- m_x_tmp = x;
- m_stepper.do_step( system , x , dxdt , t , dt , m_x_err );
-
- time_type max_rel_err = m_error_checker.get_max_error_ratio( m_x_err , m_x_scale );
+ time_type max_rel_err = m_error_checker.error( m_x_old , dxdt , m_x_err , dt );
 
                 if( max_rel_err > 1.1 )
                 {
- // error too large - decrease dt
- // limit scaling factor to 0.2
- dt *= std::max( 0.9 * pow( max_rel_err , -1.0/(m_stepper.order_error()-1.0) ),
- 0.2 );
-
- // reset state
- x = m_x_tmp;
+ // error too large - decrease dt ,limit scaling factor to 0.2 and reset state
+ dt *= max( 0.9 * pow( max_rel_err , -1.0 / ( m_stepper.error_order() - 1.0 ) ) , 0.2 );
+ boost::numeric::odeint::copy( m_x_old , x );
                         return step_size_decreased;
                 }
                 else
                 {
                         if( max_rel_err < 0.5 )
                         {
- //error too small - increase dt and keep the evolution
+ //error too small - increase dt and keep the evolution and limit scaling factor to 5.0
                                 t += dt;
- // limit scaling factor to 5.0
- dt *= std::min( 0.9*pow(max_rel_err , -1.0/m_stepper.order_error_step()), 5.0 );
+ dt *= min( 0.9 * pow( max_rel_err , -1.0 / m_stepper.stepper_order() ) , 5.0 );
                                 return success_step_size_increased;
                         }
                         else
@@ -93,48 +112,32 @@
         template< class System >
         controlled_step_result try_step( System &sys , state_type &x , time_type &t , time_type &dt )
         {
+ m_dxdt_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
+ sys( x , m_dxdt , t );
+ return try_step( sys , x , m_dxdt , t , dt );
+ }
 
- system( x , m_dxdt , t );
- return try_step( system , x , m_dxdt , t , dt );
+ void adjust_size( const state_type &x )
+ {
+ m_dxdt_size_adjuster.adjust_size( x );
+ m_xerr_size_adjuster.adjust_size( x );
+ m_stepper.adjust_size( x );
         }
 
 
 private:
 
- time_type m_eps_abs;
- time_type m_eps_rel;
- time_type m_a_x;
- time_type m_a_dxdt;
+ error_stepper_type &m_stepper;
+ error_checker_type m_error_checker;
+
+ size_adjuster< state_type , 1 > m_dxdt_size_adjuster;
+ size_adjuster< state_type , 1 > m_xerr_size_adjuster;
 
         state_type m_dxdt;
- state_type m_x_tmp;
+ state_type m_x_old;
         state_type m_x_err;
- state_type m_x_scale;
-
 };
 
-//template<
-// class State ,
-// class Time = double ,
-// class Algebra = standard_algebra< State > ,
-// class Operations = standard_operations< Time > ,
-// class AdjustSizePolicy = adjust_size_initially_tag
-// >
-//class explicit_euler
-//: public explicit_stepper_base<
-// explicit_euler< State , Time , Algebra , Operations , AdjustSizePolicy > ,
-// 1 , State , Time , Algebra , Operations , AdjustSizePolicy >
-//{
-//public :
-//
-// BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( explicit_euler , 1 );
-//
-// template< class System >
-// void do_step_impl( System system , state_type &x , const state_type &dxdt , time_type t , time_type dt )
-// {
-// algebra_type::for_each2( x , dxdt , typename operations_type::increment1( dt ) );
-// }
-//};
 
 
 

Added: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/error_checker.hpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/error_checker.hpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -0,0 +1,51 @@
+/*
+ boost header: NUMERIC_ODEINT/error_checker.hpp
+
+ Copyright 2009 Karsten Ahnert
+ Copyright 2009 Mario Mulansky
+ Copyright 2009 Andre Bergner
+
+ 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)
+*/
+
+#ifndef BOOST_NUMERIC_ODEINT_ERROR_CHECKER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ERROR_CHECKER_HPP_INCLUDED
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template< class State , class Time >
+class error_checker_standard
+{
+public:
+
+ typedef State state_type;
+ typedef Time time_type;
+
+
+ error_checker_standard( void )
+ {}
+
+ time_type error( const state_type &x_old , const state_type &dxdt_old , const state_type &x_err , time_type dt )
+ {
+ return 0.0;
+ }
+
+private:
+
+ // time_type m_eps_abs;
+ // time_type m_eps_rel;
+ // time_type m_a_x;
+ // time_type m_a_dxdt;
+};
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif //BOOST_NUMERIC_ODEINT_ERROR_CHECKER_HPP_INCLUDED

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -51,6 +51,12 @@
 
         explicit_error_rk54_ck( void ) : m_size_adjuster() , m_x1() , m_x2() , m_x3() , m_x4() , m_x5() , m_x6()
         {
+ boost::numeric::odeint::construct( m_x1 );
+ boost::numeric::odeint::construct( m_x2 );
+ boost::numeric::odeint::construct( m_x3 );
+ boost::numeric::odeint::construct( m_x4 );
+ boost::numeric::odeint::construct( m_x5 );
+ boost::numeric::odeint::construct( m_x6 );
                 m_size_adjuster.register_state( 0 , m_x1 );
                 m_size_adjuster.register_state( 1 , m_x2 );
                 m_size_adjuster.register_state( 2 , m_x3 );
@@ -59,6 +65,16 @@
                 m_size_adjuster.register_state( 5 , m_x6 );
         }
 
+ ~explicit_error_rk54_ck( void )
+ {
+ boost::numeric::odeint::destruct( m_x1 );
+ boost::numeric::odeint::destruct( m_x2 );
+ boost::numeric::odeint::destruct( m_x3 );
+ boost::numeric::odeint::destruct( m_x4 );
+ boost::numeric::odeint::destruct( m_x5 );
+ boost::numeric::odeint::destruct( m_x6 );
+ }
+
 
         template< class System >
         void do_step_impl( System system , state_type &x , const state_type &dxdt , time_type t , time_type dt , state_type &xerr )

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -46,12 +46,24 @@
 
         explicit_rk4( void ) : m_size_adjuster() , m_dxt() , m_dxm() , m_dxh() , m_xt()
         {
+ boost::numeric::odeint::construct( m_dxt );
+ boost::numeric::odeint::construct( m_dxm );
+ boost::numeric::odeint::construct( m_dxh );
+ boost::numeric::odeint::construct( m_xt );
                 m_size_adjuster.register_state( 0 , m_dxt );
                 m_size_adjuster.register_state( 1 , m_dxm );
                 m_size_adjuster.register_state( 2 , m_dxh );
                 m_size_adjuster.register_state( 3 , m_xt );
         }
 
+ ~explicit_rk4( void )
+ {
+ boost::numeric::odeint::destruct( m_dxt );
+ boost::numeric::odeint::destruct( m_dxm );
+ boost::numeric::odeint::destruct( m_dxh );
+ boost::numeric::odeint::destruct( m_xt );
+ }
+
         template< class System >
         void do_step_impl( System system , state_type &x , const state_type &dxdt , time_type t , time_type dt )
         {

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -68,9 +68,15 @@
 
         explicit_stepper_base( void ) : m_size_adjuster() , m_dxdt()
         {
+ boost::numeric::odeint::construct( m_dxdt );
                 m_size_adjuster.register_state( 0 , m_dxdt );
         }
 
+ ~explicit_stepper_base( void )
+ {
+ boost::numeric::odeint::destruct( m_dxdt );
+ }
+
 
     stepper_type& stepper( void ) { return *static_cast< stepper_type* >( this ); }
     const stepper_type& stepper( void ) const {return *static_cast< const stepper_type* >( this );}
@@ -153,9 +159,16 @@
 
         explicit_error_stepper_base( void ) : m_size_adjuster() , m_dxdt()
         {
+ boost::numeric::odeint::construct( m_dxdt );
                 m_size_adjuster.register_state( 0 , m_dxdt );
         }
 
+ ~explicit_error_stepper_base( void )
+ {
+ boost::numeric::odeint::destruct( m_dxdt );
+ }
+
+
 
     stepper_type& stepper( void ) { return *static_cast< stepper_type* >( this ); }
     const stepper_type& stepper( void ) const {return *static_cast< const stepper_type* >( this );}
@@ -246,9 +259,16 @@
 
         explicit_stepper_and_error_stepper_base( void ) : m_size_adjuster() , m_dxdt()
         {
+ boost::numeric::odeint::construct( m_dxdt );
                 m_size_adjuster.register_state( 0 , m_dxdt );
         }
 
+ ~explicit_stepper_and_error_stepper_base( void )
+ {
+ boost::numeric::odeint::destruct( m_dxdt );
+ }
+
+
 
     stepper_type& stepper( void ) { return *static_cast< stepper_type* >( this ); }
     const stepper_type& stepper( void ) const {return *static_cast< const stepper_type* >( this );}
@@ -262,6 +282,12 @@
                 this->stepper().do_step_impl( system , x , m_dxdt , t , dt );
         }
 
+ template< class System >
+ void do_step( System system , state_type &x , const state_type &dxdt , time_type t , time_type dt )
+ {
+ this->stepper().do_step_impl( system , x , dxdt , t , dt );
+ }
+
 
         template< class System >
         void do_step( System system , state_type &x , time_type t , time_type dt , state_type &xerr )
@@ -272,6 +298,12 @@
         }
 
 
+ template< class System >
+ void do_step( System system , state_type &x , const state_type &dxdt , time_type t , time_type dt , state_type &xerr )
+ {
+ this->stepper().do_step_impl( system , x , dxdt , t , dt , xerr );
+ }
+
 
 
         void adjust_size( const state_type &x )

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -14,3 +14,4 @@
 
 # exe harmonic_oscillator : harmonic_oscillator.cpp ;
 # exe solar_system : solar_system.cpp point_type.hpp ;
+

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -30,7 +30,6 @@
     :
       [ run check_stepper_concepts.cpp libgsl libgslcblas ]
       [ run check_resize.cpp ]
- [ run test_gsl_vector_with_euler.cpp libgsl libgslcblas ]
     ;
 
-exe test_gsl_vector : test_gsl_vector.cpp libgsl libgslcblas ;
+

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
@@ -29,7 +29,7 @@
 
 #include <boost/numeric/odeint.hpp>
 #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
-#include <boost/numeric/odeint/algebra/gsl_vector_adaptor.hpp>
+#include <boost/numeric/odeint/algebra/external/gsl_vector_adaptor.hpp>
 
 #include "vector_space_1d.hpp"
 
@@ -82,6 +82,20 @@
     stepper.do_step( system , x , 0.0 , 0.1 , xerr );
 }
 
+template< class Stepper , class System >
+void check_controlled_stepper_concept( Stepper &stepper , System system , typename Stepper::state_type &x )
+{
+ typedef Stepper stepper_type;
+ typedef typename stepper_type::state_type container_type;
+ typedef typename stepper_type::order_type order_type;
+ typedef typename stepper_type::time_type time_type;
+
+ time_type t = 0.0 , dt = 0.1;
+ stepper.try_step( system , x , t , dt );
+}
+
+
+
 
 
 template< class Stepper , class State > struct perform_stepper_test;
@@ -98,7 +112,6 @@
         }
 };
 
-// ToDo : implement
 template< class Stepper >
 struct perform_stepper_test< Stepper , gsl_vector_type >
 {
@@ -107,8 +120,8 @@
                 gsl_vector_type *x = gsl_vector_alloc( 1 );
                 gsl_vector_set( x , 0 , 0.0 );
                 Stepper stepper;
-// check_stepper_concept( stepper , constant_system2 , *x );
-// BOOST_CHECK_SMALL( fabs( gsl_vector_get( x , 0 ) - 0.1 ) , eps );
+ check_stepper_concept( stepper , constant_system2 , *x );
+ BOOST_CHECK_SMALL( fabs( gsl_vector_get( x , 0 ) - 0.1 ) , eps );
                 gsl_vector_free( x );
         }
 };
@@ -203,8 +216,8 @@
                 gsl_vector_type *x = gsl_vector_alloc( 1 ) , *xerr = gsl_vector_alloc( 1 );
                 gsl_vector_set( x , 0 , 0.0 );
                 Stepper stepper;
- // check_error_stepper_concept( stepper , constant_system2 , *x , *xerr );
- // BOOST_CHECK_SMALL( fabs( gsl_vector_get( x , 0 ) - 0.1 ) , eps );
+ check_error_stepper_concept( stepper , constant_system2 , *x , *xerr );
+ BOOST_CHECK_SMALL( fabs( gsl_vector_get( x , 0 ) - 0.1 ) , eps );
                 gsl_vector_free( x ); gsl_vector_free( xerr );
         }
 };
@@ -252,3 +265,99 @@
         perform_error_stepper_test< Stepper , typename Stepper::state_type > tester;
         tester();
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+template< class ControlledStepper , class State > struct perform_controlled_stepper_test;
+
+template< class ControlledStepper >
+struct perform_controlled_stepper_test< ControlledStepper , vector_type >
+{
+ void operator()( void )
+ {
+ vector_type x( 1 , 0.0 );
+ typename ControlledStepper::error_stepper_type error_stepper;
+ error_checker_standard< typename ControlledStepper::state_type , typename ControlledStepper::time_type > error_checker;
+ ControlledStepper controlled_stepper( error_stepper , error_checker );
+ check_controlled_stepper_concept( controlled_stepper , constant_system1 , x );
+ BOOST_CHECK_SMALL( fabs( x[0] - 0.1 ) , eps );
+ }
+};
+
+template< class ControlledStepper >
+struct perform_controlled_stepper_test< ControlledStepper , gsl_vector_type >
+{
+ void operator()( void ) const
+ {
+ gsl_vector_type *x = gsl_vector_alloc( 1 );
+ gsl_vector_set( x , 0 , 0.0 );
+ typename ControlledStepper::error_stepper_type error_stepper;
+ error_checker_standard< typename ControlledStepper::state_type , typename ControlledStepper::time_type > error_checker;
+ ControlledStepper controlled_stepper( error_stepper , error_checker );
+ check_controlled_stepper_concept( controlled_stepper , constant_system2 , *x );
+ BOOST_CHECK_SMALL( fabs( gsl_vector_get( x , 0 ) - 0.1 ) , eps );
+ gsl_vector_free( x );
+ }
+};
+
+template< class ControlledStepper >
+struct perform_controlled_stepper_test< ControlledStepper , vector_space_type >
+{
+ void operator()( void ) const
+ {
+ vector_space_type x;
+ x.m_x = 0.0;
+ typename ControlledStepper::error_stepper_type error_stepper;
+ error_checker_standard< typename ControlledStepper::state_type , typename ControlledStepper::time_type > error_checker;
+ ControlledStepper controlled_stepper( error_stepper , error_checker );
+ check_controlled_stepper_concept( controlled_stepper , constant_system3 , x );
+ BOOST_CHECK_SMALL( fabs( x.m_x - 0.1 ) , eps );
+ }
+};
+
+template< class ControlledStepper >
+struct perform_controlled_stepper_test< ControlledStepper , array_type >
+{
+ void operator()( void )
+ {
+ array_type x;
+ x[0] = 0.0;
+ typename ControlledStepper::error_stepper_type error_stepper;
+ error_checker_standard< typename ControlledStepper::state_type , typename ControlledStepper::time_type > error_checker;
+ ControlledStepper controlled_stepper( error_stepper , error_checker );
+ check_controlled_stepper_concept( controlled_stepper , constant_system4 , x );
+ BOOST_CHECK_SMALL( fabs( x[0] - 0.1 ) , eps );
+ }
+};
+
+
+template< class State > class controlled_stepper_methods : public mpl::vector<
+ controlled_error_stepper< explicit_error_rk54_ck< State , double , typename algebra_dispatcher< State >::type > >
+> { };
+
+typedef mpl::insert_range< mpl::vector0<> , mpl::end< mpl::vector0<> >::type , controlled_stepper_methods< vector_type > >::type first_controlled_stepper_type;
+typedef mpl::insert_range< first_controlled_stepper_type , mpl::end< first_controlled_stepper_type >::type , controlled_stepper_methods< gsl_vector_type > >::type second_controlled_stepper_type;
+typedef mpl::insert_range< second_controlled_stepper_type , mpl::end< second_controlled_stepper_type >::type , controlled_stepper_methods< vector_space_type > >::type third_controlled_stepper_type;
+typedef mpl::insert_range< third_controlled_stepper_type , mpl::end< third_controlled_stepper_type >::type , controlled_stepper_methods< array_type > >::type all_controlled_stepper_methods;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( controlled_stepper_test , ControlledStepper , all_controlled_stepper_methods )
+{
+ perform_controlled_stepper_test< ControlledStepper , typename ControlledStepper::state_type > tester;
+ tester();
+}

Deleted: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/test_gsl_vector.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/test_gsl_vector.cpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
+++ (empty file)
@@ -1,40 +0,0 @@
-/* Boost stepper_euler.cpp test file
-
- Copyright 2009 Karsten Ahnert
- Copyright 2009 Mario Mulansky
-
- This file tests the use of the euler stepper
-
- 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)
-*/
-
-#include <vector>
-#include <cmath>
-
-#include <boost/numeric/odeint.hpp>
-#include <boost/numeric/odeint/algebra/gsl_vector_adaptor.hpp>
-
-using namespace boost::numeric::odeint;
-
-
-void constant_system2( const gsl_vector &x , gsl_vector &dxdt , double t ) { gsl_vector_set( &dxdt , 0 , 1.0 ); }
-
-const double eps = 1.0e-14;
-
-int main( int argc , char **argv )
-{
-
- gsl_vector *x_vec = gsl_vector_alloc( 1 );
- gsl_vector &x = *x_vec;
-
- explicit_euler< gsl_vector > euler;
- euler.do_step( constant_system2 , x , 0.0 , 0.1 );
-
- gsl_vector_free( x_vec );
-}
-
-
-
-

Deleted: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/test_gsl_vector_with_euler.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/test_gsl_vector_with_euler.cpp 2010-07-23 10:59:48 EDT (Fri, 23 Jul 2010)
+++ (empty file)
@@ -1,44 +0,0 @@
-/* Boost stepper_euler.cpp test file
-
- Copyright 2009 Karsten Ahnert
- Copyright 2009 Mario Mulansky
-
- This file tests the use of the euler stepper
-
- 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)
-*/
-
-#define BOOST_TEST_MODULE test_gsl_vector_with_euler
-
-#include <vector>
-#include <cmath>
-
-#include <boost/test/unit_test.hpp>
-
-#include <boost/numeric/odeint.hpp>
-#include <boost/numeric/odeint/algebra/gsl_vector_adaptor.hpp>
-
-using namespace boost::unit_test;
-using namespace boost::numeric::odeint;
-
-
-void constant_system2( const gsl_vector &x , gsl_vector &dxdt , double t ) { gsl_vector_set( &dxdt , 0 , 1.0 ); }
-
-const double eps = 1.0e-14;
-
-BOOST_AUTO_TEST_CASE( gsl_vector_test )
-{
- gsl_vector *x_vec = gsl_vector_alloc( 1 );
- gsl_vector &x = *x_vec;
-
- explicit_euler< gsl_vector > euler;
-// euler.do_step( constant_system2 , x , 0.0 , 0.1 );
-
- gsl_vector_free( x_vec );
-}
-
-
-
-


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