]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move up the check with ExcGridHasInvalidCell.
authorDavid Wells <drwells@email.unc.edu>
Thu, 21 Jul 2022 20:06:42 +0000 (16:06 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 27 Aug 2022 17:15:23 +0000 (13:15 -0400)
We can do better than an internal error in the GridTools function.

include/deal.II/base/exceptions.h
source/grid/grid_tools.cc
source/grid/tria.cc

index b2412c3eb7a358d50dcf21b88c5599d52d605db5..e4e62af343fee2b73e7e8f30488ec11c557b2a56 100644 (file)
@@ -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 <tt>=</tt>.
index 601c9c9bbe171f9b6f158aea8ce9027a44f1810f..101671a0aeac55081b66378aae25f73aab388259 100644 (file)
@@ -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<const unsigned int> 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;
   }
index 81e2cb26dd07434d9d244bc17ad3b89bac3d0645..680cd69a506e111af5075e1e6f202bba5546ab52 100644 (file)
@@ -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

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.