From: Wolfgang Bangerth Date: Mon, 12 Sep 2011 05:32:37 +0000 (+0000) Subject: Restrict a test to where it's really necessary. X-Git-Tag: v8.0.0~3469 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3840d474fbe1b5c6e82c7797b3c239449d3b0f6;p=dealii.git Restrict a test to where it's really necessary. git-svn-id: https://svn.dealii.org/trunk@24311 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/grid/grid_tools.cc b/deal.II/source/grid/grid_tools.cc index b987daf18f..fe079742c3 100644 --- a/deal.II/source/grid/grid_tools.cc +++ b/deal.II/source/grid/grid_tools.cc @@ -80,9 +80,22 @@ template double GridTools::diameter (const Triangulation &tria) { - Assert ((dynamic_cast*>(&tria) - == 0), - ExcNotImplemented()); + // we can't deal with distributed meshes + // since we don't have all vertices + // locally. there is one exception, + // however: if the mesh has never been + // refined. the way to test this is not to + // ask tria.n_levels()==1, since this is + // something that can happen on one + // processor without being true on + // all. however, we can ask for the global + // number of active cells and use that +#ifdef DEAL_II_USE_P4EST + if (const parallel::distributed::Triangulation *p_tria + = dynamic_cast*>(&tria)) + Assert (p_tria->n_global_active_cells() == tria.n_cells(0), + ExcNotImplemented()); +#endif // the algorithm used simply // traverses all cells and picks