From: bangerth Date: Mon, 12 Sep 2011 05:32:37 +0000 (+0000) Subject: Restrict a test to where it's really necessary. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8252a67c88375f65469cb8b88460f0e1abf46a8f;p=dealii-svn.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