antioch-0.4.0
metaphysicl_utils_decl.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 
27 #ifndef ANTIOCH_METAPHYSICL_UTILS_DECL_H
28 #define ANTIOCH_METAPHYSICL_UTILS_DECL_H
29 
30 #ifdef ANTIOCH_METAPROGRAMMING_H
31 # error metaphysicl_utils_decl.h must be included before metaprogramming.h
32 #endif
33 
34 #include "antioch_config.h"
35 #include "metaprogramming_decl.h"
36 
37 #include <cstddef> // std::size_t
38 
39 #ifdef ANTIOCH_HAVE_METAPHYSICL
40 // Though the following implementations are all valid without
41 // <metaphysicl/numberarray.h>, successfully using them with
42 // MetaPhysicL types requires MetaPhysicL to be included first.
43 // Configure-time MetaPhysicL support enforces this constraint but
44 // header-only MetaPhysicL may be mixed with header-only Antioch
45 // without configure-time flags.
46 #include "metaphysicl/numberarray.h"
47 #else
48 // Forward declaration instead
49 namespace MetaPhysicL {
50 template <std::size_t size, typename T> class NumberArray;
51 }
52 #endif
53 
55 
56 // Specializations to match other Antioch workarounds
57 
58 namespace Antioch
59 {
60 
61 template <typename T>
63  static const bool value = false;
64 };
65 
66 template <std::size_t size, typename T>
67 struct is_metaphysicl<MetaPhysicL::NumberArray<size,T> > {
68  static const bool value = true;
69 };
70 
71 // Class to allow tag dispatching to MetaPhysicL specializations
73 
74 // MetaPhysicL has no expression templates yet; all types store state
75 template <typename T>
76 struct state_type<T, typename enable_if_c<is_metaphysicl<T>::value,void>::type> {
77  typedef T type;
78 };
79 
80 template <std::size_t size, typename T, typename NewScalar>
81 struct rebind<MetaPhysicL::NumberArray<size,T>, NewScalar>
82 {
83  typedef MetaPhysicL::NumberArray<size,NewScalar> type;
84 };
85 
86 template <typename T>
87 inline
88 typename Antioch::enable_if_c<
90  typename value_type<T>::type>::type
91 max (const T& in);
92 
93 template <typename T>
94 inline
95 typename Antioch::enable_if_c<
96  is_metaphysicl<T>::value,
97  typename value_type<T>::type>::type
98 min (const T& in);
99 
100 template <typename T>
101 struct has_size<T, typename Antioch::enable_if_c<is_metaphysicl<T>::value,void>::type>;
102 
103 template <typename T>
104 struct return_auto<T, typename Antioch::enable_if_c<is_metaphysicl<T>::value,void>::type>;
105 
106 template <typename T>
107 struct size_type<T, typename Antioch::enable_if_c<is_metaphysicl<T>::value,void>::type>;
108 
109 template <typename T>
110 struct value_type<T, typename Antioch::enable_if_c<is_metaphysicl<T>::value,void>::type>;
111 
112 template <typename T>
113 struct raw_value_type<T, typename Antioch::enable_if_c<is_metaphysicl<T>::value,void>::type>;
114 
115 template <typename Tbool, typename Ttrue, typename Tfalse>
116 inline
117 typename Antioch::enable_if_c<
118  is_metaphysicl<Tbool>::value &&
119  is_metaphysicl<Ttrue>::value &&
120  is_metaphysicl<Tfalse>::value,
121  typename state_type<Ttrue>::type>::type
122 if_else(const Tbool& condition,
123  const Ttrue& if_true,
124  const Tfalse& if_false);
125 
126 template <typename VectorT, typename UIntType>
127 inline
128 typename Antioch::enable_if_c<
129  is_metaphysicl<typename Antioch::value_type<VectorT>::type>::value &&
130  is_metaphysicl<UIntType>::value,
131  typename Antioch::value_type<VectorT>::type
132 >::type
133 eval_index(const VectorT & vec, const UIntType & indexes);
134 } // end namespace Antioch
135 
136 #endif // ANTIOCH_METAPHYSICL_UTILS_DECL_H
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
Definition: eigen_utils.h:98
enable_if_c< is_eigen< typename value_type< VectorT >::type >::value, typename value_type< VectorT >::type >::type eval_index(const VectorT &vec, const _Matrix< _UIntT, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &index)
Definition: eigen_utils.h:268
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
The parameters are reduced parameters.

Generated on Thu Jul 7 2016 11:09:46 for antioch-0.4.0 by  doxygen 1.8.8