From 2be5743cfbade7f2e26e8e2beb9cdb7467a86d78 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Fri, 22 Oct 2021 18:54:46 +0200 Subject: [PATCH] SparseMatrix::reinit(): accept other sparse matrix --- include/deal.II/lac/sparse_matrix.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/deal.II/lac/sparse_matrix.h b/include/deal.II/lac/sparse_matrix.h index d707f1f38e..2cd998e33c 100644 --- a/include/deal.II/lac/sparse_matrix.h +++ b/include/deal.II/lac/sparse_matrix.h @@ -696,6 +696,16 @@ public: virtual void reinit(const SparsityPattern &sparsity); + /** + * Reinitialize the sparse matrix with the sparsity pattern of the given + * @p sparse_matrix. See also comments of the function above. + * + * @note The elements of the matrix are set to zero by this function. + */ + template + void + reinit(const SparseMatrix &sparse_matrix); + /** * Release all memory and return to a state just like after having called * the default constructor. It also forgets the sparsity pattern it was @@ -1787,6 +1797,16 @@ private: +template +template +void +SparseMatrix::reinit(const SparseMatrix &sparse_matrix) +{ + this->reinit(sparse_matrix.get_sparsity_pattern()); +} + + + template inline typename SparseMatrix::size_type SparseMatrix::m() const -- 2.39.5