]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Let GridTools::minimal/maximal_cell_diameter return global values 6104/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 26 Mar 2018 19:39:04 +0000 (21:39 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 26 Mar 2018 19:39:56 +0000 (21:39 +0200)
doc/news/changes/minor/20180325DanielArndt
include/deal.II/grid/grid_tools.h
source/grid/grid_tools.cc

index cacbfd088dff35cfdc97ce3b8b972bcb4dc38f3e..ff5ceb4ff866082b02a9c61e0be138cb8df657cf 100644 (file)
@@ -1,5 +1,5 @@
 Fixed: GridTools::minimal_cell_diameter() and GridTools::maximal_cell_diameter()
-return the maximal respectively minimal cell diameter of the non-artifical part
-of a Triangulation object.
+return the maximal respectively minimal cell diameter over the whole mesh for
+parallel::distributed::Triangulation object, too.
 <br>
 (Daniel Arndt, 2018/03/25)
index c72ffa5cfbbdb0e5d1ba20632d48f46b4f2c5ebf..38807c8455da8ae620b7e3fd8bd5e18e1793f01a 100644 (file)
@@ -154,16 +154,15 @@ namespace GridTools
                  const Mapping<dim,spacedim> &mapping = (StaticMappingQ1<dim,spacedim>::mapping));
 
   /**
-   * Return the diameter of the smallest active cell of the non-artificial part
-   * of a triangulation. See step-24 for an example of use of this function.
+   * Return the diameter of the smallest active cell of a triangulation. See
+   * step-24 for an example of use of this function.
    */
   template <int dim, int spacedim>
   double
   minimal_cell_diameter (const Triangulation<dim, spacedim> &triangulation);
 
   /**
-   * Return the diameter of the largest active cell of the non-artificial part
-   * of a triangulation.
+   * Return the diameter of the largest active cell of a triangulation.
    */
   template <int dim, int spacedim>
   double
index 23ef95321d1f6d054f4d709027b15d2f781ebf59..d54431ac8fa6af534b6092308790924ec9d23d75 100644 (file)
@@ -2712,7 +2712,18 @@ next_cell:
       if (!cell->is_artificial())
         min_diameter = std::min (min_diameter,
                                  cell->diameter());
-    return min_diameter;
+
+    double global_min_diameter = 0;
+
+#ifdef DEAL_II_WITH_MPI
+    if (const parallel::Triangulation<dim,spacedim> *p_tria
+        = dynamic_cast<const parallel::Triangulation<dim,spacedim>*>(&triangulation))
+      global_min_diameter = Utilities::MPI::min (min_diameter, p_tria->get_communicator());
+    else
+#endif
+      global_min_diameter = min_diameter;
+
+    return global_min_diameter;
   }
 
 
@@ -2726,7 +2737,18 @@ next_cell:
       if (!cell->is_artificial())
         max_diameter = std::max (max_diameter,
                                  cell->diameter());
-    return max_diameter;
+
+    double global_max_diameter = 0;
+
+#ifdef DEAL_II_WITH_MPI
+    if (const parallel::Triangulation<dim,spacedim> *p_tria
+        = dynamic_cast<const parallel::Triangulation<dim,spacedim>*>(&triangulation))
+      global_max_diameter = Utilities::MPI::max (max_diameter, p_tria->get_communicator());
+    else
+#endif
+      global_max_diameter = max_diameter;
+
+    return global_max_diameter;
   }
 
 

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.