From: Peter Munch Date: Sun, 7 Jan 2024 19:52:11 +0000 (+0100) Subject: Template VectorType in TrilinosWrappers::SparseMatrix::residual() X-Git-Tag: relicensing~188^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65f01b082f3fa20c0e6ed2ee061c65951e3cc396;p=dealii.git Template VectorType in TrilinosWrappers::SparseMatrix::residual() --- 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;