From: Peter Munch Date: Fri, 22 Oct 2021 16:54:46 +0000 (+0200) Subject: SparseMatrix::reinit(): accept other sparse matrix X-Git-Tag: v9.4.0-rc1~899^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12863%2Fhead;p=dealii.git SparseMatrix::reinit(): accept other sparse matrix --- 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