From: Wolfgang Bangerth Date: Sun, 28 Feb 2016 18:06:45 +0000 (-0600) Subject: Simplify the implementation of a function. X-Git-Tag: v8.5.0-rc1~1269^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad55b0410f64e1305bf57621e24a5bdd5f3cd356;p=dealii.git Simplify the implementation of a function. In particular, write an assertion with less code. Also remove some alias variables. --- 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;