From: bangerth Date: Mon, 7 Jan 2013 21:45:26 +0000 (+0000) Subject: Fix code in a couple of places to avoid an assertion. There is another X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=245bc604db0fd22d28100ba5454d420b12e370f4;p=dealii-svn.git Fix code in a couple of places to avoid an assertion. There is another problem somewhere, though. git-svn-id: https://svn.dealii.org/trunk@27969 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/numerics/matrix_tools.cc b/deal.II/source/numerics/matrix_tools.cc index fe02fbef82..1c08b22e58 100644 --- a/deal.II/source/numerics/matrix_tools.cc +++ b/deal.II/source/numerics/matrix_tools.cc @@ -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::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::iterator>; const typename SparseMatrix::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),