]> https://gitweb.dealii.org/ - dealii.git/commitdiff
More minor updates. 8923/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 18 Oct 2019 05:49:27 +0000 (23:49 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 18 Oct 2019 05:49:27 +0000 (23:49 -0600)
source/grid/grid_tools.cc

index b824ba319290282840f8ed470ff5bca2075c9c0b..efad61ecbd63cb42b6e80bbc1c44c8d96bacfb21 100644 (file)
@@ -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<double> J = LAPACKFullMatrix<double>(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<double> J = LAPACKFullMatrix<double>(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 <int dim>
   double
   compute_maximum_aspect_ratio(const Triangulation<dim> &triangulation,
@@ -489,6 +496,7 @@ namespace GridTools
   }
 
 
+
   template <int dim, int spacedim>
   BoundingBox<spacedim>
   compute_bounding_box(const Triangulation<dim, spacedim> &tria)

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.