From 7db834facad6697d14f84fae38d06ea40cce95fb Mon Sep 17 00:00:00 2001 From: bangerth Date: Sat, 9 Feb 2013 21:50:29 +0000 Subject: [PATCH] Avoid a bug with the newly introduced general use of always storing the diagonal of a square matrix. git-svn-id: https://svn.dealii.org/trunk@28297 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/lac/chunk_sparsity_pattern.cc | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/deal.II/source/lac/chunk_sparsity_pattern.cc b/deal.II/source/lac/chunk_sparsity_pattern.cc index 2983d2b747..96f6a12386 100644 --- a/deal.II/source/lac/chunk_sparsity_pattern.cc +++ b/deal.II/source/lac/chunk_sparsity_pattern.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2008, 2011, 2012 by the deal.II authors +// Copyright (C) 2008, 2011, 2012, 2013 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -300,14 +300,22 @@ void ChunkSparsityPattern::copy_from (const FullMatrix &matrix, { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); - // count number of entries per row, then - // initialize the underlying sparsity - // pattern + // count number of entries per row, then initialize the underlying sparsity + // pattern. remember to also allocate space for the diagonal entry (if that + // hasn't happened yet) if m==n since we always allocate that for diagonal + // matrices std::vector entries_per_row (matrix.m(), 0); for (unsigned int row=0; row