From e140ffc9839201a77c26e6e6afe793a142b31fc0 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sun, 7 Jul 2013 16:01:03 +0000 Subject: [PATCH] maybe fix ConstraintMatrix::set_zero for parallel::distributed::BlockVector git-svn-id: https://svn.dealii.org/trunk@29942 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/lac/constraint_matrix.templates.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h index a8c1d393c1..6a2454f1cd 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -761,8 +761,18 @@ namespace internal { for (typename std::vector::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)