From: David Wells Date: Sat, 7 May 2016 21:15:48 +0000 (-0400) Subject: Don't throw exceptions if distorted cells are OK. X-Git-Tag: v8.5.0-rc1~1050^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7477065742eaaca3d07be7509796f0cf6d204dc;p=dealii.git Don't throw exceptions if distorted cells are OK. --- diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 8f6cc849fd..4d8351d568 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -1646,9 +1646,16 @@ namespace internal { for (unsigned int cell_no = 0; cell_no - (triangulation.vertices, cells[cell_no].vertices); - AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no)); + // If we should check for distorted cells, then we permit them + // to exist. If a cell has negative measure, then it must be + // distorted (the converse is not necessarily true); hence + // throw an exception if no such cells should exist. + if (!triangulation.check_for_distorted_cells) + { + const double cell_measure = GridTools::cell_measure<1, spacedim> + (triangulation.vertices, cells[cell_no].vertices); + AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no)); + } } } #endif @@ -1841,9 +1848,13 @@ namespace internal { for (unsigned int cell_no = 0; cell_no - (triangulation.vertices, cells[cell_no].vertices); - AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no)); + // See the note in the 1D function on this if statement. + if (!triangulation.check_for_distorted_cells) + { + const double cell_measure = GridTools::cell_measure<2, spacedim> + (triangulation.vertices, cells[cell_no].vertices); + AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no)); + } } } #endif @@ -2220,9 +2231,13 @@ namespace internal //TODO: The following code does not compile with MSVC. Find a way around it for (unsigned int cell_no = 0; cell_no - (triangulation.vertices, cells[cell_no].vertices); - AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no)); + // See the note in the 1D function on this if statement. + if (!triangulation.check_for_distorted_cells) + { + const double cell_measure = GridTools::cell_measure<3, spacedim> + (triangulation.vertices, cells[cell_no].vertices); + AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no)); + } } #endif