]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Also convert the is_not_parallel_vector trait.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 1 Feb 2022 17:58:33 +0000 (10:58 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 1 Feb 2022 17:58:33 +0000 (10:58 -0700)
include/deal.II/matrix_free/matrix_free.h
include/deal.II/matrix_free/type_traits.h

index 8f41bb7fe806dfe403e615f769b7993fbd5802f6..c51f2c190104e5578a5be3ab94583701adfa289a 100644 (file)
@@ -3359,7 +3359,7 @@ namespace internal
      * Start update_ghost_value for serial vectors
      */
     template <typename VectorType,
-              typename std::enable_if<is_not_parallel_vector<VectorType>::value,
+              typename std::enable_if<is_not_parallel_vector<VectorType>,
                                       VectorType>::type * = nullptr>
     void
     update_ghost_values_start(const unsigned int /*component_in_block_vector*/,
@@ -3374,7 +3374,7 @@ namespace internal
     template <
       typename VectorType,
       typename std::enable_if<!has_update_ghost_values_start<VectorType> &&
-                                !is_not_parallel_vector<VectorType>::value,
+                                !is_not_parallel_vector<VectorType>,
                               VectorType>::type * = nullptr>
     void
     update_ghost_values_start(const unsigned int component_in_block_vector,
@@ -3580,7 +3580,7 @@ namespace internal
      * Start compress for serial vectors
      */
     template <typename VectorType,
-              typename std::enable_if<is_not_parallel_vector<VectorType>::value,
+              typename std::enable_if<is_not_parallel_vector<VectorType>,
                                       VectorType>::type * = nullptr>
     void
     compress_start(const unsigned int /*component_in_block_vector*/,
@@ -3593,11 +3593,10 @@ namespace internal
      * Start compress for vectors that do not support
      * the split into _start() and finish() stages
      */
-    template <
-      typename VectorType,
-      typename std::enable_if<!has_compress_start<VectorType> &&
-                                !is_not_parallel_vector<VectorType>::value,
-                              VectorType>::type * = nullptr>
+    template <typename VectorType,
+              typename std::enable_if<!has_compress_start<VectorType> &&
+                                        !is_not_parallel_vector<VectorType>,
+                                      VectorType>::type * = nullptr>
     void
     compress_start(const unsigned int component_in_block_vector,
                    VectorType &       vec)
@@ -3780,7 +3779,7 @@ namespace internal
      * Reset all ghost values for serial vectors
      */
     template <typename VectorType,
-              typename std::enable_if<is_not_parallel_vector<VectorType>::value,
+              typename std::enable_if<is_not_parallel_vector<VectorType>,
                                       VectorType>::type * = nullptr>
     void
     reset_ghost_values(const VectorType & /*vec*/) const
@@ -3792,11 +3791,10 @@ namespace internal
      * Reset all ghost values for vector that don't support
      * exchange on a subset of DoFs
      */
-    template <
-      typename VectorType,
-      typename std::enable_if<!has_exchange_on_subset<VectorType> &&
-                                !is_not_parallel_vector<VectorType>::value,
-                              VectorType>::type * = nullptr>
+    template <typename VectorType,
+              typename std::enable_if<!has_exchange_on_subset<VectorType> &&
+                                        !is_not_parallel_vector<VectorType>,
+                                      VectorType>::type * = nullptr>
     void
     reset_ghost_values(const VectorType &vec) const
     {
index f4c312f3c20c5ff1fbc258548e91f291429be9e2..e898d3381b0ce5fa1fab9d47ed10b3310acb8b7a 100644 (file)
@@ -189,9 +189,31 @@ namespace internal
   using not_parallel_vector_t =
     std::integral_constant<bool, is_serial_vector<T>::value>;
 
-  template <class T>
-  using is_not_parallel_vector =
-    SupportsOperation::detected_or_t<std::true_type, not_parallel_vector_t, T>;
+  /**
+   * A predicate stating whether something is a vector type. We test this
+   * by seeing whether the `is_serial_vector` type is declared for the
+   * given vector type.
+   */
+  template <class VectorType>
+  using is_vector_type = decltype(is_serial_vector<VectorType>::value);
+
+  /**
+   * A predicate stating whether something is a vector type and is
+   * indeed a serial vector.
+   */
+  template <class VectorType>
+  using is_serial_vector_type = decltype(
+    typename std::enable_if<is_serial_vector<VectorType>::value, int>::type());
+
+  /**
+   * A variable that indicates that the type `T` is either (i) not
+   * a vector type at all, or (ii) if it is a vector type,
+   * that it is not a parallel vector type.
+   */
+  template <class VectorType>
+  constexpr bool is_not_parallel_vector =
+    (is_supported_operation<is_vector_type, VectorType> == false) ||
+    (is_supported_operation<is_serial_vector_type, VectorType> == true);
 } // namespace internal
 #endif
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.