From e4a238c14806fa4078e006955f4e04cc617266ad Mon Sep 17 00:00:00 2001 From: Lei Qiao Date: Fri, 21 Aug 2015 18:38:50 -0500 Subject: [PATCH] let SparseMatrixEZ not reset memory allocation paramters in copy_from() --- include/deal.II/lac/sparse_matrix_ez.h | 10 +++++++++- include/deal.II/lac/sparse_matrix_ez.templates.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/deal.II/lac/sparse_matrix_ez.h b/include/deal.II/lac/sparse_matrix_ez.h index 303e1d2bb8..ad4f3b2c5e 100644 --- a/include/deal.II/lac/sparse_matrix_ez.h +++ b/include/deal.II/lac/sparse_matrix_ez.h @@ -858,6 +858,11 @@ private: * Increment when a row grows. */ unsigned int increment; + + /** + * Remember the user provided default row length. + */ + unsigned int saved_default_row_length; }; /** @@ -1392,7 +1397,10 @@ inline SparseMatrixEZ & SparseMatrixEZ::copy_from (const MATRIX &M, const bool elide_zero_values) { - reinit(M.m(), M.n()); + reinit(M.m(), + M.n(), + this->saved_default_row_length, + this->increment); // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and diff --git a/include/deal.II/lac/sparse_matrix_ez.templates.h b/include/deal.II/lac/sparse_matrix_ez.templates.h index a83883548d..bacd822d5c 100644 --- a/include/deal.II/lac/sparse_matrix_ez.templates.h +++ b/include/deal.II/lac/sparse_matrix_ez.templates.h @@ -102,6 +102,7 @@ SparseMatrixEZ::reinit(const size_type n_rows, { clear(); + saved_default_row_length = default_row_length; increment = default_increment; n_columns = n_cols; -- 2.39.5