]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix up places where we use Point<dim> for directions when we should be
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 5 Feb 2015 03:33:38 +0000 (21:33 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 5 Feb 2015 03:33:38 +0000 (21:33 -0600)
using Tensor<1,dim>.

include/deal.II/grid/tria_accessor.templates.h

index 621ba6bd449539355e5bc9600d36cda946d15935..1ece3ad6ab7cf96f6f00cb3bf9d48abd8fdee022 100644 (file)
@@ -1998,15 +1998,15 @@ TriaAccessor<structdim, dim, spacedim>::diameter () const
   switch (structdim)
     {
     case 1:
-      return std::sqrt((this->vertex(1)-this->vertex(0)).square());
+      return (this->vertex(1)-this->vertex(0)).norm();
     case 2:
-      return std::sqrt(std::max((this->vertex(3)-this->vertex(0)).square(),
-                                (this->vertex(2)-this->vertex(1)).square()));
+      return std::max((this->vertex(3)-this->vertex(0)).norm(),
+                      (this->vertex(2)-this->vertex(1)).norm());
     case 3:
-      return std::sqrt(std::max( std::max((this->vertex(7)-this->vertex(0)).square(),
-                                          (this->vertex(6)-this->vertex(1)).square()),
-                                 std::max((this->vertex(2)-this->vertex(5)).square(),
-                                          (this->vertex(3)-this->vertex(4)).square()) ));
+      return std::max( std::max((this->vertex(7)-this->vertex(0)).norm(),
+                                (this->vertex(6)-this->vertex(1)).norm()),
+                       std::max((this->vertex(2)-this->vertex(5)).norm(),
+                                (this->vertex(3)-this->vertex(4)).norm()) );
     default:
       Assert (false, ExcNotImplemented());
       return -1e10;
@@ -2022,14 +2022,14 @@ TriaAccessor<structdim, dim, spacedim>::minimum_vertex_distance () const
   switch (structdim)
     {
     case 1:
-      return std::sqrt((this->vertex(1)-this->vertex(0)).square());
+      return (this->vertex(1)-this->vertex(0)).norm();
     case 2:
     case 3:
     {
       double min = std::numeric_limits<double>::max();
       for (unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
         for (unsigned int j=i+1; j<GeometryInfo<structdim>::vertices_per_cell; ++j)
-          min = std::min(min, (this->vertex(i)-this->vertex(j)).square());
+          min = std::min(min, (this->vertex(i)-this->vertex(j)) * (this->vertex(i)-this->vertex(j)));
       return std::sqrt(min);
     }
     default:

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.