std_array.cpp 1.5 KB

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