1 /*
2  [auto_generated]
3  boost/numeric/odeint/algebra/algebra_dispatcher.hpp
4 
5  [begin_description]
6  Algebra dispatcher to automatically chose suitable algebra.
7  [end_description]
8 
9  Copyright 2013 Karsten Ahnert
10  Copyright 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 BOOST_NUMERIC_ODEINT_ALGEBRA_ALGEBRA_DISPATCHER_HPP_INCLUDED
18 #define BOOST_NUMERIC_ODEINT_ALGEBRA_ALGEBRA_DISPATCHER_HPP_INCLUDED
19 
20 #include <boost/numeric/odeint/config.hpp>
21 
22 #include <complex>
23 #include <boost/type_traits/is_floating_point.hpp>
24 
25 #include <boost/numeric/ublas/vector.hpp>
26 #include <boost/numeric/ublas/matrix.hpp>
27 
28 #include <boost/numeric/odeint/algebra/range_algebra.hpp>
29 #include <boost/numeric/odeint/algebra/array_algebra.hpp>
30 #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
31 
32 #include <boost/array.hpp>
33 
34 
35 namespace boost {
36 namespace numeric {
37 namespace odeint {
38 
39 template< class StateType , class Enabler = void >
40 struct algebra_dispatcher_sfinae
41 {
42     // range_algebra is the standard algebra
43     typedef range_algebra algebra_type;
44 };
45 
46 template< class StateType >
47 struct algebra_dispatcher : algebra_dispatcher_sfinae< StateType > { };
48 
49 // specialize for array
50 template< class T , size_t N >
51 struct algebra_dispatcher< boost::array< T , N > >
52 {
53     typedef array_algebra algebra_type;
54 };
55 
56 //specialize for some integral types
57 template< typename T >
58 struct algebra_dispatcher_sfinae< T , typename boost::enable_if< typename boost::is_floating_point< T >::type >::type >
59 {
60     typedef vector_space_algebra algebra_type;
61 };
62 
63 template< typename T >
64 struct algebra_dispatcher< std::complex<T> >
65 {
66     typedef vector_space_algebra algebra_type;
67 };
68 
69 ///* think about that again....
70 // specialize for ublas vector and matrix types
71 template< class T , class A >
72 struct algebra_dispatcher< boost::numeric::ublas::vector< T , A > >
73 {
74     typedef vector_space_algebra algebra_type;
75 };
76 
77 template< class T , class L , class A >
78 struct algebra_dispatcher< boost::numeric::ublas::matrix< T , L , A > >
79 {
80     typedef vector_space_algebra algebra_type;
81 };
82 //*/
83 
84 }
85 }
86 }
87 
88 #ifdef BOOST_NUMERIC_ODEINT_CXX11
89 
90 // c++11 mode: specialization for std::array if available
91 
92 #include <array>
93 
94 namespace boost {
95 namespace numeric {
96 namespace odeint {
97 
98 // specialize for std::array
99 template< class T , size_t N >
100 struct algebra_dispatcher< std::array< T , N > >
101 {
102     typedef array_algebra algebra_type;
103 };
104 
105 } } }
106 
107 #endif
108 
109 
110 #endif
111