Squashed 'boost/' content from commit b4feb19f2

git-subtree-dir: boost
git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
Bill Somerville
2018-06-09 21:48:32 +01:00
commit 4ebe6417a5
12444 changed files with 2327021 additions and 0 deletions
@@ -0,0 +1,36 @@
# Copyright 2012-2013 Karsten Ahnert
# Copyright 2012-2013 Mario Mulansky
# 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)
# bring in rules for testing
import testing ;
import os ;
use-project boost : $(BOOST_ROOT) ;
local EIGEN_ROOT = [ os.environ EIGEN_ROOT ] ;
project
: requirements
<library>/boost/test//boost_unit_test_framework
<define>BOOST_ALL_NO_LIB=1
<include>$(EIGEN_ROOT)
<include>../../test
<link>static
# <cxxflags>-D_SCL_SECURE_NO_WARNINGS
;
test-suite "odeint"
:
[ compile is_resizeable.cpp ]
[ run same_size.cpp ]
[ run resize.cpp ]
[ run runge_kutta4.cpp ]
[ run runge_kutta_dopri5.cpp ]
[ run integrate.cpp ]
[ compile-fail fail_integrate.cpp ]
: <testing.launcher>valgrind
;
@@ -0,0 +1,47 @@
/*
[auto_generated]
fail_integrate.cpp
[begin_description]
tba.
[end_description]
Copyright 2009-2012 Karsten Ahnert
Copyright 2009-2012 Mario Mulansky
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 <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(disable:4996)
#endif
#define BOOST_TEST_MODULE odeint_dummy
#include <boost/numeric/odeint/integrate/integrate.hpp>
#include <boost/numeric/odeint/external/eigen/eigen.hpp>
#include <boost/test/unit_test.hpp>
#include "dummy_odes.hpp"
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
BOOST_AUTO_TEST_SUITE( eigen_fail_integrate )
BOOST_AUTO_TEST_CASE( test )
{
typedef Eigen::Matrix< double , 1 , 1 > state_type;
state_type x;
x[0] = 10.0;
double t_start = 0.0 , t_end = 1.0 , dt = 0.1;
integrate( constant_system_functor_standard() , x , t_start , t_end , dt );
}
BOOST_AUTO_TEST_SUITE_END()
@@ -0,0 +1,69 @@
/*
[auto_generated]
integrate.cpp
[begin_description]
tba.
[end_description]
Copyright 2009-2012 Karsten Ahnert
Copyright 2009-2012 Mario Mulansky
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 <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(disable:4996)
#endif
#define BOOST_TEST_MODULE odeint_eigen_integrate
#include <boost/numeric/odeint/integrate/integrate.hpp>
#include <boost/numeric/odeint/external/eigen/eigen.hpp>
#include <boost/test/unit_test.hpp>
#include "dummy_odes.hpp"
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
BOOST_AUTO_TEST_SUITE( eigen_integrate )
BOOST_AUTO_TEST_CASE( test_const_sys )
{
typedef Eigen::Matrix< double , 1 , 1 > state_type;
state_type x;
x[0] = 10.0;
double t_start = 0.0 , t_end = 1.0 , dt = 0.1;
integrate< double >( constant_system_functor_standard() , x , t_start , t_end , dt );
BOOST_CHECK_CLOSE( x[0] , 11.0 , 1.0e-13 );
}
BOOST_AUTO_TEST_CASE( test_lorenz )
{
typedef Eigen::Matrix< double , 3 , 1 > state_type;
state_type x;
x[0] = 10.0;
x[1] = 10.0;
x[2] = 10.0;
double t_start = 0.0 , t_end = 1000.0 , dt = 0.1;
integrate< double >( lorenz() , x , t_start , t_end , dt );
std::vector< double > x2( 3 );
x2[0] = 10.0;
x2[1] = 10.0;
x2[2] = 10.0;
integrate( lorenz() , x2 , t_start , t_end , dt );
BOOST_CHECK_CLOSE( x[0] , x2[0] , 1.0e-13 );
BOOST_CHECK_CLOSE( x[1] , x2[1] , 1.0e-13 );
BOOST_CHECK_CLOSE( x[2] , x2[2] , 1.0e-13 );
}
BOOST_AUTO_TEST_SUITE_END()
@@ -0,0 +1,47 @@
/*
[auto_generated]
libs/numeric/odeint/test_external/eigen/is_resizeable.cpp
[begin_description]
tba.
[end_description]
Copyright 2013 Karsten Ahnert
Copyright 2013 Mario Mulansky
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 <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(disable:4996)
#endif
#define BOOST_TEST_MODULE odeint_eigen_is_resizeable
#include <boost/test/unit_test.hpp>
#include <boost/numeric/odeint/external/eigen/eigen_resize.hpp>
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
BOOST_AUTO_TEST_SUITE( is_resizeable )
BOOST_AUTO_TEST_CASE( test_compile_time_matrix )
{
typedef Eigen::Matrix< double , 1 , 1 > matrix_type;
BOOST_STATIC_ASSERT(( boost::numeric::odeint::is_resizeable< matrix_type >::value ));
}
BOOST_AUTO_TEST_CASE( test_compile_time_array )
{
typedef Eigen::Array< double , 1 , 1 > array_type;
BOOST_STATIC_ASSERT(( boost::numeric::odeint::is_resizeable< array_type >::value ));
}
BOOST_AUTO_TEST_SUITE_END()
@@ -0,0 +1,145 @@
/*
[auto_generated]
libs/numeric/odeint/test_external/eigen/resize.cpp
[begin_description]
tba.
[end_description]
Copyright 2013 Karsten Ahnert
Copyright 2013 Mario Mulansky
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 <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(disable:4996)
#endif
#define BOOST_TEST_MODULE odeint_eigen_resize
#include <boost/test/unit_test.hpp>
#include <boost/numeric/odeint/external/eigen/eigen_resize.hpp>
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
BOOST_AUTO_TEST_SUITE( eigen_resize )
BOOST_AUTO_TEST_CASE( test_compile_time_matrix )
{
typedef Eigen::Matrix< double , 1 , 1 > matrix_type;
matrix_type a , b;
boost::numeric::odeint::resize( a , b );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
BOOST_CHECK_EQUAL( a.rows() , 1 );
BOOST_CHECK_EQUAL( a.cols() , 1 );
}
BOOST_AUTO_TEST_CASE( test_rumtime_matrix )
{
typedef Eigen::Matrix< double , Eigen::Dynamic , Eigen::Dynamic > matrix_type;
matrix_type a( 5 , 2 ) , b;
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 0 );
BOOST_CHECK_EQUAL( b.cols() , 0 );
BOOST_CHECK( !boost::numeric::odeint::same_size( a , b ) );
boost::numeric::odeint::resize( b , a );
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 5 );
BOOST_CHECK_EQUAL( b.cols() , 2 );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( test_rumtime_matrix2 )
{
typedef Eigen::Matrix< double , Eigen::Dynamic , Eigen::Dynamic > matrix_type;
matrix_type a( 5 , 2 ) , b( 2 , 3 );
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 2 );
BOOST_CHECK_EQUAL( b.cols() , 3 );
BOOST_CHECK( !boost::numeric::odeint::same_size( a , b ) );
boost::numeric::odeint::resize( b , a );
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 5 );
BOOST_CHECK_EQUAL( b.cols() , 2 );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( test_compile_time_array )
{
typedef Eigen::Array< double , 1 , 1 > array_type;
array_type a , b;
boost::numeric::odeint::resize( a , b );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
BOOST_CHECK_EQUAL( a.rows() , 1 );
BOOST_CHECK_EQUAL( a.cols() , 1 );
}
BOOST_AUTO_TEST_CASE( test_rumtime_array )
{
typedef Eigen::Array< double , Eigen::Dynamic , Eigen::Dynamic > array_type;
array_type a( 5 , 2 ) , b;
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 0 );
BOOST_CHECK_EQUAL( b.cols() , 0 );
BOOST_CHECK( !boost::numeric::odeint::same_size( a , b ) );
boost::numeric::odeint::resize( b , a );
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 5 );
BOOST_CHECK_EQUAL( b.cols() , 2 );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( test_rumtime_array2 )
{
typedef Eigen::Array< double , Eigen::Dynamic , Eigen::Dynamic > array_type;
array_type a( 5 , 2 ) , b( 2 , 3 );
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 2 );
BOOST_CHECK_EQUAL( b.cols() , 3 );
BOOST_CHECK( !boost::numeric::odeint::same_size( a , b ) );
boost::numeric::odeint::resize( b , a );
BOOST_CHECK_EQUAL( a.rows() , 5 );
BOOST_CHECK_EQUAL( a.cols() , 2 );
BOOST_CHECK_EQUAL( b.rows() , 5 );
BOOST_CHECK_EQUAL( b.cols() , 2 );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_SUITE_END()
@@ -0,0 +1,94 @@
/*
[auto_generated]
libs/numeric/odeint/test_external/eigen/runge_kutta4.cpp
[begin_description]
tba.
[end_description]
Copyright 2013 Karsten Ahnert
Copyright 2013 Mario Mulansky
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 <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(disable:4996)
#endif
#define BOOST_TEST_MODULE odeint_eigen_runge_kutta4
#include <boost/test/unit_test.hpp>
#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
#include <boost/numeric/odeint/stepper/runge_kutta4.hpp>
#include <boost/numeric/odeint/external/eigen/eigen_resize.hpp>
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
struct sys
{
template< class State , class Deriv >
void operator()( const State &x , Deriv &dxdt , double t ) const
{
dxdt[0] = 1.0;
}
};
BOOST_AUTO_TEST_SUITE( eigen_runge_kutta4 )
BOOST_AUTO_TEST_CASE( compile_time_matrix )
{
typedef Eigen::Matrix< double , 1 , 1 > state_type;
state_type x;
x[0] = 10.0;
runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
rk4.do_step( sys() , x , 0.0 , 0.1 );
BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_CASE( runtime_matrix )
{
typedef Eigen::Matrix< double , Eigen::Dynamic , 1 > state_type;
state_type x( 1 );
x[0] = 10.0;
runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
rk4.do_step( sys() , x , 0.0 , 0.1 );
BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_CASE( compile_time_array )
{
typedef Eigen::Array< double , 1 , 1 > state_type;
state_type x;
x[0] = 10.0;
runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
rk4.do_step( sys() , x , 0.0 , 0.1 );
BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_CASE( runtime_array )
{
typedef Eigen::Array< double , Eigen::Dynamic , 1 > state_type;
state_type x( 1 );
x[0] = 10.0;
runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
rk4.do_step( sys() , x , 0.0 , 0.1 );
BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_SUITE_END()
@@ -0,0 +1,132 @@
/*
[auto_generated]
libs/numeric/odeint/test_external/eigen/runge_kutta_dopri5.cpp
[begin_description]
tba.
[end_description]
Copyright 2013 Karsten Ahnert
Copyright 2013 Mario Mulansky
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 <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(disable:4996)
#endif
#define BOOST_TEST_MODULE odeint_eigen_runge_kutta4
#include <boost/test/unit_test.hpp>
#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
#include <boost/numeric/odeint/stepper/runge_kutta4.hpp>
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp>
// #include <boost/numeric/odeint/external/eigen/eigen_resize.hpp>
#include <boost/numeric/odeint/external/eigen/eigen_algebra.hpp>
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
struct sys
{
template< class State , class Deriv >
void operator()( const State &x , Deriv &dxdt , double t ) const
{
dxdt[0] = 1.0;
}
};
template< class State >
struct stepper
{
typedef runge_kutta_dopri5< State , double , State , double , vector_space_algebra > type;
};
template< class State >
struct controlled_stepper
{
typedef controlled_runge_kutta< typename stepper< State >::type > type;
};
template< class State >
struct dense_output_stepper
{
typedef dense_output_runge_kutta< typename controlled_stepper< State >::type > type;
};
BOOST_AUTO_TEST_SUITE( eigen_runge_kutta_dopri5 )
BOOST_AUTO_TEST_CASE( compile_time_matrix )
{
typedef Eigen::Matrix< double , 1 , 1 > state_type;
state_type x;
x[0] = 10.0;
double t = 0.0 , dt = 0.1 ;
// dense_output_stepper< state_type >::type s;
// s.initialize( x , t , dt );
// controlled_stepper< state_type >::type s;
// s.try_step( sys() , x , t , dt );
stepper< state_type >::type s;
s.do_step( sys() , x , t , dt );
// runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
// rk4.do_step( sys() , x , 0.0 , 0.1 );
// BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_CASE( runtime_matrix )
{
typedef Eigen::Matrix< double , Eigen::Dynamic , 1 > state_type;
state_type x( 1 );
x[0] = 10.0;
// runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
// rk4.do_step( sys() , x , 0.0 , 0.1 );
// BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_CASE( compile_time_array )
{
typedef Eigen::Array< double , 1 , 1 > state_type;
state_type x;
x[0] = 10.0;
// runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
// rk4.do_step( sys() , x , 0.0 , 0.1 );
// BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_CASE( runtime_array )
{
typedef Eigen::Array< double , Eigen::Dynamic , 1 > state_type;
state_type x( 1 );
x[0] = 10.0;
// runge_kutta4< state_type , double , state_type , double , vector_space_algebra > rk4;
// rk4.do_step( sys() , x , 0.0 , 0.1 );
// BOOST_CHECK_CLOSE( x[0] , 10.1 , 1.0e-13 );
}
BOOST_AUTO_TEST_SUITE_END()
@@ -0,0 +1,83 @@
/*
[auto_generated]
libs/numeric/odeint/test_external/eigen/same_size.cpp
[begin_description]
tba.
[end_description]
Copyright 2013 Karsten Ahnert
Copyright 2013 Mario Mulansky
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 <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(disable:4996)
#endif
#define BOOST_TEST_MODULE odeint_eigen_same_size
#include <boost/test/unit_test.hpp>
#include <boost/numeric/odeint/external/eigen/eigen_resize.hpp>
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
BOOST_AUTO_TEST_SUITE( eigen_same_size )
BOOST_AUTO_TEST_CASE( compile_time_matrix )
{
typedef Eigen::Matrix< double , 1 , 1 > matrix_type;
matrix_type a , b;
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( runtime_matrix )
{
typedef Eigen::Matrix< double , Eigen::Dynamic , Eigen::Dynamic > matrix_type;
matrix_type a( 10 , 2 ) , b( 10 , 2 );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( fail_runtime_matrix )
{
typedef Eigen::Matrix< double , Eigen::Dynamic , Eigen::Dynamic > matrix_type;
matrix_type a( 11 , 2 ) , b( 10 , 2 );
BOOST_CHECK( !boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( compile_time_array )
{
typedef Eigen::Array< double , 1 , 1 > array_type;
array_type a , b;
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( runtime_array )
{
typedef Eigen::Array< double , Eigen::Dynamic , Eigen::Dynamic > array_type;
array_type a( 10 , 2 ) , b( 10 , 2 );
BOOST_CHECK( boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_CASE( fail_runtime_array )
{
typedef Eigen::Array< double , Eigen::Dynamic , Eigen::Dynamic > array_type;
array_type a( 11 , 2 ) , b( 10 , 2 );
BOOST_CHECK( !boost::numeric::odeint::same_size( a , b ) );
}
BOOST_AUTO_TEST_SUITE_END()