Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65372 - in sandbox/odeint/branches/karsten: boost/numeric/odeint/stepper libs/numeric/odeint/test libs/numeric/odeint/test/gsl
From: karsten.ahnert_at_[hidden]
Date: 2010-09-10 09:24:44


Author: karsten
Date: 2010-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
New Revision: 65372
URL: http://svn.boost.org/trac/boost/changeset/65372

Log:
* reorganizing the tests and small bug fixing
Added:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/gsl/
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/gsl/Jamfile (contents, props changed)
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/gsl/check_stepper_concepts.cpp (contents, props changed)
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp | 1
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile | 31 ++-----
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp | 5
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp | 28 ++++---
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp | 149 ++++++++++++++++++++-------------------
   5 files changed, 106 insertions(+), 108 deletions(-)

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-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
@@ -82,6 +82,7 @@
         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::min;
                 using std::pow;
 
                 m_xerr_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );

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-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
@@ -18,33 +18,20 @@
     : requirements
       <define>BOOST_ALL_NO_LIB=1
       <library>/boost/test//boost_unit_test_framework
-# <link>static
-# <link>shared:<define>BOOST_TEST_DYN_LINK=1
       <include>../../../..
       <include>$(BOOST_ROOT)
     ;
 
     
-lib libgsl : : <name>gsl <link>shared ;
-lib libgslcblas : : <name>gslcblas <link>shared ;
 
-test-suite "odeint"
- :
- [ run check_stepper_concepts.cpp libgsl libgslcblas
- :
- :
- : <link>shared:<define>BOOST_TEST_DYN_LINK=1
- ]
- [ run check_resize.cpp
- :
- :
- : <link>static
- ]
- [ run check_implicit_euler.cpp
- :
- :
- : <link>static
- ]
- ;
+unit-test basic_test
+ : check_stepper_concepts.cpp
+# check_resize.cpp
+ check_implicit_euler.cpp
+ :
+ : <link>static
+ ;
+
+
 
 

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp 2010-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
@@ -10,8 +10,6 @@
  copy at http://www.boost.org/LICENSE_1_0.txt)
 */
 
-#define BOOST_TEST_MODULE test_implicit_euler
-
 #include <boost/test/unit_test.hpp>
 
 #include <boost/numeric/odeint.hpp>
@@ -43,6 +41,7 @@
     jacobi( 1 , 1 ) = 3;
 }
 
+BOOST_AUTO_TEST_SUITE( implicit_euler_test )
 
 BOOST_AUTO_TEST_CASE( test_euler )
 {
@@ -57,3 +56,5 @@
     BOOST_CHECK_MESSAGE( abs( x(0) - 0.1 ) < eps , x[0] - 0.1 );
 
 }
+
+BOOST_AUTO_TEST_SUITE_END()

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp 2010-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
@@ -76,10 +76,11 @@
 }
 
 
+BOOST_AUTO_TEST_SUITE( check_resize_test )
 
-test_suite* init_unit_test_suite( int argc, char* argv[] )
-{
- test_suite *test = BOOST_TEST_SUITE( "check resize functionality" );
+//test_suite* init_unit_test_suite( int argc, char* argv[] )
+//{
+// test_suite *test = BOOST_TEST_SUITE( "check resize functionality" );
 
     typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_manually_tag > euler_manual_type;
     typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_initially_tag > euler_initially_type;
@@ -98,15 +99,18 @@
     rk4_initially_type rk4_initially;
     rk4_always_type rk4_always;
 
+// BOOST_AUTO_TEST_CASE( boost::bind( &test_resize< euler_manual_type > , boost::ref( euler_manual ) , 1 , 0 ) );
 
- test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_manual_type > , boost::ref( euler_manual ) , 1 , 0 ) ) );
- test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_initially_type > , boost::ref( euler_initially ) , 1 , 1 ) ) );
- test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_always_type > , boost::ref( euler_always ) , 1 , 3 ) ) );
-
- test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_manual_type > , boost::ref( rk4_manual ) , 5 , 0 ) ) );
- test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_initially_type > , boost::ref( rk4_initially ) , 5 , 1 ) ) );
- test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_always_type > , boost::ref( rk4_always ) , 5 , 3 ) ) );
 
