Skip to content

Commit

Permalink
Merge pull request #11868 from peterrum/exchange_cell_data_pst_assert
Browse files Browse the repository at this point in the history
Add assert to exchange_cell_data for p:s:T (without artificial cell)
  • Loading branch information
drwells committed Mar 8, 2021
2 parents 9bc6446 + ae26124 commit 15440af
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions include/deal.II/grid/grid_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 15440af

Please sign in to comment.