17 #ifndef dealii_matrix_free_type_traits_h
18 #define dealii_matrix_free_type_traits_h
22 #include <deal.II/base/config.h>
24 #include <deal.II/base/partitioner.h>
26 #include <deal.II/lac/vector_type_traits.h>
29 DEAL_II_NAMESPACE_OPEN
41 struct has_local_element
54 static decltype(std::declval<U const>().local_element(0))
61 static const
bool value =
62 !std::is_same<
void, decltype(detect(std::declval<T>()))>::value;
67 const
bool has_local_element<T>::value;
74 struct has_add_local_element
82 std::declval<U>().add_local_element(0,
typename T::value_type()))
86 static const
bool value =
87 !std::is_same<
int, decltype(detect(std::declval<T>()))>::value;
92 const
bool has_add_local_element<T>::value;
99 struct has_set_local_element
105 template <
typename U>
107 std::declval<U>().set_local_element(0,
typename T::value_type()))
111 static const
bool value =
112 !std::is_same<
int, decltype(detect(std::declval<T>()))>::value;
116 template <typename T>
117 const
bool has_set_local_element<T>::value;
124 template <typename T>
125 struct has_partitioners_are_compatible
131 template <
typename U>
132 static decltype(std::declval<U const>().partitioners_are_compatible(
133 std::declval<Utilities::MPI::Partitioner>()))
137 static const
bool value =
138 std::is_same<
bool, decltype(detect(std::declval<T>()))>::value;
142 template <typename T>
143 const
bool has_partitioners_are_compatible<T>::value;
148 template <typename T>
155 template <
typename U>
156 static decltype(std::declval<U const>().begin())
160 static const
bool value =
161 !std::is_same<
void, decltype(detect(std::declval<T>()))>::value;
165 template <typename T>
166 const
bool has_begin<T>::value;
174 template <typename T, typename Number>
175 struct is_vectorizable
177 static const bool value =
178 has_begin<T>::value &&
180 std::is_same<typename T::value_type, Number>::value;
184 template <
typename T,
typename Number>
185 const bool is_vectorizable<T, Number>::value;
199 template <
typename T>
200 struct has_update_ghost_values_start
206 template <
typename U>
207 static decltype(std::declval<U const>().update_ghost_values_start(0))
211 static const
bool value =
212 !std::is_same<
bool, decltype(detect(std::declval<T>()))>::value;
216 template <typename T>
217 const
bool has_update_ghost_values_start<T>::value;
223 template <typename T>
224 struct has_compress_start
230 template <
typename U>
235 static const bool value =
236 !std::is_same<bool, decltype(detect(std::declval<T>()))>::value;
240 template <
typename T>
241 const bool has_compress_start<T>::value;
249 template <
typename T>
250 struct has_exchange_on_subset
252 static const bool value =
253 has_begin<T>::value && has_local_element<T>::value;
257 template <
typename T>
258 const bool has_exchange_on_subset<T>::value;
264 template <
typename T>
265 struct has_communication_block_size
271 template <
typename U>
272 static decltype(U::communication_block_size)
276 static const bool value =
277 !std::is_same<void, decltype(detect(std::declval<T>()))>::value;
281 template <
typename T>
282 const bool has_communication_block_size<T>::value;
292 template <
typename T>
293 struct is_serial_or_dummy
303 typename std::enable_if<is_serial_vector<U>::value, U>::type * =
nullptr>
310 typename std::enable_if<!is_serial_vector<U>::value, U>::type * =
nullptr>
315 static const bool value =
316 std::is_same<void, decltype(detect(std::declval<T>()))>::value;
320 template <
typename T>
321 const bool is_serial_or_dummy<T>::value;
326 DEAL_II_NAMESPACE_CLOSE