From: Guido Kanschat Date: Mon, 27 May 2013 12:21:01 +0000 (+0000) Subject: fix distributed functionality in copy to/from mg X-Git-Tag: v8.0.0~398 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9aeb1666f5061cb1ded906c6386703795864cc4c;p=dealii.git fix distributed functionality in copy to/from mg git-svn-id: https://svn.dealii.org/trunk@29639 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.templates.h b/deal.II/include/deal.II/multigrid/mg_transfer.templates.h index ba33d6170c..80684076a7 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.templates.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.templates.h @@ -161,15 +161,12 @@ MGTransferPrebuilt::copy_to_mg ( i != copy_indices[level].end(); ++i) dst_level(i->second) = src(i->first); + for (IT i= copy_indices_to_me[level].begin(); + i != copy_indices_to_me[level].end(); ++i) + dst_level(i->second) = src(i->first); + dst_level.compress(VectorOperation::insert); - // For non-DG: degrees of - // freedom in the refinement - // face may need special - // attention, since they belong - // to the coarse level, but - // have fine level basis - // functions if (!first) restrict_and_add (level+1, dst[level], dst[level+1]); @@ -199,14 +196,16 @@ MGTransferPrebuilt::copy_from_mg( { typedef std::vector >::const_iterator IT; - if (constraints == 0) - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) = src[level](i->second); - else - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + // First copy all indices local to this process + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + dst(i->first) = src[level](i->second); + + // Do the same for the indices where the level index is local, + // but the global index is not + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) = src[level](i->second); } } @@ -233,6 +232,12 @@ MGTransferPrebuilt::copy_from_mg_add ( for (IT i= copy_indices[level].begin(); i != copy_indices[level].end(); ++i) dst(i->first) += src[level](i->second); + + // Do the same for the indices where the level index is local, + // but the global index is not + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) += src[level](i->second); } }