antioch-0.4.0
vexcl_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_VEXCL_UTILS_DECL_H
28 #define ANTIOCH_VEXCL_UTILS_DECL_H
29 
30 #ifdef ANTIOCH_METAPROGRAMMING_H
31 # error valarray_utils_decl.h must be included before metaprogramming.h
32 #endif
33 
34 // Antioch
36 
37 #include <type_traits> // std::enable_if
38 
39 #ifdef ANTIOCH_HAVE_VEXCL
40 // Though the following implementations are all valid without
41 // <vexcl/vexcl.hpp>, successfully using them with
42 // VexCL types requires VexCL to be included first.
43 // Configure-time VexCL support enforces this constraint but
44 // header-only VexCL may be mixed with header-only Antioch
45 // without configure-time flags.
46 #include "vexcl/vexcl.hpp"
47 #else
48 // Forward declaration instead
49 namespace vex {
50  template <typename T> class vector;
51  template <typename T> class vector_expression;
52  template <typename T> class is_vector_expression;
53 }
54 namespace boost {
55  namespace proto {
56  namespace result_of {
57  template <typename T1, typename T2, typename T3, typename T4, typename T5>
58  class make_expr;
59  }
60  namespace tag {
61  class if_else_;
62  }
63  class deduce_domain;
64  }
65 }
66 #endif
67 
68 
69 #ifdef VEXCL_OPERATIONS_HPP
70 namespace std {
71 template <typename T>
72 inline
73 ANTIOCH_AUTO(vex::vector<T>)
74 max(const vex::vector<T>& a,
75  const vex::vector<T>& b)
76 ANTIOCH_RETURNEXPR(vex::vector<T>, vex::max(a,b));
77 
78 template <typename T>
79 inline
80 ANTIOCH_AUTO(vex::vector<T>)
81 min(const vex::vector<T>& a,
82  const vex::vector<T>& b)
83 ANTIOCH_RETURNEXPR(vex::vector<T>, vex::min(a,b));
84 }
85 #endif
86 
87 
88 namespace Antioch
89 {
90 
91 // Class to allow tag dispatching to VexCL specializations
93 
94 template <typename T>
95 struct tag_type<T,
96  typename std::enable_if<vex::is_vector_expression<T>::value>::type
97  >
98 {
99  typedef const vexcl_library_tag type;
100 };
101 
102 template <typename T, typename NewScalar>
103 struct rebind<vex::vector<T>, NewScalar>
104 {
105  typedef vex::vector<NewScalar> type;
106 };
107 
108 template <typename T>
109 inline
110 T
111 max (const vex::vector<T>& in);
112 
113 template <typename T>
114 inline
115 T
116 min (const vex::vector<T>& in);
117 
118 template <typename T>
119 struct return_auto<vex::vector<T> >;
120 
121 template <typename T>
122 struct has_size<vex::vector<T> >;
123 
124 template <typename T>
125 struct size_type<vex::vector<T> >;
126 
127 template <typename T>
128 struct value_type<vex::vector<T> >;
129 
130 template <typename T>
131 struct raw_value_type<vex::vector<T> >;
132 
133 template <typename T>
134 inline
135 vex::vector<T>
136 zero_clone(const vex::vector<T>& example);
137 
138 template <typename T1, typename T2>
139 inline
140 void
141 zero_clone(vex::vector<T1>& output, const vex::vector<T2>& example);
142 
143 template <typename T, typename Scalar>
144 inline
145 vex::vector<T>
146 constant_clone(const vex::vector<T>& example, const Scalar& value);
147 
148 template <typename T>
149 inline
150 void
151 init_clone(vex::vector<T>& output, const vex::vector<T>& example);
152 
153 template <typename BoolInput, typename IfValue, typename ElseValue>
154 typename boost::proto::result_of::make_expr<
155  boost::proto::tag::if_else_,
156  boost::proto::deduce_domain,
157  const vex::vector_expression<BoolInput>&,
158  const IfValue&,
159  const ElseValue&
160 >::type const
161 if_else(const vex::vector_expression<BoolInput> &condition,
162  const IfValue &if_true,
163  const ElseValue &if_false);
164 
165 template <typename T>
166 inline
167 bool disjunction_root(const T & vec_input, vexcl_library_tag);
168 
169 template <typename T>
170 inline
171 bool conjunction_root(const T & vec_input, vexcl_library_tag);
172 
173 
174 template <typename VectorT, typename IntT>
175 inline
176 typename enable_if_c<
177  vex::is_vector_expression<typename value_type<VectorT>::type>::value &&
178  vex::is_vector_expression<IntT>::value,
179  typename value_type<VectorT>::type
180 >::type
181 eval_index(const VectorT& vec, const IntT& index);
182 
183 } // end namespace Antioch
184 
185 
186 #endif //ANTIOCH_VEXCL_UTILS_DECL_H
#define ANTIOCH_RETURNEXPR(Type, Expr)
bool conjunction_root(const T &vec, eigen_library_tag)
Definition: eigen_utils.h:278
bool disjunction_root(const T &vec, eigen_library_tag)
Definition: eigen_utils.h:285
void init_clone(T &output, const T &example)
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
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > constant_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
Definition: eigen_utils.h:181
max(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a, const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &b) ANTIOCH_AUTOFUNC(_Matrix< _Scalar ANTIOCH_COMMA _Rows ANTIOCH_COMMA _Cols ANTIOCH_COMMA _Options ANTIOCH_COMMA _MaxRows ANTIOCH_COMMA _MaxCols >
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.
typename _Scalar int _Rows int _Cols int _Options int _MaxRows int _MaxCols inline min(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a, const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &b) ANTIOCH_AUTOFUNC(_Matrix< _Scalar ANTIOCH_COMMA _Rows ANTIOCH_COMMA _Cols ANTIOCH_COMMA _Options ANTIOCH_COMMA _MaxRows ANTIOCH_COMMA _MaxCols >
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
#define ANTIOCH_AUTO(Type)

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