]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add assert to exchange_cell_data for p:s:T (without artifical cell) 11868/head
authorPeter Munch <peterrmuench@gmail.com>
Mon, 8 Mar 2021 16:59:23 +0000 (17:59 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 8 Mar 2021 17:27:05 +0000 (18:27 +0100)
include/deal.II/grid/grid_tools.h

index 970819d4d97da13b11f51db659e57166e30993be..e81903665c0cb40950a1fa3c26100df0c580fb41 100644 (file)
@@ -25,6 +25,8 @@
 
 #  include <deal.II/boost_adaptors/bounding_box.h>
 
+#  include <deal.II/distributed/shared_tria.h>
+
 #  include <deal.II/dofs/dof_handler.h>
 
 #  include <deal.II/fe/mapping.h>
@@ -4114,8 +4116,7 @@ namespace GridTools
       (void)cell_filter;
       (void)process_cells;
       (void)compute_ghost_owners;
-      Assert(false,
-             ExcMessage("GridTools::exchange_cell_data() requires MPI."));
+      Assert(false, ExcNeedsMPI());
 #    else
       constexpr int dim      = MeshType::dimension;
       constexpr int spacedim = MeshType::space_dimension;
@@ -4127,6 +4128,21 @@ namespace GridTools
         ExcMessage(
           "The function exchange_cell_data_to_ghosts() only works with parallel triangulations."));
 
+      if (const auto tria = dynamic_cast<
+            const parallel::shared::Triangulation<dim, spacedim> *>(
+            &mesh.get_triangulation()))
+        {
+          Assert(
+            tria->with_artificial_cells(),
+            ExcMessage(
+              "The functions GridTools::exchange_cell_data_to_ghosts() and "
+              "GridTools::exchange_cell_data_to_level_ghosts() can only "
+              "operate on a single layer ghost cells. However, you have "
+              "given a Triangulation object of type "
+              "parallel::shared::Triangulation without artificial cells "
+              "resulting in arbitrary numbers of ghost layers."));
+        }
+
       // build list of cells to request for each neighbor
       std::set<dealii::types::subdomain_id> ghost_owners =
         compute_ghost_owners(*tria);
@@ -4344,9 +4360,7 @@ namespace GridTools
     (void)pack;
     (void)unpack;
     (void)cell_filter;
-    Assert(false,
-           ExcMessage(
-             "GridTools::exchange_cell_data_to_ghosts() requires MPI."));
+    Assert(false, ExcNeedsMPI());
 #    else
     internal::exchange_cell_data<DataType,
                                  MeshType,
@@ -4382,9 +4396,7 @@ namespace GridTools
     (void)pack;
     (void)unpack;
     (void)cell_filter;
-    Assert(false,
-           ExcMessage(
-             "GridTools::exchange_cell_data_to_level_ghosts() requires MPI."));
+    Assert(false, ExcNeedsMPI());
 #    else
     internal::exchange_cell_data<DataType,
                                  MeshType,

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.