From a64d4a6274f538c3d6b44777bc0eb22c2d93009e Mon Sep 17 00:00:00 2001 From: wolf Date: Sat, 19 Jun 2004 22:21:01 +0000 Subject: [PATCH] Don't let SparsityPattern be a friend of CompressedSparsityPattern. There are better ways to access the data of the latter class. git-svn-id: https://svn.dealii.org/trunk@9437 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/lac/compressed_sparsity_pattern.h | 2 - deal.II/lac/source/sparsity_pattern.cc | 47 +++++++++++++++++-- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/deal.II/lac/include/lac/compressed_sparsity_pattern.h b/deal.II/lac/include/lac/compressed_sparsity_pattern.h index c19ebb5e3f..4e675de5a5 100644 --- a/deal.II/lac/include/lac/compressed_sparsity_pattern.h +++ b/deal.II/lac/include/lac/compressed_sparsity_pattern.h @@ -353,8 +353,6 @@ class CompressedSparsityPattern : public Subscriptor * entries. */ std::vector > column_indices; - - friend class SparsityPattern; }; /*@}*/ diff --git a/deal.II/lac/source/sparsity_pattern.cc b/deal.II/lac/source/sparsity_pattern.cc index 537617041e..5a2dfbbf2f 100644 --- a/deal.II/lac/source/sparsity_pattern.cc +++ b/deal.II/lac/source/sparsity_pattern.cc @@ -517,10 +517,49 @@ void SparsityPattern::copy_from (const CompressedSparsityPattern &csp, const bool optimize_diag) { - copy_from (csp.n_rows(), csp.n_cols(), - csp.column_indices.begin(), - csp.column_indices.end(), - optimize_diag); +// copy_from (csp.n_rows(), csp.n_cols(), +// csp.column_indices.begin(), +// csp.column_indices.end(), +// optimize_diag); + // first determine row lengths for + // each row. if the matrix is + // quadratic, then we might have to + // add an additional entry for the + // diagonal, if that is not yet + // present. as we have to call + // compress anyway later on, don't + // bother to check whether that + // diagonal entry is in a certain + // row or not + const bool is_square = optimize_diag && (csp.n_rows() == csp.n_cols()); + std::vector row_lengths (csp.n_rows()); + for (unsigned int i=0; i