mirror of
https://github.com/boostorg/odeint.git
synced 2025-05-09 23:24:01 +00:00
some fixes for c++11, clang and msvc
This commit is contained in:
parent
1cdc33dc9c
commit
6e9d680cb5
@ -198,10 +198,10 @@ int main(int /* argc */ , char** /* argv */ )
|
||||
|
||||
|
||||
//[ harm_iterator_const_step]
|
||||
std::for_each( make_const_step_begin_iterator( stepper , x , 0.0 , 0.1 , 10.0 ) ,
|
||||
make_const_step_end_iterator( stepper , x ) ,
|
||||
[]( const state_type &x , double t ) {
|
||||
cout << t << " " << x[0] << " " << x[1] << "\n"; } );
|
||||
std::for_each( make_const_step_time_iterator_begin( stepper , harmonic_oscillator, x , 0.0 , 0.1 , 10.0 ) ,
|
||||
make_const_step_time_iterator_end( stepper , harmonic_oscillator, x ) ,
|
||||
[]( std::pair< const state_type & , const double & > x ) {
|
||||
cout << x.second << " " << x.first[0] << " " << x.first[1] << "\n"; } );
|
||||
//]
|
||||
#endif
|
||||
|
||||
|
@ -43,20 +43,23 @@ namespace odeint {
|
||||
#if BOOST_NUMERIC_ODEINT_CXX11
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference
|
||||
class unwrap_reference
|
||||
{
|
||||
public:
|
||||
typedef typename std::remove_reference<T>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference< std::reference_wrapper<T> >
|
||||
class unwrap_reference< std::reference_wrapper<T> >
|
||||
{
|
||||
public:
|
||||
typedef typename std::remove_reference<T>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference< boost::reference_wrapper<T> >
|
||||
class unwrap_reference< boost::reference_wrapper<T> >
|
||||
{
|
||||
public:
|
||||
typedef typename boost::unwrap_reference<T>::type type;
|
||||
};
|
||||
|
||||
|
@ -72,10 +72,11 @@ test-suite "odeint"
|
||||
[ run times_iterator.cpp ]
|
||||
[ run times_time_iterator.cpp ]
|
||||
[ compile unwrap_boost_reference.cpp ]
|
||||
[ compile-fail unwrap_reference.cpp ]
|
||||
[ compile unwrap_reference.cpp : <cxxflags>-std=c++11 : unwrap_reference_C++11 ]
|
||||
[ compile-fail unwrap_reference.cpp : <cxxflags>-std=c++98 : unwrap_reference_C++98 ]
|
||||
: <testing.launcher>valgrind
|
||||
;
|
||||
|
||||
|
||||
# also run numeric tests
|
||||
build-project numeric ;
|
||||
|
||||
|
@ -91,8 +91,14 @@ struct perform_stepper_test
|
||||
vector_space_type x;
|
||||
x = 2.0;
|
||||
Stepper stepper;
|
||||
constant_system_functor_vector_space sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_stepper_concept( stepper , constant_system_vector_space< vector_space_type , vector_space_type , typename Stepper::time_type > , x );
|
||||
check_stepper_concept( stepper , boost::cref( constant_system_functor_vector_space() ) , x );
|
||||
#else
|
||||
check_stepper_concept( stepper , boost::cref( sys ) , x );
|
||||
#endif
|
||||
check_stepper_concept( stepper , boost::cref( sys ) , x );
|
||||
std::cout << x << " ?= " << result << std::endl;
|
||||
BOOST_CHECK( (abs( x - result )) < eps );
|
||||
}
|
||||
@ -107,8 +113,14 @@ struct perform_stepper_test< Stepper , std::vector<T> >
|
||||
using std::abs;
|
||||
vector_type x( 1 , static_cast<T>(2.0) );
|
||||
Stepper stepper;
|
||||
constant_system_functor_standard sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_stepper_concept( stepper , constant_system_standard< vector_type , vector_type , typename Stepper::time_type > , x );
|
||||
check_stepper_concept( stepper , boost::cref( constant_system_functor_standard() ) , x );
|
||||
#else
|
||||
check_stepper_concept( stepper , boost::cref( sys ) , x );
|
||||
#endif
|
||||
check_stepper_concept( stepper , boost::cref( sys ) , x );
|
||||
std::cout << x[0] << " ?= " << result << std::endl;
|
||||
BOOST_CHECK( (abs( x[0] - result )) < eps );
|
||||
}
|
||||
@ -124,8 +136,14 @@ struct perform_stepper_test< Stepper , boost::array<T,1> >
|
||||
array_type x;
|
||||
x[0] = static_cast<T>(2.0);
|
||||
Stepper stepper;
|
||||
constant_system_functor_standard sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_stepper_concept( stepper , constant_system_standard< array_type , array_type , typename Stepper::time_type > , x );
|
||||
check_stepper_concept( stepper , boost::cref( constant_system_functor_standard() ) , x );
|
||||
#else
|
||||
check_stepper_concept( stepper , boost::cref( sys ) , x );
|
||||
#endif
|
||||
check_stepper_concept( stepper , boost::cref( sys ) , x );
|
||||
std::cout << x[0] << " ?= " << result << std::endl;
|
||||
BOOST_CHECK( (abs( x[0] - result )) < eps );
|
||||
}
|
||||
|
@ -90,10 +90,16 @@ struct perform_controlled_stepper_test
|
||||
vector_space_type x;
|
||||
x = 2.0;
|
||||
ControlledStepper controlled_stepper;
|
||||
constant_system_functor_vector_space sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_controlled_stepper_concept( controlled_stepper ,
|
||||
constant_system_vector_space< vector_space_type , vector_space_type , typename ControlledStepper::time_type >
|
||||
, x );
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( constant_system_functor_vector_space() ) , x );
|
||||
#else
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
#endif
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
BOOST_CHECK( (abs( x - result )) < eps );
|
||||
}
|
||||
};
|
||||
@ -107,10 +113,17 @@ struct perform_controlled_stepper_test< ControlledStepper , std::vector<T> >
|
||||
using std::abs;
|
||||
vector_type x( 1 , 2.0 );
|
||||
ControlledStepper controlled_stepper;
|
||||
constant_system_functor_standard sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
|
||||
check_controlled_stepper_concept( controlled_stepper ,
|
||||
constant_system_standard< vector_type , vector_type , typename ControlledStepper::time_type > ,
|
||||
x );
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( constant_system_functor_standard() ) , x );
|
||||
#else
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
#endif
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
BOOST_CHECK( (abs( x[0] - result )) < eps );
|
||||
}
|
||||
};
|
||||
@ -124,10 +137,16 @@ struct perform_controlled_stepper_test< ControlledStepper , vector_space_type >
|
||||
vector_space_type x;
|
||||
x = 2.0;
|
||||
ControlledStepper controlled_stepper;
|
||||
constant_system_functor_vector_space sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_controlled_stepper_concept( controlled_stepper ,
|
||||
constant_system_vector_space< vector_space_type , vector_space_type , typename ControlledStepper::time_type >
|
||||
, x );
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( constant_system_functor_vector_space() ) , x );
|
||||
#else
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
#endif
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
BOOST_CHECK( (abs( x - result )) < eps );
|
||||
}
|
||||
};
|
||||
@ -142,8 +161,14 @@ struct perform_controlled_stepper_test< ControlledStepper , boost::array<T,1> >
|
||||
array_type x;
|
||||
x[0] = 2.0;
|
||||
ControlledStepper controlled_stepper;
|
||||
constant_system_functor_standard sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_controlled_stepper_concept( controlled_stepper , constant_system_standard< array_type , array_type , typename ControlledStepper::time_type > , x );
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( constant_system_functor_standard() ) , x );
|
||||
#else
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
#endif
|
||||
check_controlled_stepper_concept( controlled_stepper , boost::cref( sys ) , x );
|
||||
BOOST_CHECK( (abs( x[0] - result )) < eps );
|
||||
}
|
||||
};
|
||||
|
@ -87,11 +87,17 @@ struct perform_error_stepper_test
|
||||
vector_space_type x , xerr;
|
||||
x = 2.0;
|
||||
Stepper stepper;
|
||||
constant_system_functor_vector_space sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_error_stepper_concept( stepper ,
|
||||
constant_system_vector_space< vector_space_type , vector_space_type , typename Stepper::time_type > ,
|
||||
x ,
|
||||
xerr );
|
||||
check_error_stepper_concept( stepper , boost::cref( constant_system_functor_vector_space() ) , x , xerr );
|
||||
#else
|
||||
check_error_stepper_concept( stepper , boost::cref( sys ) , x , xerr );
|
||||
#endif
|
||||
check_error_stepper_concept( stepper , boost::cref( sys ) , x , xerr );
|
||||
|
||||
BOOST_CHECK_MESSAGE( (abs( x - result )) < eps , x );
|
||||
}
|
||||
@ -106,8 +112,14 @@ struct perform_error_stepper_test< Stepper , std::vector<T> >
|
||||
using std::abs;
|
||||
vector_type x( 1 , 2.0 ) , xerr( 1 );
|
||||
Stepper stepper;
|
||||
constant_system_functor_standard sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_error_stepper_concept( stepper , constant_system_standard< vector_type , vector_type , typename Stepper::time_type > , x , xerr );
|
||||
check_error_stepper_concept( stepper , boost::cref( constant_system_functor_standard() ) , x , xerr );
|
||||
#else
|
||||
check_error_stepper_concept( stepper , boost::cref( sys ) , x , xerr );
|
||||
#endif
|
||||
check_error_stepper_concept( stepper , boost::cref( sys ) , x , xerr );
|
||||
BOOST_CHECK( (abs( x[0] - result )) < eps );
|
||||
}
|
||||
};
|
||||
@ -123,8 +135,14 @@ struct perform_error_stepper_test< Stepper , boost::array<T,1> >
|
||||
array_type x , xerr;
|
||||
x[0] = 2.0;
|
||||
Stepper stepper;
|
||||
constant_system_functor_standard sys;
|
||||
#ifndef _MSC_VER
|
||||
// dont run this for MSVC due to compiler bug 697006
|
||||
check_error_stepper_concept( stepper , constant_system_standard< array_type , array_type , typename Stepper::time_type > , x , xerr );
|
||||
check_error_stepper_concept( stepper , boost::cref( constant_system_functor_standard() ) , x , xerr );
|
||||
#else
|
||||
check_error_stepper_concept( stepper , boost::cref( sys ) , x , xerr );
|
||||
#endif
|
||||
check_error_stepper_concept( stepper , boost::cref( sys ) , x , xerr );
|
||||
BOOST_CHECK( (abs( x[0] - result )) < eps );
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user