]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace x_to_the_dim by Utilities::fixed_power
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 9 Jan 2013 08:29:00 +0000 (08:29 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 9 Jan 2013 08:29:00 +0000 (08:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@27993 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/tensor_product_polynomials.h
deal.II/include/deal.II/base/tensor_product_polynomials_const.h

index 38dd584d1ff6c4f841941504b8a972d87652295b..972f0ab0dd6814b755b0162d5ed9e597fab88136 100644 (file)
@@ -18,6 +18,7 @@
 #include <deal.II/base/tensor.h>
 #include <deal.II/base/point.h>
 #include <deal.II/base/polynomial.h>
+#include <deal.II/base/utilities.h>
 
 #include <vector>
 
@@ -266,15 +267,6 @@ private:
   // length arrays
   void compute_index (const unsigned int i,
                       unsigned int       (&indices)[(dim>0?dim:1)]) const;
-
-  /**
-   * Computes
-   * <i>x<sup>dim</sup></i> for
-   * unsigned int <i>x</i>. Used in
-   * the constructor.
-   */
-  static
-  unsigned int x_to_the_dim (const unsigned int x);
 };
 
 #ifndef DOXYGEN
@@ -521,19 +513,6 @@ TensorProductPolynomials<3>::compute_index(const unsigned int n,
 
 /* ---------------- template and inline functions ---------- */
 
-template <int dim>
-inline
-unsigned int
-TensorProductPolynomials<dim>::
-x_to_the_dim (const unsigned int x)
-{
-  unsigned int y = 1;
-  for (int d=0; d<dim; ++d)
-    y *= x;
-  return y;
-}
-
-
 
 template <int dim>
 template <class Pol>
@@ -541,7 +520,7 @@ TensorProductPolynomials<dim>::
 TensorProductPolynomials(const std::vector<Pol> &pols)
   :
   polynomials (pols.begin(), pols.end()),
-  n_tensor_pols(x_to_the_dim(pols.size())),
+  n_tensor_pols(Utilities::fixed_power<dim>(pols.size())),
   index_map(n_tensor_pols),
   index_map_inverse(n_tensor_pols)
 {
index aea67d896e27183320af972c2cbe85d605a795e3..8e3dcbeab5f6a60dca1d6266e134f0dbfeab6ae8 100644 (file)
@@ -18,6 +18,7 @@
 #include <deal.II/base/tensor.h>
 #include <deal.II/base/point.h>
 #include <deal.II/base/polynomial.h>
+#include <deal.II/base/utilities.h>
 
 #include <vector>
 
@@ -268,15 +269,6 @@ private:
   // length arrays
   void compute_index (const unsigned int i,
                       unsigned int       (&indices)[(dim>0?dim:1)]) const;
-
-  /**
-   * Computes
-   * <i>x<sup>dim</sup></i> for
-   * unsigned int <i>x</i>. Used in
-   * the constructor.
-   */
-  static
-  unsigned int x_to_the_dim (const unsigned int x);
 };
 
 #ifndef DOXYGEN
@@ -321,27 +313,13 @@ TensorProductPolynomialsConst<3>::compute_index(const unsigned int n,
 
 /* ---------------- template and inline functions ---------- */
 
-template <int dim>
-inline
-unsigned int
-TensorProductPolynomialsConst<dim>::
-x_to_the_dim (const unsigned int x)
-{
-  unsigned int y = 1;
-  for (int d=0; d<dim; ++d)
-    y *= x;
-  return y;
-}
-
-
-
 template <int dim>
 template <class Pol>
 TensorProductPolynomialsConst<dim>::
 TensorProductPolynomialsConst(const std::vector<Pol> &pols)
   :
   polynomials (pols.begin(), pols.end()),
-  n_tensor_pols(x_to_the_dim(pols.size())+1),
+  n_tensor_pols(Utilities::fixed_power<dim>(pols.size())+1),
   index_map(n_tensor_pols),
   index_map_inverse(n_tensor_pols)
 {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.