]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix code in a couple of places to avoid an assertion. There is another
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 7 Jan 2013 21:45:26 +0000 (21:45 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 7 Jan 2013 21:45:26 +0000 (21:45 +0000)
problem somewhere, though.

git-svn-id: https://svn.dealii.org/trunk@27969 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/numerics/matrix_tools.cc

index fe02fbef829b82930886728c4a498fca4874fff0..1c08b22e5845075e63793d4af57edd99b2480cb4 100644 (file)
@@ -2041,24 +2041,16 @@ namespace MatrixTools
             // elimination step
             const number diagonal_entry = matrix.diag_element(dof_number);
 
-            // we have to loop over all
-            // rows of the matrix which
-            // have a nonzero entry in
-            // the column which we work
-            // in presently. if the
-            // sparsity pattern is
-            // symmetric, then we can
-            // get the positions of
-            // these rows cheaply by
-            // looking at the nonzero
-            // column numbers of the
-            // present row. we need not
-            // look at the first entry,
-            // since that is the
-            // diagonal element and
-            // thus the present row
+            // we have to loop over all rows of the matrix which have
+            // a nonzero entry in the column which we work in
+            // presently. if the sparsity pattern is symmetric, then
+            // we can get the positions of these rows cheaply by
+            // looking at the nonzero column numbers of the present
+            // row. we need not look at the first entry of each row,
+            // since that is the diagonal element and thus the present
+            // row
             for (typename SparseMatrix<number>::iterator
-                q = matrix.begin(dof_number)++;
+                q = matrix.begin(dof_number)+1;
                 q != matrix.end(dof_number); ++q)
               {
                 const unsigned int row = q->column();
@@ -2070,20 +2062,21 @@ namespace MatrixTools
                              const unsigned int column)
                 = &column_less_than<typename SparseMatrix<number>::iterator>;
                 const typename SparseMatrix<number>::iterator
-                p = Utilities::lower_bound(matrix.begin(row)++,
+                p = Utilities::lower_bound(matrix.begin(row)+1,
                                            matrix.end(row),
                                            dof_number,
                                            comp);
 
-                // check whether this line has
-                // an entry in the regarding column
-                // (check for ==dof_number and
-                // != next_row, since if
-                // row==dof_number-1, *p is a
-                // past-the-end pointer but points
-                // to dof_number anyway...)
+                // check whether this line has an entry in the
+                // regarding column (check for ==dof_number and !=
+                // next_row, since if row==dof_number-1, *p is a
+                // past-the-end pointer but points to dof_number
+                // anyway...)
                 //
-                // there should be such an entry!
+                // there should be such an entry! we know this because
+                // we have assumed that the sparsity pattern is
+                // symmetric and we only walk over those rows for
+                // which the current row has a column entry
                 Assert ((p != matrix.end(row))
                         &&
                         (p->column() == dof_number),

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.