Skip to content

Commit

Permalink
Add assert to check the definition of CellData
Browse files Browse the repository at this point in the history
  • Loading branch information
peterrum committed Oct 14, 2021
1 parent f8d4ef1 commit 8970a9b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/deal.II/grid/connectivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 has multiple times the same "
"vertex. 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());
Expand Down

0 comments on commit 8970a9b

Please sign in to comment.