From c106b7dd6d2a56c9b419b5130f878957aa9d1ebd Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 21 Jul 2022 16:06:42 -0400 Subject: [PATCH] Move up the check with ExcGridHasInvalidCell. We can do better than an internal error in the GridTools function. --- include/deal.II/base/exceptions.h | 10 ++++++++++ source/grid/grid_tools.cc | 4 +++- source/grid/tria.cc | 9 --------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index b2412c3eb7..e4e62af343 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -1068,6 +1068,16 @@ namespace StandardExceptions "See the glossary entry on 'Ghosted vectors' for more " "information."); + /** + * Exception indicating that one of the cells in the input to + * Triangulation::create_triangulation() or a related function cannot be used. + */ + DeclException1(ExcGridHasInvalidCell, + int, + << "Something went wrong when making cell " << arg1 + << ". Read the docs and the source code " + << "for more information."); + /** * Some of our numerical classes allow for setting all entries to zero using * the assignment operator =. diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 601c9c9bbe..101671a0ae 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -881,6 +881,7 @@ namespace GridTools Assert(false, ExcNotImplemented()); std::size_t n_negative_cells = 0; + std::size_t cell_no = 0; for (auto &cell : cells) { const ArrayView vertices(cell.vertices); @@ -926,8 +927,9 @@ namespace GridTools // If not, then the grid is seriously broken and // we just give up. AssertThrow(GridTools::cell_measure(all_vertices, vertices) > 0, - ExcInternalError()); + ExcGridHasInvalidCell(cell_no)); } + ++cell_no; } return n_negative_cells; } diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 81e2cb26dd..680cd69a50 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -934,15 +934,6 @@ namespace internal // internal::TriangulationImplementation using dealii::Triangulation; - /** - * Exception - * @ingroup Exceptions - */ - DeclException1(ExcGridHasInvalidCell, - int, - << "Something went wrong when making cell " << arg1 - << ". Read the docs and the source code " - << "for more information."); /** * Exception * @ingroup Exceptions -- 2.39.5