From a7dc68c355846de9e353b44af7f156ebd9ab3c50 Mon Sep 17 00:00:00 2001 From: kanschat Date: Mon, 27 May 2013 13:39:17 +0000 Subject: [PATCH] reintroduce constraints and add debug function git-svn-id: https://svn.dealii.org/trunk@29644 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/multigrid/mg_transfer.h | 5 ++ .../deal.II/multigrid/mg_transfer.templates.h | 54 +++++++++++++------ .../source/multigrid/mg_transfer_prebuilt.cc | 14 +++++ 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.h b/deal.II/include/deal.II/multigrid/mg_transfer.h index 43d586f667..3662b26b45 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.h @@ -236,6 +236,11 @@ public: */ void print_matrices(std::ostream& os) const; + /** + * Print the copy index fields for debugging purposes. + */ + void print_indices(std::ostream& os) const; + private: /** 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 80684076a7..50027ee368 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.templates.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.templates.h @@ -161,9 +161,9 @@ 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); + // 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); @@ -197,15 +197,25 @@ MGTransferPrebuilt::copy_from_mg( typedef std::vector >::const_iterator IT; // 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); - + 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); + // 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); + if (constraints==0) + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) = src[level](i->second); + else + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); } } @@ -229,15 +239,25 @@ MGTransferPrebuilt::copy_from_mg_add ( for (unsigned int level=0; level >::const_iterator IT; - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) += src[level](i->second); - + 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); + // 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); + if (constraints==0) + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) += src[level](i->second); + else + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); } } diff --git a/deal.II/source/multigrid/mg_transfer_prebuilt.cc b/deal.II/source/multigrid/mg_transfer_prebuilt.cc index fa73027ff0..d16733ea0e 100644 --- a/deal.II/source/multigrid/mg_transfer_prebuilt.cc +++ b/deal.II/source/multigrid/mg_transfer_prebuilt.cc @@ -314,6 +314,20 @@ MGTransferPrebuilt::print_matrices (std::ostream& os) const } } +template +void +MGTransferPrebuilt::print_indices (std::ostream& os) const +{ + os << "Copy indices" << std::endl; + for (unsigned int level = 0;level