• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  [auto_generated]
3  libs/numeric/odeint/test/prepare_stepper_testing.hpp
4 
5  [begin_description]
6  This file defines some helper functions for the stepper tests.
7  [end_description]
8 
9  Copyright 2011-2012 Karsten Ahnert
10  Copyright 2012-2013 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 #ifndef PREPARE_STEPPER_TESTING_HPP_
18 #define PREPARE_STEPPER_TESTING_HPP_
19 
20 #include <boost/array.hpp>
21 #include <vector>
22 #include <complex>
23 
24 #include <boost/fusion/sequence.hpp>
25 #include <boost/mpl/vector.hpp>
26 #include <boost/multiprecision/cpp_dec_float.hpp>
27 
28 #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
29 #include <boost/numeric/odeint/algebra/array_algebra.hpp>
30 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
31 
32 namespace mpl = boost::mpl;
33 namespace fusion = boost::fusion;
34 
35 using namespace boost::numeric::odeint;
36 
37 /* the state types that will be tested */
38 typedef std::vector< double > vector_type;
39 typedef std::vector< std::complex<double> > complex_vector_type;
40 typedef double vector_space_type;
41 typedef boost::array< double , 1 > array_type;
42 typedef boost::array< std::complex<double> , 1 > complex_array_type;
43 
44 typedef boost::multiprecision::cpp_dec_float_50 mp_type;
45 typedef boost::array< mp_type , 1 > mp_array_type;
46 
47 typedef mpl::vector< vector_type , complex_vector_type , vector_space_type ,
48                      array_type , complex_array_type , mp_type , mp_array_type
49                      >::type container_types;
50 
51 namespace boost { namespace numeric { namespace odeint {
52 
53     // mp_type forms a vector space
54     template<>
55     struct algebra_dispatcher< mp_type >
56     {
57         typedef vector_space_algebra algebra_type;
58     };
59 
60     // add norm computation
61     template<>
62     struct vector_space_norm_inf< mp_type >
63     {
64         typedef mp_type result_type;
operator ()boost::numeric::odeint::vector_space_norm_inf65         mp_type operator()( mp_type x ) const
66         {
67             using std::abs;
68             return abs(x);
69         }
70     };
71 
72 } } }
73 
74 #endif /* PREPARE_STEPPER_TESTING_HPP_ */
75