]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/odeint/test/regression/regression_168.cpp
4 Test case for issue 149:
5 Error C2582 with msvc-10 when using iterator-based integration
8 Copyright 2011-2015 Karsten Ahnert
9 Copyright 2011-2015 Mario Mulansky
11 Distributed under the Boost Software License, Version 1.0.
12 (See accompanying file LICENSE_1_0.txt or
13 copy at http://www.boost.org/LICENSE_1_0.txt)
17 // disable checked iterator warning for msvc
19 #include <boost/config.hpp>
21 #pragma warning(disable:4996)
24 #define BOOST_TEST_MODULE odeint_regression_147
29 #include <boost/array.hpp>
31 #include <boost/test/unit_test.hpp>
33 #include <boost/mpl/vector.hpp>
34 #include <boost/range/algorithm/find_if.hpp>
36 #include <boost/numeric/odeint.hpp>
37 #include <boost/numeric/odeint/algebra/fusion_algebra.hpp>
38 #include <boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp>
41 #include <boost/units/systems/si/length.hpp>
42 #include <boost/units/systems/si/time.hpp>
43 #include <boost/units/systems/si/velocity.hpp>
44 #include <boost/units/systems/si/acceleration.hpp>
45 #include <boost/units/systems/si/io.hpp>
47 #include <boost/fusion/container.hpp>
50 using namespace boost::unit_test
;
51 using namespace boost::numeric::odeint
;
52 namespace mpl
= boost::mpl
;
54 namespace fusion
= boost::fusion
;
55 namespace units
= boost::units
;
56 namespace si
= boost::units::si
;
58 typedef units::quantity
< si::time
, double > time_type
;
59 typedef units::quantity
< si::length
, double > length_type
;
60 typedef units::quantity
< si::velocity
, double > velocity_type
;
61 typedef units::quantity
< si::acceleration
, double > acceleration_type
;
62 typedef units::quantity
< si::frequency
, double > frequency_type
;
64 typedef fusion::vector
< length_type
, velocity_type
> state_type
;
65 typedef fusion::vector
< velocity_type
, acceleration_type
> deriv_type
;
70 frequency_type m_omega
;
72 oscillator( const frequency_type
&omega
= 1.0 * si::hertz
) : m_omega( omega
) { }
74 void operator()( const state_type
&x
, deriv_type
&dxdt
, time_type t
) const
76 fusion::at_c
< 0 >( dxdt
) = fusion::at_c
< 1 >( x
);
77 fusion::at_c
< 1 >( dxdt
) = - m_omega
* m_omega
* fusion::at_c
< 0 >( x
);
82 BOOST_AUTO_TEST_CASE( regression_168
)
84 typedef runge_kutta_dopri5
< state_type
, double , deriv_type
, time_type
> stepper_type
;
86 state_type
x( 1.0 * si::meter
, 0.0 * si::meter_per_second
);
88 integrate_const( make_dense_output( 1.0e-6 , 1.0e-6 , stepper_type() ) , oscillator( 2.0 * si::hertz
) ,
89 x
, 0.0 * si::second
, 100.0 * si::second
, 0.1 * si::second
);