]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add check in interpolate_to_different_mesh 860/head
authorTimo Heister <timo.heister@gmail.com>
Wed, 22 Apr 2015 13:24:33 +0000 (09:24 -0400)
committerTimo Heister <timo.heister@gmail.com>
Wed, 22 Apr 2015 16:33:32 +0000 (12:33 -0400)
include/deal.II/numerics/vector_tools.templates.h

index 71efeb6d14af4f3030fae66d3d9c88181f61a8b6..faf4ccc3d75490de114a864de8fcd84bd234e6d1 100644 (file)
@@ -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 <typename cell_iterator>
+    bool is_locally_owned(const cell_iterator &cell)
+    {
+      if (cell->active())
+        return cell->is_locally_owned();
+
+      for (unsigned int c=0; c<cell->n_children(); ++c)
+        if (!is_locally_owned(cell->child(c)))
+          return false;
+
+      return true;
+    }
+  }
 
 
   template <int dim, int spacedim,
@@ -631,7 +649,10 @@ namespace VectorTools
         if (!cell1->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())

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.