From ad55b0410f64e1305bf57621e24a5bdd5f3cd356 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 28 Feb 2016 12:06:45 -0600 Subject: [PATCH] Simplify the implementation of a function. In particular, write an assertion with less code. Also remove some alias variables. --- source/grid/manifold.cc | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index 57a8a5250f..0a758164b1 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -51,21 +51,14 @@ Point Manifold:: get_new_point (const Quadrature &quad) const { - const std::vector > &surrounding_points = quad.get_points(); - const std::vector &weights = quad.get_weights(); - Point p; + Assert(std::abs(std::accumulate(quad.get_weights().begin(), quad.get_weights().end(), 0.0)-1.0) < 1e-10, + ExcMessage("The weights for the individual points should sum to 1!")); -#ifdef DEBUG - double sum=0; - for (unsigned int i=0; i p; + for (unsigned int i=0; i FlatManifold:: get_new_point (const Quadrature &quad) const { + Assert(std::abs(std::accumulate(quad.get_weights().begin(), quad.get_weights().end(), 0.0)-1.0) < 1e-10, + ExcMessage("The weights for the individual points should sum to 1!")); + const std::vector > &surrounding_points = quad.get_points(); const std::vector &weights = quad.get_weights(); -#ifdef DEBUG - double sum=0; - for (unsigned int i=0; i p; Point dp; Point minP = periodicity; -- 2.39.5