]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Restrict a test to where it's really necessary.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 12 Sep 2011 05:32:37 +0000 (05:32 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 12 Sep 2011 05:32:37 +0000 (05:32 +0000)
git-svn-id: https://svn.dealii.org/trunk@24311 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/grid/grid_tools.cc

index b987daf18feb88ff8916e0c235be75af02d4478b..fe079742c3d5500b3a5a5053571e6ca538ca9dec 100644 (file)
@@ -80,9 +80,22 @@ template <int dim, int spacedim>
 double
 GridTools::diameter (const Triangulation<dim, spacedim> &tria)
 {
-  Assert ((dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim>*>(&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<dim,spacedim> *p_tria
+      = dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim>*>(&tria))
+    Assert (p_tria->n_global_active_cells() == tria.n_cells(0),
+           ExcNotImplemented());
+#endif
 
                                   // the algorithm used simply
                                   // traverses all cells and picks

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.