]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Template VectorType in TrilinosWrappers::SparseMatrix::residual() 16432/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 7 Jan 2024 19:52:11 +0000 (20:52 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Sun, 7 Jan 2024 19:52:11 +0000 (20:52 +0100)
include/deal.II/lac/trilinos_sparse_matrix.h
source/lac/trilinos_sparse_matrix.cc

index dfd90b522f532bf28db07c8bef04e26cf00da172..df9cbb3f6956c465d22a959443bdfdee6eba3545 100644 (file)
@@ -1575,10 +1575,9 @@ namespace TrilinosWrappers
      * running on one processor, since the matrix object is inherently
      * distributed. Otherwise, an exception will be thrown.
      */
+    template <typename VectorType>
     TrilinosScalar
-    residual(MPI::Vector       &dst,
-             const MPI::Vector &x,
-             const MPI::Vector &b) const;
+    residual(VectorType &dst, const VectorType &x, const VectorType &b) const;
 
     /**
      * Perform the matrix-matrix multiplication <tt>C = A * B</tt>, or, if an
@@ -3116,6 +3115,21 @@ namespace TrilinosWrappers
   }
 
 
+
+  template <typename VectorType>
+  inline TrilinosScalar
+  SparseMatrix::residual(VectorType       &dst,
+                         const VectorType &x,
+                         const VectorType &b) const
+  {
+    vmult(dst, x);
+    dst -= b;
+    dst *= -1.;
+
+    return dst.l2_norm();
+  }
+
+
   namespace internal
   {
     namespace LinearOperatorImplementation
index f36ab6f8d1502b46878a40438aba55a5dc1a6b9f..bdfb9ca512a240f864eed13c45221d039fc05900 100644 (file)
@@ -2127,20 +2127,6 @@ namespace TrilinosWrappers
 
 
 
-  TrilinosScalar
-  SparseMatrix::residual(MPI::Vector       &dst,
-                         const MPI::Vector &x,
-                         const MPI::Vector &b) const
-  {
-    vmult(dst, x);
-    dst -= b;
-    dst *= -1.;
-
-    return dst.l2_norm();
-  }
-
-
-
   namespace internals
   {
     using size_type = dealii::types::global_dof_index;

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.