From b7ca9539064515e6df79e3bd835eae47505d6d6b Mon Sep 17 00:00:00 2001 From: Marco Feder Date: Tue, 27 May 2025 14:31:36 +0200 Subject: [PATCH] Set rhs parameters during initialization --- include/deal.II/lac/sparse_direct.h | 2 +- source/lac/sparse_direct.cc | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/deal.II/lac/sparse_direct.h b/include/deal.II/lac/sparse_direct.h index 0946439c44..6f0f46232e 100644 --- a/include/deal.II/lac/sparse_direct.h +++ b/include/deal.II/lac/sparse_direct.h @@ -647,7 +647,7 @@ private: /** * Local to global index mapping for the right-hand side vector. */ - mutable std::vector irhs_loc; + mutable std::vector irhs_loc; /** * irn contains the row indices of the non-zero entries of the matrix. diff --git a/source/lac/sparse_direct.cc b/source/lac/sparse_direct.cc index c77bd182d2..2d02cd554b 100644 --- a/source/lac/sparse_direct.cc +++ b/source/lac/sparse_direct.cc @@ -1086,6 +1086,13 @@ SparseDirectMUMPS::initialize_matrix(const Matrix &matrix) id.jcn_loc = jcn.get(); id.a_loc = a.get(); id.irhs_loc = irhs_loc.data(); + + // rhs parameters + id.icntl[19] = 10; // distributed rhs + id.icntl[20] = 0; // centralized solution, stored on rank 0 by MUMPS + id.nrhs = 1; + id.lrhs_loc = n; + id.nloc_rhs = row_range.n_elements(); } else { @@ -1173,13 +1180,6 @@ SparseDirectMUMPS::vmult(VectorType &dst, const VectorType &src) const TrilinosWrappers::MPI::Vector> || std::is_same_v) { - id.icntl[19] = 10; // distributed rhs - id.icntl[20] = 0; // centralized solution, stored on rank 0 by MUMPS - id.nrhs = 1; - id.lrhs_loc = n; - id.nloc_rhs = row_range.n_elements(); - - if constexpr (std::is_same_v) id.rhs_loc = const_cast(src.begin()); else if constexpr (std::is_same_v) -- 2.39.5