From 16a19b8e46be854daa2a5ecc2e9c11771840a53f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 10 May 2024 11:51:12 +0530 Subject: [PATCH] Introduce concepts that matrix template arguments have to satisfy. --- include/deal.II/base/template_constraints.h | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index 85cfd4b660..16b713c0b4 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -1053,6 +1053,36 @@ namespace concepts } -> std::same_as; }; + + /** + * 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 + 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 + concept is_transpose_linear_operator_on = + requires(const MatrixType &A, VectorType &dst, const VectorType &src) { + A.Tvmult(dst, src); + }; + #endif } // namespace concepts -- 2.39.5