1/*
2
3 [begin_description]
4 Test case for issue 149:
5 Error C2582 with msvc-10 when using iterator-based integration
6 [end_description]
7
8 Copyright 2011-2015 Karsten Ahnert
9 Copyright 2011-2015 Mario Mulansky
10
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)
14 */
15
16
17// disable checked iterator warning for msvc
18
19#include <boost/config.hpp>
20#ifdef BOOST_MSVC
21 #pragma warning(disable:4996)
22#endif
23
24#define BOOST_TEST_MODULE odeint_regression_147
25
26#include <utility>
27#include <iostream>
28
29#include <boost/test/unit_test.hpp>
30
31#include <boost/mpl/vector.hpp>
32#include <boost/range/algorithm/find_if.hpp>
33
34#include <boost/numeric/odeint.hpp>
35
36using namespace boost::unit_test;
37using namespace boost::numeric::odeint;
38namespace mpl = boost::mpl;
39
40typedef std::vector<double> state_type;
41
42void rhs( const state_type &x , state_type &dxdt , const double t )
43{
44}
45
46
47template<class Stepper>
48struct perform_test
49{
50 void operator()( void )
51 {
52 bulirsch_stoer< state_type > stepper( 1e-9, 0.0, 0.0, 0.0 );
53 state_type x( 3, 10.0 );
54
55 auto iter = boost::find_if(
56 make_adaptive_time_range( stepper, system: rhs, x, t_start: 0.0, t_end: 1.0, dt: 0.01 ),
57 []( const std::pair< const state_type &, double > &x )
58 { return ( x.first[0] < 0.0 ); } );
59
60 std::cout << iter->second << "\t" << iter->first[0] << "\t"
61 << iter->first[1] << "\t" << iter->first[2] << "\n";
62 }
63};
64
65typedef mpl::vector<
66 euler< state_type > ,
67 runge_kutta4< state_type > ,
68 runge_kutta_cash_karp54< state_type > ,
69 runge_kutta_dopri5< state_type > ,
70 runge_kutta_fehlberg78< state_type > ,
71 bulirsch_stoer< state_type >
72 > steppers;
73
74
75BOOST_AUTO_TEST_SUITE( regression_147_test )
76
77BOOST_AUTO_TEST_CASE_TEMPLATE( regression_147_test , Stepper,
78 steppers )
79{
80 perform_test< Stepper > tester;
81 tester();
82}
83
84BOOST_AUTO_TEST_SUITE_END()
85

source code of boost/libs/numeric/odeint/test/regression/regression_149.cpp