]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce concepts that matrix template arguments have to satisfy. 16996/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 10 May 2024 06:21:12 +0000 (11:51 +0530)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 10 May 2024 06:21:12 +0000 (11:51 +0530)
include/deal.II/base/template_constraints.h

index 85cfd4b660caedf8138cc0244348b8642a3afdb4..16b713c0b4e6bfa96f60d7aab71e57629cb911d2 100644 (file)
@@ -1053,6 +1053,36 @@ namespace concepts
     } -> std::same_as<bool>;
   };
 
+
+  /**
+   * A concept that tests whether objects of type `MatrixType` can act
+   * as linear operators on `VectorType`. In practice, that means that
+   * `MatrixType` must have a `vmult()` member function that can take
+   * a `VectorType` object as input and produce another `VectorType`
+   * as output (both objects being taken as arguments to the `vmult()`
+   * function).
+   */
+  template <typename MatrixType, typename VectorType>
+  concept is_linear_operator_on =
+    requires(const MatrixType &A, VectorType &dst, const VectorType &src) {
+      A.vmult(dst, src);
+    };
+
+
+  /**
+   * A concept that tests whether objects of type `MatrixType` can act
+   * as the transposes of linear operators on `VectorType`. In practice, that
+   * means that `MatrixType` must have a `Tvmult()` member function that can
+   * take a `VectorType` object as input and produce another `VectorType`
+   * as output (both objects being taken as arguments to the `vmult()`
+   * function).
+   */
+  template <typename MatrixType, typename VectorType>
+  concept is_transpose_linear_operator_on =
+    requires(const MatrixType &A, VectorType &dst, const VectorType &src) {
+      A.Tvmult(dst, src);
+    };
+
 #endif
 
 } // namespace concepts

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.