• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  [auto_generated]
3  test/std_array.cpp
4 
5  [begin_description]
6  Checks if odeint compiles fine with the std::array using the array algebra
7  [end_description]
8 
9  Copyright 2009-2014 Karsten Ahnert
10  Copyright 2009-2014 Mario Mulansky
11 
12  Distributed under the Boost Software License, Version 1.0.
13  (See accompanying file LICENSE_1_0.txt or
14  copy at http://www.boost.org/LICENSE_1_0.txt)
15  */
16 
17 
18 #define BOOST_TEST_MODULE odeint_std_array
19 
20 #include <array>
21 #include <boost/numeric/odeint.hpp>
22 #include <boost/static_assert.hpp>
23 #include <boost/type_traits/is_same.hpp>
24 #include <boost/test/unit_test.hpp>
25 
26 using namespace boost::unit_test;
27 
28 typedef std::array<double, 3> state_type;
29 
rhs(const state_type & x,state_type & dxdt,const double t)30 void rhs(const state_type &x, state_type &dxdt, const double t)
31 {
32 }
33 
34 BOOST_AUTO_TEST_SUITE( unwrap_reference_test )
35 
BOOST_AUTO_TEST_CASE(test_case)36 BOOST_AUTO_TEST_CASE( test_case )
37 {
38     state_type x = {0.0, 0.0, 0.0};
39 
40     typedef boost::numeric::odeint::runge_kutta4<state_type> stepper_type;
41 // check if array algebra is selected, but only if odeint detects c++11
42 #ifdef BOOST_NUMERIC_ODEINT_CXX11
43     BOOST_STATIC_ASSERT(( boost::is_same< stepper_type::algebra_type ,
44                           boost::numeric::odeint::array_algebra >::value ));
45 #endif
46     stepper_type stepper1;
47     stepper1.do_step(rhs, x, 0.0, 0.1);
48 
49     boost::numeric::odeint::runge_kutta4<
50         state_type, double, state_type, double,
51         boost::numeric::odeint::array_algebra > stepper;
52     stepper.do_step(rhs, x, 0.0, 0.1);
53 
54 }
55 
56 
57 BOOST_AUTO_TEST_SUITE_END()
58