From: Simon Puchert Date: Thu, 7 Dec 2017 15:42:37 +0000 (+0100) Subject: Small optimization. X-Git-Tag: v9.0.0-rc1~626^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=940e27224b63e30f5c851f788d89040604239c9a;p=dealii.git Small optimization. We can get rid of a scalar*vector operation by restructuring. This also allows tricks like computing theta/sin(theta) directly from cos(theta) and thus bypassing the atan2 operation. --- diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index 3bd2c3c25a..ff3b239193 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -697,7 +697,8 @@ namespace if (std::abs(weights[i])>1.e-15) { vPerp = internal::projected_direction(directions[i], candidate); - const double sintheta = vPerp.norm(); + const double sinthetaSq = vPerp.norm_square(); + const double sintheta = std::sqrt(sinthetaSq); if (sintheta