* degree of polynomials integrated exactly. This number is given in
* the documentation of each formula. The order of the integration
* error is <tt>m+1</tt>, that is, the error is the size of the cell
- * two the <tt>m+1</tt> by the Bramble-Hilbert Lemma. The number
+ * to the <tt>m+1</tt> by the Bramble-Hilbert Lemma. The number
* <tt>m</tt> 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
* number by a template expression where
* both the number <code>a</code> and the
* power <code>N</code> 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
- * <code>fixed_int_power@<a,N@>::value</code>.
+ * Use this function with the arguments
+ * <code>fixed_int_power@<5,2@>::value</code>
+ * to compute 5<sup>2</sup>.
*/
template <int a, int N>
struct fixed_int_power
#include <deal.II/base/quadrature.h>
#include <deal.II/base/qprojector.h>
#include <deal.II/base/memory_consumption.h>
+#include <deal.II/base/utilities.h>
#include <cmath>
#include <cstdlib>
DEAL_II_NAMESPACE_OPEN
-namespace
-{
-/**
- * Integer to the power of dim
- */
- template <int dim>
- inline unsigned int dimpow (unsigned int n)
- {
- unsigned int result = n;
- for (unsigned int i=1;i<dim;++i)
- result *= n;
- return result;
- }
-}
-
-
template <>
Quadrature<0>::Quadrature (const unsigned int n_q)
:
Quadrature<dim>::Quadrature (const Quadrature<dim != 1 ? 1 : 0> &q)
:
Subscriptor(),
- quadrature_points (dimpow<dim>(q.size())),
- weights (dimpow<dim>(q.size()))
+ quadrature_points (Utilities::fixed_power<dim>(q.size())),
+ weights (Utilities::fixed_power<dim>(q.size()))
{
Assert (dim <= 3, ExcNotImplemented());