]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Revert order of if-clauses: first check whether an element exist, then
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 29 Nov 2001 15:18:58 +0000 (15:18 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 29 Nov 2001 15:18:58 +0000 (15:18 +0000)
access it.

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

deal.II/lac/source/sparsity_pattern.cc

index 5aeba9b8b31bb1ec8d54c9dd884de02f42448f23..2259ccc16972ed222f1bb7d4ab479b63c54eb4b0 100644 (file)
@@ -566,14 +566,16 @@ SparsityPattern::operator () (const unsigned int i,
     return rowstart[i];
 
                                   // all other entries are sorted, so
-                                  // we can use a binary seach algorithm
+                                  // we can use a binary search
+                                  // algorithm
                                   //
-                                  // note that the entries are only sorted
-                                  // upon compression, so this would fail
-                                  // for non-compressed sparsity patterns;
-                                  // however, that is why the Assertion is
-                                  // at the top of this function, so it
-                                  // may not be called for noncompressed
+                                  // note that the entries are only
+                                  // sorted upon compression, so this
+                                  // would fail for non-compressed
+                                  // sparsity patterns; however, that
+                                  // is why the Assertion is at the
+                                  // top of this function, so it may
+                                  // not be called for noncompressed
                                   // structures.
   const unsigned int * const sorted_region_start = (rows==cols ?
                                                    &colnums[rowstart[i]+1] :
@@ -581,8 +583,7 @@ SparsityPattern::operator () (const unsigned int i,
   const unsigned int * const p = optimized_lower_bound (sorted_region_start,
                                                        &colnums[rowstart[i+1]],
                                                        j);
-  if ((*p == j) &&
-      (p != &colnums[rowstart[i+1]]))
+  if ((p != &colnums[rowstart[i+1]])  &&  (*p == j))
     return (p - &colnums[0]);
   else
     return invalid_entry;

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.