mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-13 11:18:42 -04:00
Squashed 'boost/' content from commit b4feb19f2
git-subtree-dir: boost git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# Copyright 2012 Karsten Ahnert
|
||||
# Copyright 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)
|
||||
|
||||
# bring in rules for testing
|
||||
|
||||
|
||||
import testing ;
|
||||
|
||||
use-project boost : $(BOOST_ROOT) ;
|
||||
|
||||
project
|
||||
: requirements
|
||||
<library>/boost/test//boost_unit_test_framework
|
||||
<define>BOOST_ALL_NO_LIB=1
|
||||
<include>../../include
|
||||
<link>static
|
||||
<toolset>clang:<cxxflags>-Wno-unused-variable
|
||||
|
||||
# <cxxflags>-D_SCL_SECURE_NO_WARNINGS
|
||||
;
|
||||
|
||||
test-suite "odeint"
|
||||
:
|
||||
[ run regression_147.cpp ]
|
||||
[ compile regression_149.cpp : <cxxflags>-std=c++0x ]
|
||||
[ run regression_168.cpp ]
|
||||
: <testing.launcher>valgrind
|
||||
;
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
|
||||
[begin_description]
|
||||
Test case for issue 147
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2015 Karsten Ahnert
|
||||
Copyright 2011-2015 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)
|
||||
*/
|
||||
|
||||
|
||||
// disable checked iterator warning for msvc
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#define BOOST_TEST_MODULE odeint_regression_147
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
#include <boost/numeric/odeint.hpp>
|
||||
|
||||
using namespace boost::unit_test;
|
||||
using namespace boost::numeric::odeint;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
typedef double state_type;
|
||||
|
||||
void rhs( const state_type &x , state_type &dxdt , const double t )
|
||||
{
|
||||
dxdt = 1;
|
||||
}
|
||||
|
||||
|
||||
template<class Stepper, class InitStepper>
|
||||
struct perform_init_test
|
||||
{
|
||||
void operator()( void )
|
||||
{
|
||||
double t = 0;
|
||||
const double dt = 0.1;
|
||||
|
||||
state_type x = 0;
|
||||
|
||||
Stepper stepper;
|
||||
InitStepper init_stepper;
|
||||
stepper.initialize( init_stepper, rhs, x, t, dt );
|
||||
|
||||
// ab-stepper needs order-1 init steps: t and x should be (order-1)*dt
|
||||
BOOST_CHECK_CLOSE( t , (stepper.order()-1)*dt , 1E-16 );
|
||||
BOOST_CHECK_CLOSE( x, ( stepper.order() - 1 ) * dt, 2E-14 );
|
||||
}
|
||||
};
|
||||
|
||||
typedef mpl::vector<
|
||||
euler< state_type > ,
|
||||
modified_midpoint< state_type > ,
|
||||
runge_kutta4< state_type > ,
|
||||
runge_kutta4_classic< state_type > ,
|
||||
runge_kutta_cash_karp54_classic< state_type > ,
|
||||
runge_kutta_cash_karp54< state_type > ,
|
||||
runge_kutta_dopri5< state_type > ,
|
||||
runge_kutta_fehlberg78< state_type >
|
||||
> runge_kutta_steppers;
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE( regression_147_test )
|
||||
|
||||
BOOST_AUTO_TEST_CASE_TEMPLATE( init_test , InitStepper,
|
||||
runge_kutta_steppers )
|
||||
{
|
||||
perform_init_test< adams_bashforth<4, state_type>, InitStepper > tester;
|
||||
tester();
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
|
||||
[begin_description]
|
||||
Test case for issue 149:
|
||||
Error C2582 with msvc-10 when using iterator-based integration
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2015 Karsten Ahnert
|
||||
Copyright 2011-2015 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)
|
||||
*/
|
||||
|
||||
|
||||
// disable checked iterator warning for msvc
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#define BOOST_TEST_MODULE odeint_regression_147
|
||||
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/range/algorithm/find_if.hpp>
|
||||
|
||||
#include <boost/numeric/odeint.hpp>
|
||||
|
||||
using namespace boost::unit_test;
|
||||
using namespace boost::numeric::odeint;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
typedef std::vector<double> state_type;
|
||||
|
||||
void rhs( const state_type &x , state_type &dxdt , const double t )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
template<class Stepper>
|
||||
struct perform_test
|
||||
{
|
||||
void operator()( void )
|
||||
{
|
||||
bulirsch_stoer< state_type > stepper( 1e-9, 0.0, 0.0, 0.0 );
|
||||
state_type x( 3, 10.0 );
|
||||
|
||||
auto iter = boost::find_if(
|
||||
make_adaptive_time_range( stepper, rhs, x, 0.0, 1.0, 0.01 ),
|
||||
[]( const std::pair< const state_type &, double > &x )
|
||||
{ return ( x.first[0] < 0.0 ); } );
|
||||
|
||||
std::cout << iter->second << "\t" << iter->first[0] << "\t"
|
||||
<< iter->first[1] << "\t" << iter->first[2] << "\n";
|
||||
}
|
||||
};
|
||||
|
||||
typedef mpl::vector<
|
||||
euler< state_type > ,
|
||||
runge_kutta4< state_type > ,
|
||||
runge_kutta_cash_karp54< state_type > ,
|
||||
runge_kutta_dopri5< state_type > ,
|
||||
runge_kutta_fehlberg78< state_type > ,
|
||||
bulirsch_stoer< state_type >
|
||||
> steppers;
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE( regression_147_test )
|
||||
|
||||
BOOST_AUTO_TEST_CASE_TEMPLATE( regression_147_test , Stepper,
|
||||
steppers )
|
||||
{
|
||||
perform_test< Stepper > tester;
|
||||
tester();
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
|
||||
[begin_description]
|
||||
Test case for issue 149:
|
||||
Error C2582 with msvc-10 when using iterator-based integration
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2015 Karsten Ahnert
|
||||
Copyright 2011-2015 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)
|
||||
*/
|
||||
|
||||
|
||||
// disable checked iterator warning for msvc
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#define BOOST_TEST_MODULE odeint_regression_147
|
||||
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/range/algorithm/find_if.hpp>
|
||||
|
||||
#include <boost/numeric/odeint.hpp>
|
||||
#include <boost/numeric/odeint/algebra/fusion_algebra.hpp>
|
||||
#include <boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp>
|
||||
|
||||
|
||||
#include <boost/units/systems/si/length.hpp>
|
||||
#include <boost/units/systems/si/time.hpp>
|
||||
#include <boost/units/systems/si/velocity.hpp>
|
||||
#include <boost/units/systems/si/acceleration.hpp>
|
||||
#include <boost/units/systems/si/io.hpp>
|
||||
|
||||
#include <boost/fusion/container.hpp>
|
||||
|
||||
|
||||
using namespace boost::unit_test;
|
||||
using namespace boost::numeric::odeint;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace units = boost::units;
|
||||
namespace si = boost::units::si;
|
||||
|
||||
typedef units::quantity< si::time , double > time_type;
|
||||
typedef units::quantity< si::length , double > length_type;
|
||||
typedef units::quantity< si::velocity , double > velocity_type;
|
||||
typedef units::quantity< si::acceleration , double > acceleration_type;
|
||||
typedef units::quantity< si::frequency , double > frequency_type;
|
||||
|
||||
typedef fusion::vector< length_type , velocity_type > state_type;
|
||||
typedef fusion::vector< velocity_type , acceleration_type > deriv_type;
|
||||
|
||||
|
||||
struct oscillator
|
||||
{
|
||||
frequency_type m_omega;
|
||||
|
||||
oscillator( const frequency_type &omega = 1.0 * si::hertz ) : m_omega( omega ) { }
|
||||
|
||||
void operator()( const state_type &x , deriv_type &dxdt , time_type t ) const
|
||||
{
|
||||
fusion::at_c< 0 >( dxdt ) = fusion::at_c< 1 >( x );
|
||||
fusion::at_c< 1 >( dxdt ) = - m_omega * m_omega * fusion::at_c< 0 >( x );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( regression_168 )
|
||||
{
|
||||
typedef runge_kutta_dopri5< state_type , double , deriv_type , time_type > stepper_type;
|
||||
|
||||
state_type x( 1.0 * si::meter , 0.0 * si::meter_per_second );
|
||||
|
||||
integrate_const( make_dense_output( 1.0e-6 , 1.0e-6 , stepper_type() ) , oscillator( 2.0 * si::hertz ) ,
|
||||
x , 0.0 * si::second , 100.0 * si::second , 0.1 * si::second);
|
||||
}
|
||||
Reference in New Issue
Block a user