- return test;
-}
 
+// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_manual_type > , boost::ref( euler_manual ) , 1 , 0 ) ) );
+// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_initially_type > , boost::ref( euler_initially ) , 1 , 1 ) ) );
+// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_always_type > , boost::ref( euler_always ) , 1 , 3 ) ) );
+//
+// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_manual_type > , boost::ref( rk4_manual ) , 5 , 0 ) ) );
+// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_initially_type > , boost::ref( rk4_initially ) , 5 , 1 ) ) );
+// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_always_type > , boost::ref( rk4_always ) , 5 , 3 ) ) );
+
+// return test;
+//}
+BOOST_AUTO_TEST_SUITE_END()

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-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
@@ -14,7 +14,7 @@
  copy at http://www.boost.org/LICENSE_1_0.txt)
 */
 
-#define BOOST_TEST_MODULE test_stepper_concepts
+#define BOOST_TEST_MODULE odeint_basic_test
 
 #include <vector>
 #include <cmath>
@@ -27,13 +27,15 @@
 #include <boost/mpl/for_each.hpp>
 #include <boost/mpl/insert_range.hpp>
 #include <boost/mpl/end.hpp>
+#include <boost/mpl/copy.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/inserter.hpp>
 
 #include <boost/bind.hpp>
 #include <boost/utility.hpp>
 
 #include <boost/numeric/odeint.hpp>
 #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
-#include <boost/numeric/odeint/algebra/external/gsl_vector_adaptor.hpp>
 
 #include "vector_space_1d.hpp"
 
@@ -46,18 +48,19 @@
 
 
 typedef std::vector< double > vector_type;
-typedef gsl_vector gsl_vector_type;
 typedef vector_space_1d< double > vector_space_type;
 typedef std::tr1::array< double , 1 > array_type;
 
+typedef mpl::vector< vector_type , vector_space_type , array_type >::type container_types;
+
+
 template< class State > struct algebra_dispatcher { typedef standard_algebra< State > type; };
 template<> struct algebra_dispatcher< vector_space_type > { typedef vector_space_algebra type; };
 
 
-void constant_system1( const vector_type &x , vector_type &dxdt , double t ) { dxdt[0] = 1.0; }
-void constant_system2( const gsl_vector_type &x , gsl_vector_type &dxdt , double t ) { gsl_vector_set( &dxdt , 0 , 1.0 ); }
-void constant_system3( const vector_space_type &x , vector_space_type &dxdt , double t ) { dxdt.m_x = 1.0; }
-void constant_system4( const array_type &x , array_type &dxdt , double t ) { dxdt[0] = 1.0; }
+void constant_system_vector( const vector_type &x , vector_type &dxdt , double t ) { dxdt[0] = 1.0; }
+void constant_system_vector_space( const vector_space_type &x , vector_space_type &dxdt , double t ) { dxdt.m_x = 1.0; }
+void constant_system_array( const array_type &x , array_type &dxdt , double t ) { dxdt[0] = 1.0; }
 
 
 
@@ -111,26 +114,12 @@
         {
                 vector_type x( 1 , 2.0 );
                 Stepper stepper;
- check_stepper_concept( stepper , constant_system1 , x );
+ check_stepper_concept( stepper , constant_system_vector , x );
                 BOOST_CHECK_SMALL( fabs( x[0] - 2.1 ) , eps );
         }
 };
 
 template< class Stepper >
-struct perform_stepper_test< Stepper , gsl_vector_type >
-{
- void operator()( void ) const
- {
- gsl_vector_type *x = gsl_vector_alloc( 1 );
- gsl_vector_set( x , 0 , 2.0 );
- Stepper stepper;
- check_stepper_concept( stepper , constant_system2 , *x );
- BOOST_CHECK_SMALL( fabs( gsl_vector_get( x , 0 ) - 2.1 ) , eps );
- gsl_vector_free( x );
- }
-};
-
-template< class Stepper >
 struct perform_stepper_test< Stepper , vector_space_type >
 {
         void operator()( void ) const
@@ -138,7 +127,7 @@
                 vector_space_type x;
                 x.m_x = 2.0;
                 Stepper stepper;
- check_stepper_concept( stepper , constant_system3 , x );
+ check_stepper_concept( stepper , constant_system_vector_space , x );
                 BOOST_CHECK_SMALL( fabs( x.m_x - 2.1 ) , eps );
         }
 };
