From: Wolfgang Bangerth Date: Tue, 26 Mar 2024 23:40:26 +0000 (-0600) Subject: Provide a better error message. X-Git-Tag: v9.6.0-rc1~449^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88639b5c2c78dc25e3b581c70136218a77721ecf;p=dealii.git Provide a better error message. --- diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 8d68212f98..6b490f2353 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -21,6 +21,8 @@ #include #include +#include + #include #include #include @@ -16718,8 +16720,32 @@ namespace const bool allow_anisotropic_smoothing) { Assert(cell->is_active(), ExcInternalError()); - Assert(cell->refine_flag_set() == false, ExcInternalError()); +#ifdef DEBUG + // If this is not a parallel::distributed::Triangulation, then we really + // should only get here if the cell is marked for refinement: + if (dynamic_cast + *>(&cell->get_triangulation()) == nullptr) + Assert(cell->refine_flag_set() == false, ExcInternalError()); + else + // But if this is a p::d::Triangulation, then we don't have that + // much control and we can get here because mesh smoothing is + // requested but can not be honored because p4est controls + // what gets refined. In that case, we can at least provide + // a better error message. + Assert(cell->refine_flag_set() == false, + ExcMessage( + "The triangulation is trying to avoid unrefined islands " + "during mesh refinement/coarsening, as you had requested " + " by passing the appropriate 'smoothing flags' to the " + "constructor of the triangulation. However, for objects " + "of type parallel::distributed::Triangulation, control " + "over which cells get refined rests with p4est, not the " + "deal.II triangulation, and consequently it is not " + "always possible to avoid unrefined islands in the mesh. " + "Please remove the constructor argument to the triangulation " + "object that requests mesh smoothing.")); +#endif // now we provide two algorithms. the first one is the standard // one, coming from the time, where only isotropic refinement was