From: wolf Date: Tue, 30 Mar 2004 15:03:43 +0000 (+0000) Subject: Also fix the last problem here. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b6be95dfc5de1a07d21ea2b86234b17259b2223;p=dealii-svn.git Also fix the last problem here. git-svn-id: https://svn.dealii.org/trunk@8922 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/sparsity_pattern.h b/deal.II/lac/include/lac/sparsity_pattern.h index fc8fb0f6c6..9e654433fc 100644 --- a/deal.II/lac/include/lac/sparsity_pattern.h +++ b/deal.II/lac/include/lac/sparsity_pattern.h @@ -1558,12 +1558,22 @@ namespace internals ExcIteratorPastEnd()); ++accessor.a_index; - if (accessor.a_index >= - accessor.sparsity_pattern->row_length(accessor.a_row)) + + // if at end of line: cycle until we + // find a row with a nonzero number of + // entries + while (accessor.a_index >= + accessor.sparsity_pattern->row_length(accessor.a_row)) { accessor.a_index = 0; - accessor.a_row++; + ++accessor.a_row; + + // if we happened to find the end + // of the matrix, then stop here + if (accessor.a_row == accessor.sparsity_pattern->n_rows()) + break; } + return *this; } @@ -1579,12 +1589,22 @@ namespace internals const Iterator iter=*this; ++accessor.a_index; - if (accessor.a_index >= - accessor.sparsity_pattern->row_length(accessor.a_row)) + + // if at end of line: cycle until we + // find a row with a nonzero number of + // entries + while (accessor.a_index >= + accessor.sparsity_pattern->row_length(accessor.a_row)) { accessor.a_index = 0; - accessor.a_row++; + ++accessor.a_row; + + // if we happened to find the end + // of the matrix, then stop here + if (accessor.a_row == accessor.sparsity_pattern->n_rows()) + break; } + return iter; }