]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add assert to check the definition of CellData 12829/head
authorPeter Munch <peterrmuench@gmail.com>
Thu, 14 Oct 2021 17:13:48 +0000 (19:13 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 15 Oct 2021 17:26:49 +0000 (19:26 +0200)
include/deal.II/grid/connectivity.h

index 716749fdc29a52496c804621c0ca7e4b32444ff1..d4264bf045dafd3516fe6199bb558a1e16fdf49f 100644 (file)
@@ -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());

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.