]> https://gitweb.dealii.org/ - dealii.git/commitdiff
maybe fix ConstraintMatrix::set_zero for parallel::distributed::BlockVector
authorTimo Heister <timo.heister@gmail.com>
Sun, 7 Jul 2013 16:01:03 +0000 (16:01 +0000)
committerTimo Heister <timo.heister@gmail.com>
Sun, 7 Jul 2013 16:01:03 +0000 (16:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@29942 0785d39b-7218-0410-832d-ea1e28bc413d

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

index a8c1d393c1bd8cc95e8d5edaf89c1578899446bb..6a2454f1cdd36734107ad7448bcc11b56a045492 100644 (file)
@@ -761,8 +761,18 @@ namespace internal
       {
         for (typename std::vector<size_type>::const_iterator it = cm.begin();
              it != cm.end(); ++it)
-          if (vec.in_local_range(*it))
-            vec(*it) = 0.;
+          {
+            // If shift>0 then we are working on a part of a BlockVector
+            // so vec(i) is actually the global entry i+shift.
+            // We first make sure the line falls into the range of vec,
+            // then check if is part of the local part of the vector, before
+            // finally setting it to 0.
+            if ((*it)<shift)
+              continue;
+            size_type idx = *it - shift;
+            if (vec.in_local_range(idx))
+              vec(idx) = 0.;
+          }
         vec.zero_out_ghosts();
       }
 

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.