From: guido Date: Thu, 11 Oct 2001 10:02:17 +0000 (+0000) Subject: zero-length rows for SparsityPattern X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdd2e9ae0df67d85e25a9c41e75610c9e3e2e898;p=dealii-svn.git zero-length rows for SparsityPattern git-svn-id: https://svn.dealii.org/branches/Branch-3-2@5143 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/source/sparsity_pattern.cc b/deal.II/lac/source/sparsity_pattern.cc index cc0760cf88..5aeba9b8b3 100644 --- a/deal.II/lac/source/sparsity_pattern.cc +++ b/deal.II/lac/source/sparsity_pattern.cc @@ -270,18 +270,30 @@ SparsityPattern::reinit (const unsigned int m, return; }; - // find out how many entries we + // first, if the matrix is + // quadratic, we will have to make + // sure that each row has at least + // one entry for the diagonal + // element. make this more obvious + // by having a variable which we + // can query + const bool matrix_is_quadratic = (m == n ? true : false); + + // find out how many entries we // need in the @p{colnums} array. if // this number is larger than // @p{max_vec_len}, then we will need // to reallocate memory // // note that the number of elements - // is bounded by the number of - // columns + // per row is bounded by the number + // of columns unsigned int vec_len = 0; for (unsigned int i=0; i 1) + std::sort ((rows==cols) ? tmp_entries.begin()+1 : tmp_entries.begin(), + tmp_entries.begin()+row_length); + // insert column numbers // into the new field for (unsigned int j=0; j