From b7790df55ea42056509ec297b4b6e2f8a59258ab Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 27 Jan 2018 13:24:47 -0500 Subject: [PATCH] Reduce the scope of some variables. This was found by cppcheck. --- include/deal.II/lac/utilities.h | 7 ++----- source/base/quadrature_lib.cc | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/deal.II/lac/utilities.h b/include/deal.II/lac/utilities.h index f7689437ea..1b0496e652 100644 --- a/include/deal.II/lac/utilities.h +++ b/include/deal.II/lac/utilities.h @@ -328,12 +328,9 @@ namespace Utilities std::vector diagonal; std::vector subdiagonal; - // scalars to store norms and inner products - double a = 0, b = 0; - // 1. Normalize input vector (*v) = v0_; - a = v->l2_norm(); + double a = v->l2_norm(); Assert (a!=0, ExcDivideByZero()); (*v) *= 1./a; @@ -347,7 +344,7 @@ namespace Utilities for (unsigned int i = 1; i < k; ++i) { // 4. L2 norm of f - b = f->l2_norm(); + const double b = f->l2_norm(); Assert (b!=0, ExcDivideByZero()); // 5. v0 <- v; v <- f/b *v0 = *v; diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index 37eaf86d26..48be55bfff 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -268,7 +268,6 @@ compute_quadrature_weights(const std::vector &x, { const unsigned int q = x.size(); std::vector w(q); - long double s = 0.L; const long double factor = std::pow(2., alpha+beta+1) * gamma(alpha+q) * @@ -276,7 +275,7 @@ compute_quadrature_weights(const std::vector &x, ((q-1)*gamma(q)*gamma(alpha+beta+q+1)); for (unsigned int i=0; i