From: David Wells Date: Tue, 3 Jan 2017 17:03:32 +0000 (-0500) Subject: Mark some functions as static. X-Git-Tag: v8.5.0-rc1~295^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=286a45158e6d6ae04c277af82ea05babb6ef6443;p=dealii.git Mark some functions as static. This was caught by cppcheck: these methods don't depend on state and may as well be static. --- diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index 79f66cac53..6a2acf99ec 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -804,7 +804,7 @@ private: (range_1.end == range_2.end)); } - std::size_t memory_consumption () const + static std::size_t memory_consumption () { return sizeof(Range); } diff --git a/include/deal.II/base/quadrature_lib.h b/include/deal.II/base/quadrature_lib.h index d9c879223d..38b25cfd7f 100644 --- a/include/deal.II/base/quadrature_lib.h +++ b/include/deal.II/base/quadrature_lib.h @@ -121,7 +121,7 @@ protected: * Evaluate the Gamma function $ \Gamma(n) = (n-1)! $. * @param n point of evaluation (integer). */ - long double gamma(const unsigned int n) const; + static long double gamma(const unsigned int n); }; @@ -228,14 +228,16 @@ private: /** * Compute the points of the quadrature formula. */ + static std::vector - get_quadrature_points(const unsigned int n) const; + get_quadrature_points(const unsigned int n); /** * Compute the weights of the quadrature formula. */ + static std::vector - get_quadrature_weights(const unsigned int n) const; + get_quadrature_weights(const unsigned int n); }; @@ -666,10 +668,10 @@ long double QGaussLobatto<1>:: JacobiP(const long double, const int, const int, const unsigned int) const; template <> long double -QGaussLobatto<1>::gamma(const unsigned int n) const; +QGaussLobatto<1>::gamma(const unsigned int n); -template <> std::vector QGaussLog<1>::get_quadrature_points(const unsigned int) const; -template <> std::vector QGaussLog<1>::get_quadrature_weights(const unsigned int) const; +template <> std::vector QGaussLog<1>::get_quadrature_points(const unsigned int); +template <> std::vector QGaussLog<1>::get_quadrature_weights(const unsigned int); template <> QMidpoint<1>::QMidpoint (); template <> QTrapez<1>::QTrapez (); diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index 8ee0ac7652..19d292f61e 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -321,7 +321,7 @@ long double QGaussLobatto<1>::JacobiP(const long double x, template <> -long double QGaussLobatto<1>::gamma(const unsigned int n) const +long double QGaussLobatto<1>::gamma(const unsigned int n) { long double result = n - 1; for (int i=n-2; i>1; --i) @@ -432,7 +432,7 @@ QGaussLog<1>::QGaussLog(const unsigned int n, template <> std::vector -QGaussLog<1>::get_quadrature_points(const unsigned int n) const +QGaussLog<1>::get_quadrature_points(const unsigned int n) { std::vector q_points(n); @@ -565,7 +565,7 @@ QGaussLog<1>::get_quadrature_points(const unsigned int n) const template <> std::vector -QGaussLog<1>::get_quadrature_weights(const unsigned int n) const +QGaussLog<1>::get_quadrature_weights(const unsigned int n) { std::vector quadrature_weights(n);