From: Martin Kronbichler Date: Tue, 5 Feb 2013 20:24:56 +0000 (+0000) Subject: Improve add_entries function a little. X-Git-Tag: v8.0.0~1431 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc09c658a5e93205a8af49b1a4eb20ce8c584194;p=dealii.git Improve add_entries function a little. git-svn-id: https://svn.dealii.org/trunk@28238 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/lac/sparsity_pattern.cc b/deal.II/source/lac/sparsity_pattern.cc index 3b2c76a383..c67b58d454 100644 --- a/deal.II/source/lac/sparsity_pattern.cc +++ b/deal.II/source/lac/sparsity_pattern.cc @@ -848,12 +848,11 @@ SparsityPattern::add (const unsigned int i, Assert (j= *it) + { + has_larger_entries = true; + break; + } + if (has_larger_entries == false) + for ( ; it != end; ++it, ++k) + { + Assert (k <= rowstart[row+1], + ExcNotEnoughSpace(row, rowstart[row+1]-rowstart[row])); + colnums[k] = *it; + } + else + // cannot just append the new range at the end, forward to the + // other function + for (ForwardIterator it = begin; it != end; ++it) + add (row, *it); + } + } + else + { + // forward to the other function. + for (ForwardIterator it = begin; it != end; ++it) + add (row, *it); + } }