]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Also fix the last problem here.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 30 Mar 2004 15:03:43 +0000 (15:03 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 30 Mar 2004 15:03:43 +0000 (15:03 +0000)
git-svn-id: https://svn.dealii.org/trunk@8922 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparsity_pattern.h

index fc8fb0f6c6d87e6a51258b191447ce80a2ded19a..9e654433fce0c09f0b18cfb3db65e03e07b9b2f1 100644 (file)
@@ -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;
     }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.