@@ -151,7 +140,7 @@
                 array_type x;
                 x[0] = 2.0;
                 Stepper stepper;
- check_stepper_concept( stepper , constant_system4 , x );
+ check_stepper_concept( stepper , constant_system_array , x );
                 BOOST_CHECK_SMALL( fabs( x[0] - 2.1 ) , eps );
         }
 };
@@ -166,13 +155,26 @@
> { };
 
 
-typedef mpl::insert_range< mpl::vector0<> , mpl::end< mpl::vector0<> >::type , stepper_methods< vector_type > >::type first_stepper_type;
-typedef mpl::insert_range< first_stepper_type , mpl::end< first_stepper_type >::type , stepper_methods< gsl_vector_type > >::type second_stepper_type;
-typedef mpl::insert_range< second_stepper_type , mpl::end< second_stepper_type >::type , stepper_methods< vector_space_type > >::type third_stepper_type;
-typedef mpl::insert_range< third_stepper_type , mpl::end< third_stepper_type >::type , stepper_methods< array_type > >::type all_stepper_methods;
 
+typedef mpl::copy
+<
+ container_types ,
+ mpl::inserter
+ <
+ mpl::vector0<> ,
+ mpl::insert_range
+ <
+ mpl::_1 ,
+ mpl::end< mpl::_1 > ,
+ stepper_methods< mpl::_2 >
+ >
+ >
+>::type all_stepper_methods;
 
 
+
+BOOST_AUTO_TEST_SUITE( stepper_concept_test )
+
 BOOST_AUTO_TEST_CASE_TEMPLATE( stepper_test , Stepper, all_stepper_methods )
 {
         perform_stepper_test< Stepper , typename Stepper::state_type > tester;
@@ -180,7 +182,7 @@
 }
 
 
-
+BOOST_AUTO_TEST_SUITE_END()
 
 
 
@@ -207,24 +209,11 @@
         {
                 vector_type x( 1 , 2.0 ) , xerr( 1 );
                 Stepper stepper;
- check_error_stepper_concept( stepper , constant_system1 , x , xerr );
+ check_error_stepper_concept( stepper , constant_system_vector , x , xerr );
                 BOOST_CHECK_SMALL( fabs( x[0] - 2.1 ) , eps );
         }
 };
 
-template< class Stepper >
-struct perform_error_stepper_test< Stepper , gsl_vector_type >
-{
- void operator()( void ) const
- {
- gsl_vector_type *x = gsl_vector_alloc( 1 ) , *xerr = gsl_vector_alloc( 1 );
- gsl_vector_set( x , 0 , 2.0 );
- Stepper stepper;
- check_error_stepper_concept( stepper , constant_system2 , *x , *xerr );
- BOOST_CHECK_SMALL( fabs( gsl_vector_get( x , 0 ) - 2.1 ) , eps );
- gsl_vector_free( x ); gsl_vector_free( xerr );
- }
-};
 
 template< class Stepper >
 struct perform_error_stepper_test< Stepper , vector_space_type >
@@ -234,7 +223,7 @@
                 vector_space_type x , xerr;
                 x.m_x = 2.0;
                 Stepper stepper;
- check_error_stepper_concept( stepper , constant_system3 , x , xerr );
+ check_error_stepper_concept( stepper , constant_system_vector_space , x , xerr );
                 BOOST_CHECK_SMALL( fabs( x.m_x - 2.1 ) , eps );
         }
 };
@@ -247,7 +236,7 @@
                 array_type x , xerr;
                 x[0] = 2.0;
                 Stepper stepper;
- check_error_stepper_concept( stepper , constant_system4 , x , xerr );
+ check_error_stepper_concept( stepper , constant_system_array , x , xerr );
                 BOOST_CHECK_SMALL( fabs( x[0] - 2.1 ) , eps );
         }
 };
