From 2491f3b72886b694eeceab5a3f77ad216112d707 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sat, 17 Nov 2012 21:04:26 +0000 Subject: [PATCH] Use fixed_int_power instead of re-implementing it. git-svn-id: https://svn.dealii.org/trunk@27558 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/quadrature.h | 2 +- deal.II/include/deal.II/base/utilities.h | 12 +++++++----- deal.II/source/base/quadrature.cc | 21 +++------------------ 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/deal.II/include/deal.II/base/quadrature.h b/deal.II/include/deal.II/base/quadrature.h index 43384cdd1c..6d891868fe 100644 --- a/deal.II/include/deal.II/base/quadrature.h +++ b/deal.II/include/deal.II/base/quadrature.h @@ -52,7 +52,7 @@ DEAL_II_NAMESPACE_OPEN * degree of polynomials integrated exactly. This number is given in * the documentation of each formula. The order of the integration * error is m+1, that is, the error is the size of the cell - * two the m+1 by the Bramble-Hilbert Lemma. The number + * to the m+1 by the Bramble-Hilbert Lemma. The number * m is to be found in the documentation of each concrete * formula. For the optimal formulæ QGauss we have $m = 2N-1$, where * N is the constructor parameter to QGauss. The tensor product diff --git a/deal.II/include/deal.II/base/utilities.h b/deal.II/include/deal.II/base/utilities.h index 8bd5a226a9..7d1b02b985 100644 --- a/deal.II/include/deal.II/base/utilities.h +++ b/deal.II/include/deal.II/base/utilities.h @@ -193,12 +193,14 @@ namespace Utilities * number by a template expression where * both the number a and the * power N are compile-time - * constants. This gives compile-time - * knowledge of the result of the power - * operation. + * constants. This computes the result of + * the power operation at compile time, + * enables its use e.g. in other + * templates. * - * Use this function as in - * fixed_int_power@::value. + * Use this function with the arguments + * fixed_int_power@<5,2@>::value + * to compute 52. */ template struct fixed_int_power diff --git a/deal.II/source/base/quadrature.cc b/deal.II/source/base/quadrature.cc index 29f23cb939..928d6b3b68 100644 --- a/deal.II/source/base/quadrature.cc +++ b/deal.II/source/base/quadrature.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -24,22 +25,6 @@ DEAL_II_NAMESPACE_OPEN -namespace -{ -/** - * Integer to the power of dim - */ - template - inline unsigned int dimpow (unsigned int n) - { - unsigned int result = n; - for (unsigned int i=1;i Quadrature<0>::Quadrature (const unsigned int n_q) : @@ -222,8 +207,8 @@ template Quadrature::Quadrature (const Quadrature &q) : Subscriptor(), - quadrature_points (dimpow(q.size())), - weights (dimpow(q.size())) + quadrature_points (Utilities::fixed_power(q.size())), + weights (Utilities::fixed_power(q.size())) { Assert (dim <= 3, ExcNotImplemented()); -- 2.39.5