From 0e83a8c4f3009765ac44b66f3969f70a582d9784 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Thu, 14 Oct 2021 19:13:48 +0200 Subject: [PATCH] Add assert to check the definition of CellData --- include/deal.II/grid/connectivity.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/deal.II/grid/connectivity.h b/include/deal.II/grid/connectivity.h index 716749fdc2..d4264bf045 100644 --- a/include/deal.II/grid/connectivity.h +++ b/include/deal.II/grid/connectivity.h @@ -1491,6 +1491,23 @@ namespace internal // loop over cells and create CRS for (const auto &cell : cells) { +#ifdef DEBUG + auto vertices_unique = cell.vertices; + std::sort(vertices_unique.begin(), vertices_unique.end()); + vertices_unique.erase(std::unique(vertices_unique.begin(), + vertices_unique.end()), + vertices_unique.end()); + + Assert(vertices_unique.size() == cell.vertices.size(), + ExcMessage( + "The definition of a cell refers to the same vertex several " + "times. This is not possible. A common reason is that " + "CellData::vertices has a size that does not match the " + "size expected from the reference cell. Please resize " + "CellData::vertices or use the appropriate constructor of " + "CellData.")); +#endif + const dealii::ReferenceCell reference_cell = dealii::ReferenceCell::n_vertices_to_type(dim, cell.vertices.size()); -- 2.39.5