From: Peter Munch Date: Thu, 14 Oct 2021 17:13:48 +0000 (+0200) Subject: Add assert to check the definition of CellData X-Git-Tag: v9.4.0-rc1~935^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12829%2Fhead;p=dealii.git Add assert to check the definition of CellData --- 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());