From a18c40988142b727dda27851363e1efb2d991869 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Fri, 2 Dec 2016 17:44:29 -0700 Subject: [PATCH] Optimize SphericalManifold::get_new_point() --- source/grid/manifold_lib.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index 431cbe8d66..ef7e48ec69 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -275,13 +275,17 @@ SphericalManifold:: get_new_point (const std::vector > &vertices, const std::vector &weights) const { + const unsigned int n_points = vertices.size(); + double rho = 0.0; Tensor<1,spacedim> candidate; - for (unsigned int i = 0; i direction (vertices[i]-center); + rho += direction.norm()*weights[i]; + candidate += direction*weights[i]; } + // Unit norm direction. candidate /= candidate.norm(); -- 2.39.5