]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Minimal and maximal cell diameters.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 10 Sep 2006 01:44:28 +0000 (01:44 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 10 Sep 2006 01:44:28 +0000 (01:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@13879 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/grid_tools.h
deal.II/deal.II/source/grid/grid_tools.cc

index 66b70f078d57bb15952984dac0b7ae74d9b61267..1075b308b77a45bb373948148fd768b9b11f2469 100644 (file)
@@ -509,7 +509,27 @@ class GridTools
     bool
     have_same_coarse_mesh (const Container &mesh_1,
                            const Container &mesh_2);
-      
+
+                                    /**
+                                     * Return the diamater of the smallest
+                                     * active cell of a triangulation. See
+                                     * @ref step_24 "step-24" for an example
+                                     * of use of this function.
+                                     */
+    template <int dim>
+    static
+    double
+    minimal_cell_diameter (const Triangulation<dim> &triangulation);
+
+                                    /**
+                                     * Return the diamater of the largest
+                                     * active cell of a triangulation.
+                                     */
+    template <int dim>
+    static
+    double
+    maximal_cell_diameter (const Triangulation<dim> &triangulation);
+    
                                      /**
                                       * Exception
                                       */
index b6c9664e2cdb4182af247b172947b7c21a0ad276..2e65959efb0f25a6eaec94a1cdc15828d39edeaa 100644 (file)
@@ -870,6 +870,36 @@ GridTools::have_same_coarse_mesh (const Container &mesh_1,
 
 
 
+template <int dim>
+double
+GridTools::minimal_cell_diameter (const Triangulation<dim> &triangulation)
+{
+  double min_diameter = triangulation.begin_active()->diameter();
+  for (typename Triangulation<dim>::active_cell_iterator
+        cell = triangulation.begin_active(); cell != triangulation.end();
+       ++cell)
+    min_diameter = std::min (min_diameter,
+                            cell->diameter());
+  return min_diameter;
+}
+
+
+
+template <int dim>
+double
+GridTools::maximal_cell_diameter (const Triangulation<dim> &triangulation)
+{
+  double max_diameter = triangulation.begin_active()->diameter();
+  for (typename Triangulation<dim>::active_cell_iterator
+        cell = triangulation.begin_active(); cell != triangulation.end();
+       ++cell)
+    max_diameter = std::max (max_diameter,
+                            cell->diameter());
+  return max_diameter;
+}
+
+
+
 
 // explicit instantiations
 
@@ -1042,3 +1072,11 @@ template
 bool
 GridTools::have_same_coarse_mesh (const MGDoFHandler<deal_II_dimension> &mesh_1,
                                   const MGDoFHandler<deal_II_dimension> &mesh_2);
+
+template
+double
+GridTools::minimal_cell_diameter (const Triangulation<deal_II_dimension> &triangulation);
+
+template
+double
+GridTools::maximal_cell_diameter (const Triangulation<deal_II_dimension> &triangulation);

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.