From c069ba8f0640bbc7f70079f1c8509ea173b834c0 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 22 Apr 2015 09:24:33 -0400 Subject: [PATCH] add check in interpolate_to_different_mesh --- .../deal.II/numerics/vector_tools.templates.h | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 71efeb6d14..faf4ccc3d7 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -585,6 +585,24 @@ namespace VectorTools interpolate_to_different_mesh(intergridmap, u1, constraints, u2); } + namespace internal + { + /** + * Returns whether the cell and all of its descendants are locally owned. + */ + template + bool is_locally_owned(const cell_iterator &cell) + { + if (cell->active()) + return cell->is_locally_owned(); + + for (unsigned int c=0; cn_children(); ++c) + if (!is_locally_owned(cell->child(c))) + return false; + + return true; + } + } template active() && !cell2->active()) continue; - // skip foreign cells + Assert(internal::is_locally_owned(cell1) == internal::is_locally_owned(cell2), + ExcMessage("The two Triangulations are required to have the same parallel partitioning.")); + + // Skip foreign cells. if (cell1->active() && !cell1->is_locally_owned()) continue; if (cell2->active() && !cell2->is_locally_owned()) -- 2.39.5