From 7b0679b99532017cae06f9264b052c8a19e4f598 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 20 Jan 2011 08:34:47 +0000 Subject: [PATCH] fix off one by one error in ConstraintMatrix. git-svn-id: https://svn.dealii.org/trunk@23223 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/constraint_matrix.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index 859398db96..4a272f2a63 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -1875,12 +1875,14 @@ ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) cons // constrained. could use is_constrained, but // that means computing the line index twice const unsigned int line_index = calculate_line_index(index); - if (line_index > lines_cache.size() || - lines_cache[line_index] == numbers::invalid_unsigned_int || - lines[lines_cache[line_index]].inhomogeneity == 0) + if (line_index >= lines_cache.size() || + lines_cache[line_index] == numbers::invalid_unsigned_int) return false; else - return true; + { + Assert(lines_cache[line_index] < lines.size(), ExcInternalError()); + return !(lines[lines_cache[line_index]].inhomogeneity == 0); + } } @@ -1893,7 +1895,7 @@ ConstraintMatrix::get_constraint_entries (unsigned int line) const // constrained. could use is_constrained, but // that means computing the line index twice const unsigned int line_index = calculate_line_index(line); - if (line_index > lines_cache.size() || + if (line_index >= lines_cache.size() || lines_cache[line_index] == numbers::invalid_unsigned_int) return 0; else @@ -1910,7 +1912,7 @@ ConstraintMatrix::get_inhomogeneity (unsigned int line) const // constrained. could use is_constrained, but // that means computing the line index twice const unsigned int line_index = calculate_line_index(line); - if (line_index > lines_cache.size() || + if (line_index >= lines_cache.size() || lines_cache[line_index] == numbers::invalid_unsigned_int) return 0; else -- 2.39.5