From: heister Date: Sun, 7 Jul 2013 16:01:03 +0000 (+0000) Subject: maybe fix ConstraintMatrix::set_zero for parallel::distributed::BlockVector X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d866f590ffd790a747b2bf620ea73d0f4e2db7de;p=dealii-svn.git maybe fix ConstraintMatrix::set_zero for parallel::distributed::BlockVector git-svn-id: https://svn.dealii.org/trunk@29942 0785d39b-7218-0410-832d-ea1e28bc413d --- 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)