From: Wolfgang Bangerth Date: Thu, 5 Feb 2015 03:33:38 +0000 (-0600) Subject: Fix up places where we use Point for directions when we should be X-Git-Tag: v8.3.0-rc1~494^2~8 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce7d38f6ff7e1919fe8317945ac08af729b9ee26;p=dealii.git Fix up places where we use Point for directions when we should be using Tensor<1,dim>. --- diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 621ba6bd44..1ece3ad6ab 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -1998,15 +1998,15 @@ TriaAccessor::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::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::max(); for (unsigned int i=0; i::vertices_per_cell; ++i) for (unsigned int j=i+1; j::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: