From 3f82f1b4ea051ade2fd3eccf99bfad79352c3a71 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Mon, 23 Apr 2018 20:01:54 +0200 Subject: [PATCH] Fixed issues by TH and WB. --- include/deal.II/grid/grid_tools.h | 19 ++++++++++++++++--- source/grid/grid_tools.cc | 2 +- tests/grid/grid_tools_min_max_diameter_01.cc | 3 +++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 1ce036b808..9b3119e1d2 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -153,8 +153,14 @@ namespace GridTools const Mapping &mapping = (StaticMappingQ1::mapping)); /** - * Return the diameter of the smallest active cell of a triangulation. See - * step-24 for an example of use of this function. + * Return an approximation of the diameter of the smallest active cell of a + * triangulation. See step-24 for an example of use of this function. + * + * Notice that, even if you pass a non-trivial mapping, the returned value is + * computed only using information on the vertices of the triangulation, + * possibly transformed by the mapping. While this is accurate most of the + * times, it may fail to give the correct result when the triangulation + * contains very distorted cells. */ template double @@ -162,7 +168,14 @@ namespace GridTools const Mapping &mapping = (StaticMappingQ1::mapping)); /** - * Return the diameter of the largest active cell of a triangulation. + * Return an approximation of the diameter of the largest active cell of a + * triangulation. + * + * Notice that, even if you pass a non-trivial mapping to this function, the + * returned value is computed only using information on the vertices of the + * triangulation, possibly transformed by the mapping. While this is accurate + * most of the times, it may fail to give the correct result when the + * triangulation contains very distorted cells. */ template double diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index ed6e97e30a..e244e2b21d 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -2776,7 +2776,7 @@ next_cell: double diameter(const typename Triangulation::cell_iterator &cell, const Mapping &mapping) { - auto vertices = mapping.get_vertices(cell); + const auto vertices = mapping.get_vertices(cell); switch (dim) { case 1: diff --git a/tests/grid/grid_tools_min_max_diameter_01.cc b/tests/grid/grid_tools_min_max_diameter_01.cc index 5cfbdfb8ec..ecf3deb2a7 100644 --- a/tests/grid/grid_tools_min_max_diameter_01.cc +++ b/tests/grid/grid_tools_min_max_diameter_01.cc @@ -13,6 +13,8 @@ // // --------------------------------------------------------------------- +// test GridTools::minimal_cell_diameter and GridTools::maximal_cell_diameter with a mapping + #include "../tests.h" #include #include @@ -40,6 +42,7 @@ #define PRECISION 2 + template void test(const unsigned int degree) { -- 2.39.5