From: Wolfgang Bangerth Date: Fri, 10 May 2024 06:21:12 +0000 (+0530) Subject: Introduce concepts that matrix template arguments have to satisfy. X-Git-Tag: v9.6.0-rc1~294^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16a19b8e46be854daa2a5ecc2e9c11771840a53f;p=dealii.git Introduce concepts that matrix template arguments have to satisfy. --- 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