@@ -258,11 +247,24 @@
         explicit_error_rk54_ck< State , double , typename algebra_dispatcher< State >::type >
> { };
 
-typedef mpl::insert_range< mpl::vector0<> , mpl::end< mpl::vector0<> >::type , error_stepper_methods< vector_type > >::type first_error_stepper_type;
-typedef mpl::insert_range< first_error_stepper_type , mpl::end< first_error_stepper_type >::type , error_stepper_methods< gsl_vector_type > >::type second_error_stepper_type;
-typedef mpl::insert_range< second_error_stepper_type , mpl::end< second_error_stepper_type >::type , error_stepper_methods< vector_space_type > >::type third_error_stepper_type;
-typedef mpl::insert_range< third_error_stepper_type , mpl::end< third_error_stepper_type >::type , error_stepper_methods< array_type > >::type all_error_stepper_methods;
 
+typedef mpl::copy
+<
+ container_types ,
+ mpl::inserter
+ <
+ mpl::vector0<> ,
+ mpl::insert_range
+ <
+ mpl::_1 ,
+ mpl::end< mpl::_1 > ,
+ error_stepper_methods< mpl::_2 >
+ >
+ >
+>::type all_error_stepper_methods;
+
+
+BOOST_AUTO_TEST_SUITE( error_stepper_concept_test )
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( error_stepper_test , Stepper , all_error_stepper_methods )
 {
@@ -270,6 +272,8 @@
         tester();
 }
 
+BOOST_AUTO_TEST_SUITE_END()
+
 
 
 
@@ -299,28 +303,12 @@
                 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 );
+ check_controlled_stepper_concept( controlled_stepper , constant_system_vector , x );
                 BOOST_CHECK_SMALL( fabs( x[0] - 2.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 , 2.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 ) - 2.1 ) , eps );
- gsl_vector_free( x );
- }
-};
-
-template< class ControlledStepper >
 struct perform_controlled_stepper_test< ControlledStepper , vector_space_type >
 {
         void operator()( void ) const
@@ -330,7 +318,7 @@
                 typename ControlledStepper::error_stepper_type error_stepper;
                 error_checker_standard< typename ControlledStepper::state_type , typename ControlledStepper::time_type , vector_space_algebra > error_checker;
                 ControlledStepper controlled_stepper( error_stepper , error_checker );
- check_controlled_stepper_concept( controlled_stepper , constant_system3 , x );
+ check_controlled_stepper_concept( controlled_stepper , constant_system_vector_space , x );
                 BOOST_CHECK_SMALL( fabs( x.m_x - 2.1 ) , eps );
         }
 };
@@ -345,7 +333,7 @@
                 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 );
+ check_controlled_stepper_concept( controlled_stepper , constant_system_array , x );
                 BOOST_CHECK_SMALL( fabs( x[0] - 2.1 ) , eps );
         }
 };
@@ -355,13 +343,30 @@
         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;
+typedef mpl::copy
+<
+ container_types ,
+ mpl::inserter
+ <
+ mpl::vector0<> ,
+ mpl::insert_range
+ <
+ mpl::_1 ,
+ mpl::end< mpl::_1 > ,
+ controlled_stepper_methods< mpl::_2 >
+ >
+ >
+>::type all_controlled_stepper_methods;
+
+
+
+
+BOOST_AUTO_TEST_SUITE( controlled_stepper_concept_test )
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( controlled_stepper_test , ControlledStepper , all_controlled_stepper_methods )
 {
         perform_controlled_stepper_test< ControlledStepper , typename ControlledStepper::state_type > tester;
         tester();
 }
+
+BOOST_AUTO_TEST_SUITE_END()

Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/gsl/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/gsl/Jamfile 2010-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
@@ -0,0 +1 @@
+Jamfile

Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/gsl/check_stepper_concepts.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/gsl/check_stepper_concepts.cpp 2010-09-10 09:24:40 EDT (Fri, 10 Sep 2010)
@@ -0,0 +1 @@
+check_stepper_concepts.cpp


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