]> https://gitweb.dealii.org/ - dealii.git/commitdiff
SolverGMRES: add requires() clauses
authorMatthias Maier <tamiko@43-1.org>
Wed, 26 Mar 2025 21:38:29 +0000 (16:38 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 5 May 2025 21:10:57 +0000 (16:10 -0500)
include/deal.II/lac/solver_gmres.h

index 5efac2498d80a9bd54acc277dbf17f08bb8d06aa..0366ee8e39b0c483c88ee851c3f39c76e6f1490b 100644 (file)
@@ -697,11 +697,13 @@ public:
    * Solve the linear system $Ax=b$ for x.
    */
   template <typename MatrixType, typename... PreconditionerTypes>
-  void
-  solve(const MatrixType &A,
-        VectorType       &x,
-        const VectorType &b,
-        const PreconditionerTypes &...preconditioners);
+  DEAL_II_CXX20_REQUIRES(
+    (concepts::is_linear_operator_on<MatrixType, VectorType> &&
+     (concepts::is_linear_operator_on<PreconditionerTypes, VectorType> && ...)))
+  void solve(const MatrixType &A,
+             VectorType       &x,
+             const VectorType &b,
+             const PreconditionerTypes &...preconditioners);
 
 protected:
   /**
@@ -2052,12 +2054,16 @@ SolverMPGMRES<VectorType>::SolverMPGMRES(SolverControl        &cn,
 
 
 template <typename VectorType>
+DEAL_II_CXX20_REQUIRES(concepts::is_vector_space_vector<VectorType>)
 template <typename MatrixType, typename... PreconditionerTypes>
-void
-SolverMPGMRES<VectorType>::solve(const MatrixType &A,
-                                 VectorType       &x,
-                                 const VectorType &b,
-                                 const PreconditionerTypes &...preconditioners)
+DEAL_II_CXX20_REQUIRES(
+  (concepts::is_linear_operator_on<MatrixType, VectorType> &&
+   (concepts::is_linear_operator_on<PreconditionerTypes, VectorType> && ...)))
+void SolverMPGMRES<VectorType>::solve(
+  const MatrixType &A,
+  VectorType       &x,
+  const VectorType &b,
+  const PreconditionerTypes &...preconditioners)
 {
   LogStream::Prefix prefix("MPGMRES");
   SolverMPGMRES<VectorType>::solve_internal(A, x, b, preconditioners...);
@@ -2066,6 +2072,7 @@ SolverMPGMRES<VectorType>::solve(const MatrixType &A,
 
 
 template <typename VectorType>
+DEAL_II_CXX20_REQUIRES(concepts::is_vector_space_vector<VectorType>)
 template <typename MatrixType, typename... PreconditionerTypes>
 void
 SolverMPGMRES<VectorType>::solve_internal(

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.