]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix off one by one error in ConstraintMatrix.
authorTimo Heister <timo.heister@gmail.com>
Thu, 20 Jan 2011 08:34:47 +0000 (08:34 +0000)
committerTimo Heister <timo.heister@gmail.com>
Thu, 20 Jan 2011 08:34:47 +0000 (08:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@23223 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/constraint_matrix.h

index 859398db9692f83ea120f65d206c0c4d7de1b1f9..4a272f2a6307dc46bc5cc94caf79436baaf541c3 100644 (file)
@@ -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

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.