From 65f01b082f3fa20c0e6ed2ee061c65951e3cc396 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sun, 7 Jan 2024 20:52:11 +0100 Subject: [PATCH] Template VectorType in TrilinosWrappers::SparseMatrix::residual() --- include/deal.II/lac/trilinos_sparse_matrix.h | 20 +++++++++++++++++--- source/lac/trilinos_sparse_matrix.cc | 14 -------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index dfd90b522f..df9cbb3f69 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -1575,10 +1575,9 @@ namespace TrilinosWrappers * running on one processor, since the matrix object is inherently * distributed. Otherwise, an exception will be thrown. */ + template 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 C = A * B, or, if an @@ -3116,6 +3115,21 @@ namespace TrilinosWrappers } + + template + 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 diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index f36ab6f8d1..bdfb9ca512 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -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; -- 2.39.5