From b9af8fdae4818c08a971f3a8e0f74f751fcccf56 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 17 Oct 2019 23:49:27 -0600 Subject: [PATCH] More minor updates. --- source/grid/grid_tools.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index b824ba3192..efad61ecbd 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -438,14 +438,9 @@ namespace GridTools // loop over quadrature points for (unsigned int q = 0; q < quadrature.size(); ++q) { - Tensor<2, dim, double> jacobian = + const Tensor<2, dim, double> jacobian = Tensor<2, dim, double>(fe_values.jacobian(q)); - LAPACKFullMatrix J = LAPACKFullMatrix(dim); - for (unsigned int i = 0; i < dim; i++) - for (unsigned int j = 0; j < dim; j++) - J(i, j) = jacobian[i][j]; - // We intentionally do not want to throw an exception in case of // inverted elements since this is not the task of this // function. Instead, inf is written into the vector in case of @@ -456,12 +451,22 @@ namespace GridTools } else { + LAPACKFullMatrix J = LAPACKFullMatrix(dim); + for (unsigned int i = 0; i < dim; i++) + for (unsigned int j = 0; j < dim; j++) + J(i, j) = jacobian[i][j]; + J.compute_svd(); double const max_sv = J.singular_value(0); double const min_sv = J.singular_value(dim - 1); double const ar = max_sv / min_sv; + // Take the max between the previous and the current + // aspect ratio value; if we had previously encountered + // an inverted cell, we will have placed an infinity + // in the aspect_ratio_cell variable, and that value + // will survive this max operation. aspect_ratio_cell = std::max(aspect_ratio_cell, ar); } } @@ -474,6 +479,8 @@ namespace GridTools return aspect_ratio_vector; } + + template double compute_maximum_aspect_ratio(const Triangulation &triangulation, @@ -489,6 +496,7 @@ namespace GridTools } + template BoundingBox compute_bounding_box(const Triangulation &tria) -- 2.39.5