]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove PolynomialType template argument from FE_Poly
authorgrahambenharper <grahambenharper@gmail.com>
Sat, 7 Sep 2019 23:49:59 +0000 (17:49 -0600)
committerGraham Harper <grahambenharper@gmail.com>
Wed, 6 May 2020 20:04:36 +0000 (14:04 -0600)
26 files changed:
include/deal.II/base/polynomial_space.h
include/deal.II/base/polynomials_adini.h
include/deal.II/base/polynomials_rannacher_turek.h
include/deal.II/base/scalar_polynomials_base.h
include/deal.II/base/tensor_product_polynomials.h
include/deal.II/base/tensor_product_polynomials_bubbles.h
include/deal.II/base/tensor_product_polynomials_const.h
include/deal.II/fe/fe_dgp.h
include/deal.II/fe/fe_dgp_monomial.h
include/deal.II/fe/fe_dgq.h
include/deal.II/fe/fe_poly.h
include/deal.II/fe/fe_poly.templates.h
include/deal.II/fe/fe_q_base.h
include/deal.II/fe/fe_q_hierarchical.h
include/deal.II/fe/fe_rannacher_turek.h
include/deal.II/matrix_free/matrix_free.templates.h
include/deal.II/matrix_free/shape_info.templates.h
source/fe/fe_dgp.cc
source/fe/fe_dgp_monomial.cc
source/fe/fe_dgq.cc
source/fe/fe_poly.cc
source/fe/fe_poly.inst.in
source/fe/fe_q.cc
source/fe/fe_q_base.cc
source/fe/fe_q_hierarchical.cc
source/fe/fe_rannacher_turek.cc

index ed1a0a5cfd09d95818f1cc742a8d30cc24302762..4e050b6225c3bdfa265ecfd036a757fda14655c4 100644 (file)
@@ -157,7 +157,7 @@ public:
    * Consider using evaluate() instead.
    */
   double
-  compute_value(const unsigned int i, const Point<dim> &p) const;
+  compute_value(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the <tt>order</tt>th derivative of the <tt>i</tt>th polynomial
@@ -178,7 +178,7 @@ public:
    * Consider using evaluate() instead.
    */
   Tensor<1, dim>
-  compute_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the second derivative (grad_grad) of the <tt>i</tt>th polynomial
@@ -187,7 +187,7 @@ public:
    * Consider using evaluate() instead.
    */
   Tensor<2, dim>
-  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Return the number of polynomials spanning the space represented by this
index 4b9c0b6a06cdf2c37962210ab942a6bc6d5bff0e..64daffad89a0ee75628ffcb223e6cef9150361e0 100644 (file)
@@ -78,7 +78,7 @@ public:
    * Consider using evaluate() instead.
    */
   double
-  compute_value(const unsigned int i, const Point<dim> &p) const;
+  compute_value(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the gradient of the <tt>i</tt>th polynomial at
@@ -87,7 +87,7 @@ public:
    * Consider using evaluate() instead.
    */
   Tensor<1, dim>
-  compute_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the second derivative (grad_grad) of the <tt>i</tt>th polynomial
@@ -96,7 +96,7 @@ public:
    * Consider using evaluate() instead.
    */
   Tensor<2, dim>
-  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Return the name of the space, which is <tt>PolynomialsAdini</tt>.
index 0b56598ba130c9783f841d4fcb2623158f0fa908..4fb378458b4ea53b55e9027cf6901f9125a541ee 100644 (file)
@@ -58,7 +58,7 @@ public:
    * Value of basis function @p i at @p p.
    */
   double
-  compute_value(const unsigned int i, const Point<dim> &p) const;
+  compute_value(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * <tt>order</tt>-th of basis function @p i at @p p.
@@ -73,13 +73,13 @@ public:
    * Gradient of basis function @p i at @p p.
    */
   Tensor<1, dim>
-  compute_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Gradient of gradient of basis function @p i at @p p.
    */
   Tensor<2, dim>
-  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute values and derivatives of all basis functions at @p unit_point.
index 5b192a885cbc3ec80814c00db17cb145038baa45..dc702bbc06d2741d8c8396f0a8ee2f29787f4a96 100644 (file)
@@ -106,6 +106,64 @@ public:
            std::vector<Tensor<3, dim>> &third_derivatives,
            std::vector<Tensor<4, dim>> &fourth_derivatives) const = 0;
 
+  /**
+   * Compute the value of the <tt>i</tt>th polynomial at unit point
+   * <tt>p</tt>.
+   *
+   * Consider using compute() instead.
+   */
+  virtual double
+  compute_value(const unsigned int /*i*/, const Point<dim> & /*p*/) const
+  {
+    Assert(false, ExcNotImplemented());
+    return 0;
+  }
+
+  /**
+   * Compute the <tt>order</tt>th derivative of the <tt>i</tt>th polynomial
+   * at unit point <tt>p</tt>.
+   *
+   * Consider using compute() instead.
+   *
+   * @tparam order The order of the derivative.
+   */
+  template <int order>
+  Tensor<order, dim>
+  compute_derivative(const unsigned int /*i*/, const Point<dim> & /*p*/) const
+  {
+    Assert(false, ExcNotImplemented());
+    Tensor<order, dim> empty;
+    return empty;
+  }
+
+  /**
+   * Compute the gradient of the <tt>i</tt>th polynomial at unit point
+   * <tt>p</tt>.
+   *
+   * Consider using compute() instead.
+   */
+  virtual Tensor<1, dim>
+  compute_grad(const unsigned int /*i*/, const Point<dim> & /*p*/) const
+  {
+    Assert(false, ExcNotImplemented());
+    Tensor<1, dim> empty;
+    return empty;
+  }
+
+  /**
+   * Compute the second derivative (grad_grad) of the <tt>i</tt>th polynomial
+   * at unit point <tt>p</tt>.
+   *
+   * Consider using compute() instead.
+   */
+  virtual Tensor<2, dim>
+  compute_grad_grad(const unsigned int /*i*/, const Point<dim> & /*p*/) const
+  {
+    Assert(false, ExcNotImplemented());
+    Tensor<2, dim> empty;
+    return empty;
+  }
+
   /**
    * Return the number of polynomials.
    */
index c6bec0062d24d04d293e7d7cbfbe3298a6597aaf..e024553d6934c584718328299ba9b93332533b69 100644 (file)
@@ -147,7 +147,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   double
-  compute_value(const unsigned int i, const Point<dim> &p) const;
+  compute_value(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the <tt>order</tt>th derivative of the <tt>i</tt>th tensor
@@ -180,7 +180,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   Tensor<1, dim>
-  compute_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the second derivative (grad_grad) of the <tt>i</tt>th tensor
@@ -195,7 +195,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   Tensor<2, dim>
-  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Return the name of the space, which is <tt>TensorProductPolynomials</tt>.
@@ -340,7 +340,7 @@ public:
    * tensor polynomials all at once and in a much more efficient way.
    */
   double
-  compute_value(const unsigned int i, const Point<dim> &p) const;
+  compute_value(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the <tt>order</tt>th derivative of the <tt>i</tt>th tensor
@@ -373,7 +373,7 @@ public:
    * tensor polynomials all at once and in a much more efficient way.
    */
   Tensor<1, dim>
-  compute_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the second derivative (grad_grad) of the <tt>i</tt>th tensor
@@ -388,7 +388,7 @@ public:
    * all tensor polynomials all at once and in a much more efficient way.
    */
   Tensor<2, dim>
-  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Return the name of the space, which is <tt>AnisotropicPolynomials</tt>.
index 1bfcaaf4d4f8f6b4d8e2982f3e70199fbf510335..0e8d28823f03a32182ef1cca99ecd0d27b2e5c50 100644 (file)
@@ -120,7 +120,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   double
-  compute_value(const unsigned int i, const Point<dim> &p) const;
+  compute_value(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the order @p order derivative of the <tt>i</tt>th tensor product
@@ -151,7 +151,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   Tensor<1, dim>
-  compute_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the second derivative (grad_grad) of the <tt>i</tt>th tensor
@@ -166,7 +166,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   Tensor<2, dim>
-  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Return the number of tensor product polynomials plus the bubble
index dc069adef485ef06b79113bc1357ad34c38d00dc..0c75e2f59c16fd5839c00be0cec893a81933ff85 100644 (file)
@@ -121,7 +121,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   double
-  compute_value(const unsigned int i, const Point<dim> &p) const;
+  compute_value(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the <tt>order</tt>th derivative of the <tt>i</tt>th tensor
@@ -154,7 +154,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   Tensor<1, dim>
-  compute_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Compute the second derivative (grad_grad) of the <tt>i</tt>th tensor
@@ -169,7 +169,7 @@ public:
    * polynomials all at once and in a much more efficient way.
    */
   Tensor<2, dim>
-  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
+  compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
 
   /**
    * Return the number of tensor product polynomials plus the constant
index 355252111ad12d0d89cdeb721bc07fcebcd5fe2a..dcfbac266cbed4b7335d8ca3425217d7c71fb38c 100644 (file)
@@ -308,7 +308,7 @@ DEAL_II_NAMESPACE_OPEN
  * @author Guido Kanschat, 2001, 2002, Ralf Hartmann 2004
  */
 template <int dim, int spacedim = dim>
-class FE_DGP : public FE_Poly<PolynomialSpace<dim>, dim, spacedim>
+class FE_DGP : public FE_Poly<dim, spacedim>
 {
 public:
   /**
index 16dffa8ed892c86a868715e119d8d892a45f3492..fca49e7da94dc7d78ae4ceaa0e2e46131a1abe30 100644 (file)
@@ -283,7 +283,7 @@ DEAL_II_NAMESPACE_OPEN
  * @author Ralf Hartmann, 2004
  */
 template <int dim>
-class FE_DGPMonomial : public FE_Poly<PolynomialsP<dim>, dim>
+class FE_DGPMonomial : public FE_Poly<dim>
 {
 public:
   /**
index 26705d2c3c4691303f0b548c2d063a9d1374b7da..2c9a697e4440ac8401bad15cc2d0b74c964f84f8 100644 (file)
@@ -109,7 +109,7 @@ class Quadrature;
  * @author Ralf Hartmann, Guido Kanschat 2001, 2004
  */
 template <int dim, int spacedim = dim>
-class FE_DGQ : public FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>
+class FE_DGQ : public FE_Poly<dim, spacedim>
 {
 public:
   /**
index 77efe6a4a57b4aa4bbfaf7e39889992941535aae..cfa174d72db61762f7e6adddefc97a4da2f475c5 100644 (file)
@@ -20,6 +20,7 @@
 #include <deal.II/base/config.h>
 
 #include <deal.II/base/quadrature.h>
+#include <deal.II/base/scalar_polynomials_base.h>
 #include <deal.II/base/std_cxx14/memory.h>
 
 #include <deal.II/fe/fe.h>
@@ -70,20 +71,23 @@ DEAL_II_NAMESPACE_OPEN
  * @author Ralf Hartmann 2004, Guido Kanschat, 2009
  */
 
-template <class PolynomialType,
-          int dim      = PolynomialType::dimension,
-          int spacedim = dim>
+template <int dim, int spacedim = dim>
 class FE_Poly : public FiniteElement<dim, spacedim>
 {
 public:
   /**
    * Constructor.
    */
-  FE_Poly(const PolynomialType &            poly_space,
+  FE_Poly(const ScalarPolynomialsBase<dim> &poly_space,
           const FiniteElementData<dim> &    fe_data,
           const std::vector<bool> &         restriction_is_additive_flags,
           const std::vector<ComponentMask> &nonzero_components);
 
+  /**
+   * Copy constructor.
+   */
+  FE_Poly(const FE_Poly &fe);
+
   /**
    * Return the polynomial degree of this finite element, i.e. the value
    * passed to the constructor.
@@ -311,12 +315,12 @@ protected:
                         update_3rd_derivatives))
       for (unsigned int i = 0; i < n_q_points; ++i)
         {
-          poly_space.evaluate(quadrature.point(i),
-                              values,
-                              grads,
-                              grad_grads,
-                              third_derivatives,
-                              fourth_derivatives);
+          poly_space->evaluate(quadrature.point(i),
+                               values,
+                               grads,
+                               grad_grads,
+                               third_derivatives,
+                               fourth_derivatives);
 
           // the values of shape functions at quadrature points don't change.
           // consequently, write these values right into the output array if
@@ -510,10 +514,9 @@ protected:
 
 
   /**
-   * The polynomial space. Its type is given by the template parameter
-   * PolynomialType.
+   * The polynomial space.
    */
-  PolynomialType poly_space;
+  const std::unique_ptr<ScalarPolynomialsBase<dim>> poly_space;
 };
 
 /*@}*/
index 3cea1551b1012d5ea6757b5182893f4cc838bdba..4285aeae0ae873c1c701001e4fbfedcb4c277f13 100644 (file)
 
 DEAL_II_NAMESPACE_OPEN
 
-template <class PolynomialType, int dim, int spacedim>
-FE_Poly<PolynomialType, dim, spacedim>::FE_Poly(
-  const PolynomialType &            poly_space,
+template <int dim, int spacedim>
+FE_Poly<dim, spacedim>::FE_Poly(
+  const ScalarPolynomialsBase<dim> &poly_space,
   const FiniteElementData<dim> &    fe_data,
   const std::vector<bool> &         restriction_is_additive_flags,
   const std::vector<ComponentMask> &nonzero_components)
   : FiniteElement<dim, spacedim>(fe_data,
                                  restriction_is_additive_flags,
                                  nonzero_components)
-  , poly_space(poly_space)
-{
-  AssertDimension(dim, PolynomialType::dimension);
-}
+  , poly_space(poly_space.clone())
+{}
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 unsigned int
-FE_Poly<PolynomialType, dim, spacedim>::get_degree() const
+FE_Poly<dim, spacedim>::get_degree() const
 {
   return this->degree;
 }
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 double
-FE_Poly<PolynomialType, dim, spacedim>::shape_value(const unsigned int i,
-                                                    const Point<dim> & p) const
+FE_Poly<dim, spacedim>::shape_value(const unsigned int i,
+                                    const Point<dim> & p) const
 {
   AssertIndexRange(i, this->dofs_per_cell);
-  return poly_space.compute_value(i, p);
+  return poly_space->compute_value(i, p);
 }
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 double
-FE_Poly<PolynomialType, dim, spacedim>::shape_value_component(
+FE_Poly<dim, spacedim>::shape_value_component(
   const unsigned int i,
   const Point<dim> & p,
   const unsigned int component) const
@@ -75,52 +73,50 @@ FE_Poly<PolynomialType, dim, spacedim>::shape_value_component(
   (void)component;
   AssertIndexRange(i, this->dofs_per_cell);
   AssertIndexRange(component, 1);
-  return poly_space.compute_value(i, p);
+  return poly_space->compute_value(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<1, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_grad(const unsigned int i,
-                                                   const Point<dim> & p) const
+FE_Poly<dim, spacedim>::shape_grad(const unsigned int i,
+                                   const Point<dim> & p) const
 {
   AssertIndexRange(i, this->dofs_per_cell);
-  return poly_space.template compute_derivative<1>(i, p);
+  return poly_space->template compute_derivative<1>(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<1, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_grad_component(
-  const unsigned int i,
-  const Point<dim> & p,
-  const unsigned int component) const
+FE_Poly<dim, spacedim>::shape_grad_component(const unsigned int i,
+                                             const Point<dim> & p,
+                                             const unsigned int component) const
 {
   (void)component;
   AssertIndexRange(i, this->dofs_per_cell);
   AssertIndexRange(component, 1);
-  return poly_space.template compute_derivative<1>(i, p);
+  return poly_space->template compute_derivative<1>(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<2, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_grad_grad(
-  const unsigned int i,
-  const Point<dim> & p) const
+FE_Poly<dim, spacedim>::shape_grad_grad(const unsigned int i,
+                                        const Point<dim> & p) const
 {
   AssertIndexRange(i, this->dofs_per_cell);
-  return poly_space.template compute_derivative<2>(i, p);
+  return poly_space->template compute_derivative<2>(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<2, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_grad_grad_component(
+FE_Poly<dim, spacedim>::shape_grad_grad_component(
   const unsigned int i,
   const Point<dim> & p,
   const unsigned int component) const
@@ -128,26 +124,25 @@ FE_Poly<PolynomialType, dim, spacedim>::shape_grad_grad_component(
   (void)component;
   AssertIndexRange(i, this->dofs_per_cell);
   AssertIndexRange(component, 1);
-  return poly_space.template compute_derivative<2>(i, p);
+  return poly_space->template compute_derivative<2>(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<3, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_3rd_derivative(
-  const unsigned int i,
-  const Point<dim> & p) const
+FE_Poly<dim, spacedim>::shape_3rd_derivative(const unsigned int i,
+                                             const Point<dim> & p) const
 {
   AssertIndexRange(i, this->dofs_per_cell);
-  return poly_space.template compute_derivative<3>(i, p);
+  return poly_space->template compute_derivative<3>(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<3, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_3rd_derivative_component(
+FE_Poly<dim, spacedim>::shape_3rd_derivative_component(
   const unsigned int i,
   const Point<dim> & p,
   const unsigned int component) const
@@ -155,26 +150,25 @@ FE_Poly<PolynomialType, dim, spacedim>::shape_3rd_derivative_component(
   (void)component;
   AssertIndexRange(i, this->dofs_per_cell);
   AssertIndexRange(component, 1);
-  return poly_space.template compute_derivative<3>(i, p);
+  return poly_space->template compute_derivative<3>(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<4, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_4th_derivative(
-  const unsigned int i,
-  const Point<dim> & p) const
+FE_Poly<dim, spacedim>::shape_4th_derivative(const unsigned int i,
+                                             const Point<dim> & p) const
 {
   AssertIndexRange(i, this->dofs_per_cell);
-  return poly_space.template compute_derivative<4>(i, p);
+  return poly_space->template compute_derivative<4>(i, p);
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 Tensor<4, dim>
-FE_Poly<PolynomialType, dim, spacedim>::shape_4th_derivative_component(
+FE_Poly<dim, spacedim>::shape_4th_derivative_component(
   const unsigned int i,
   const Point<dim> & p,
   const unsigned int component) const
@@ -182,7 +176,7 @@ FE_Poly<PolynomialType, dim, spacedim>::shape_4th_derivative_component(
   (void)component;
   AssertIndexRange(i, this->dofs_per_cell);
   AssertIndexRange(component, 1);
-  return poly_space.template compute_derivative<4>(i, p);
+  return poly_space->template compute_derivative<4>(i, p);
 }
 
 
@@ -192,10 +186,9 @@ FE_Poly<PolynomialType, dim, spacedim>::shape_4th_derivative_component(
 //---------------------------------------------------------------------------
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 UpdateFlags
-FE_Poly<PolynomialType, dim, spacedim>::requires_update_flags(
-  const UpdateFlags flags) const
+FE_Poly<dim, spacedim>::requires_update_flags(const UpdateFlags flags) const
 {
   UpdateFlags out = update_default;
 
@@ -264,9 +257,9 @@ higher_derivatives_need_correcting(
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 void
-FE_Poly<PolynomialType, dim, spacedim>::fill_fe_values(
+FE_Poly<dim, spacedim>::fill_fe_values(
   const typename Triangulation<dim, spacedim>::cell_iterator &,
   const CellSimilarity::Similarity                         cell_similarity,
   const Quadrature<dim> &                                  quadrature,
@@ -336,9 +329,9 @@ FE_Poly<PolynomialType, dim, spacedim>::fill_fe_values(
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 void
-FE_Poly<PolynomialType, dim, spacedim>::fill_fe_face_values(
+FE_Poly<dim, spacedim>::fill_fe_face_values(
   const typename Triangulation<dim, spacedim>::cell_iterator &cell,
   const unsigned int                                          face_no,
   const Quadrature<dim - 1> &                                 quadrature,
@@ -427,9 +420,9 @@ FE_Poly<PolynomialType, dim, spacedim>::fill_fe_face_values(
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 void
-FE_Poly<PolynomialType, dim, spacedim>::fill_fe_subface_values(
+FE_Poly<dim, spacedim>::fill_fe_subface_values(
   const typename Triangulation<dim, spacedim>::cell_iterator &cell,
   const unsigned int                                          face_no,
   const unsigned int                                          sub_no,
@@ -521,9 +514,9 @@ FE_Poly<PolynomialType, dim, spacedim>::fill_fe_subface_values(
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 inline void
-FE_Poly<PolynomialType, dim, spacedim>::correct_hessians(
+FE_Poly<dim, spacedim>::correct_hessians(
   internal::FEValuesImplementation::FiniteElementRelatedData<dim, spacedim>
     &output_data,
   const internal::FEValuesImplementation::MappingRelatedData<dim, spacedim>
@@ -540,9 +533,9 @@ FE_Poly<PolynomialType, dim, spacedim>::correct_hessians(
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 inline void
-FE_Poly<PolynomialType, dim, spacedim>::correct_third_derivatives(
+FE_Poly<dim, spacedim>::correct_third_derivatives(
   internal::FEValuesImplementation::FiniteElementRelatedData<dim, spacedim>
     &output_data,
   const internal::FEValuesImplementation::MappingRelatedData<dim, spacedim>
@@ -569,82 +562,62 @@ FE_Poly<PolynomialType, dim, spacedim>::correct_third_derivatives(
               }
 }
 
-namespace internal
-{
-  template <class PolynomialType>
-  inline std::vector<unsigned int>
-  get_poly_space_numbering(const PolynomialType &)
-  {
-    Assert(false, ExcNotImplemented());
-    return std::vector<unsigned int>();
-  }
-
-  template <class PolynomialType>
-  inline std::vector<unsigned int>
-  get_poly_space_numbering_inverse(const PolynomialType &)
-  {
-    Assert(false, ExcNotImplemented());
-    return std::vector<unsigned int>();
-  }
-
-  template <int dim, typename PolynomialType>
-  inline std::vector<unsigned int>
-  get_poly_space_numbering(
-    const TensorProductPolynomials<dim, PolynomialType> &poly)
-  {
-    return poly.get_numbering();
-  }
-
-  template <int dim, typename PolynomialType>
-  inline std::vector<unsigned int>
-  get_poly_space_numbering_inverse(
-    const TensorProductPolynomials<dim, PolynomialType> &poly)
-  {
-    return poly.get_numbering_inverse();
-  }
-
-  template <int dim>
-  inline std::vector<unsigned int>
-  get_poly_space_numbering(const TensorProductPolynomialsConst<dim> &poly)
-  {
-    return poly.get_numbering();
-  }
-
-  template <int dim>
-  inline std::vector<unsigned int>
-  get_poly_space_numbering_inverse(
-    const TensorProductPolynomialsConst<dim> &poly)
-  {
-    return poly.get_numbering_inverse();
-  }
-} // namespace internal
-
-
-
-template <class PolynomialType, int dim, int spacedim>
+
+
+template <int dim, int spacedim>
 std::vector<unsigned int>
-FE_Poly<PolynomialType, dim, spacedim>::get_poly_space_numbering() const
+FE_Poly<dim, spacedim>::get_poly_space_numbering() const
 {
-  return internal::get_poly_space_numbering(poly_space);
+  auto *const space_tensor_prod =
+    dynamic_cast<TensorProductPolynomials<dim, ScalarPolynomialsBase<dim>> *>(
+      this->poly_space.get());
+
+  if (space_tensor_prod != nullptr)
+    return space_tensor_prod->get_numbering();
+
+  auto *const space_tensor_prod_const =
+    dynamic_cast<TensorProductPolynomials<dim, ScalarPolynomialsBase<dim>> *>(
+      this->poly_space.get());
+
+  if (space_tensor_prod_const != nullptr)
+    return space_tensor_prod_const->get_numbering();
+
+  Assert(false, ExcNotImplemented());
+  return std::vector<unsigned int>();
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 std::vector<unsigned int>
-FE_Poly<PolynomialType, dim, spacedim>::get_poly_space_numbering_inverse() const
+FE_Poly<dim, spacedim>::get_poly_space_numbering_inverse() const
 {
-  return internal::get_poly_space_numbering_inverse(poly_space);
+  auto *const space_tensor_prod =
+    dynamic_cast<TensorProductPolynomials<dim, ScalarPolynomialsBase<dim>> *>(
+      this->poly_space.get());
+
+  if (space_tensor_prod != nullptr)
+    return space_tensor_prod->get_numbering_inverse();
+
+  auto *const space_tensor_prod_const =
+    dynamic_cast<TensorProductPolynomials<dim, ScalarPolynomialsBase<dim>> *>(
+      this->poly_space.get());
+
+  if (space_tensor_prod_const != nullptr)
+    return space_tensor_prod_const->get_numbering_inverse();
+
+  Assert(false, ExcNotImplemented());
+  return std::vector<unsigned int>();
 }
 
 
 
-template <class PolynomialType, int dim, int spacedim>
+template <int dim, int spacedim>
 std::size_t
-FE_Poly<PolynomialType, dim, spacedim>::memory_consumption() const
+FE_Poly<dim, spacedim>::memory_consumption() const
 {
   return FiniteElement<dim, spacedim>::memory_consumption() +
-         poly_space.memory_consumption();
+         poly_space->memory_consumption();
 }
 
 
index 5828c6e970e45678621d047486510d1c95384dd9..998c928f56846fd9dc74ee93a6306f06ec573163 100644 (file)
@@ -41,7 +41,7 @@ DEAL_II_NAMESPACE_OPEN
 template <class PolynomialType,
           int dim      = PolynomialType::dimension,
           int spacedim = dim>
-class FE_Q_Base : public FE_Poly<PolynomialType, dim, spacedim>
+class FE_Q_Base : public FE_Poly<dim, spacedim>
 {
 public:
   /**
index 250e98bb5959ae6a73fbd38d3a76467c2fd89d5d..738ce3aa5df0ef04c52d90be70134b9559cc0ea5 100644 (file)
@@ -540,7 +540,7 @@ DEAL_II_NAMESPACE_OPEN
  * @author Brian Carnes, 2002, Ralf Hartmann 2004, 2005, Denis Davydov, 2015
  */
 template <int dim>
-class FE_Q_Hierarchical : public FE_Poly<TensorProductPolynomials<dim>, dim>
+class FE_Q_Hierarchical : public FE_Poly<dim>
 {
 public:
   /**
index fedaa1e8a02da9e10832d50a8f4b70b47d98f178..0ca8a0204ffe840ba9d2bfdf1a38d2ae2358baa3 100644 (file)
@@ -81,7 +81,7 @@ DEAL_II_NAMESPACE_OPEN
  * @date 2015
  */
 template <int dim>
-class FE_RannacherTurek : public FE_Poly<PolynomialsRannacherTurek<dim>, dim>
+class FE_RannacherTurek : public FE_Poly<dim>
 {
 public:
   /**
index ca57050fc0cd8faad3d2c342d4191c86ac6bea39..5827480fbae4a92a97117eeb70982dc385753b6d 100644 (file)
@@ -555,13 +555,9 @@ MatrixFree<dim, Number, VectorizedArrayType>::is_supported(
     return false;
 
   // then check of the base element is supported
-  if (dynamic_cast<const FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>
-                     *>(fe_ptr) != nullptr)
+  if (dynamic_cast<const FE_Poly<dim, spacedim> *>(fe_ptr) != nullptr)
     return true;
-  if (dynamic_cast<const FE_Poly<
-        TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double>>,
-        dim,
-        spacedim> *>(fe_ptr) != nullptr)
+  if (dynamic_cast<const FE_Poly<dim, spacedim> *>(fe_ptr) != nullptr)
     return true;
   if (dynamic_cast<const FE_DGP<dim, spacedim> *>(fe_ptr) != nullptr)
     return true;
index 542bf4d6b2433c5e4bb6f7919f762f134af943df..4749787ebf1db73d70603af524b42935eb0373df 100644 (file)
@@ -136,20 +136,11 @@ namespace internal
         Assert(fe->n_components() == 1,
                ExcMessage("Expected a scalar element"));
 
-        const FE_Poly<TensorProductPolynomials<dim>, dim, dim> *fe_poly =
-          dynamic_cast<
-            const FE_Poly<TensorProductPolynomials<dim>, dim, dim> *>(fe);
-
-        const FE_Poly<
-          TensorProductPolynomials<dim,
-                                   Polynomials::PiecewisePolynomial<double>>,
-          dim,
-          dim> *fe_poly_piece =
-          dynamic_cast<const FE_Poly<
-            TensorProductPolynomials<dim,
-                                     Polynomials::PiecewisePolynomial<double>>,
-            dim,
-            dim> *>(fe);
+        const FE_Poly<dim, dim> *fe_poly =
+          dynamic_cast<const FE_Poly<dim, dim> *>(fe);
+
+        const FE_Poly<dim, dim> *fe_poly_piece =
+          dynamic_cast<const FE_Poly<dim, dim> *>(fe);
 
         const FE_DGP<dim> *fe_dgp = dynamic_cast<const FE_DGP<dim> *>(fe);
 
index 208f8705cb52f1e677e29dfa080a18e220626589..04fe320a739561ab86c56982d6efb7935004e72b 100644 (file)
@@ -27,7 +27,7 @@ DEAL_II_NAMESPACE_OPEN
 
 template <int dim, int spacedim>
 FE_DGP<dim, spacedim>::FE_DGP(const unsigned int degree)
-  : FE_Poly<PolynomialSpace<dim>, dim, spacedim>(
+  : FE_Poly<dim, spacedim>(
       PolynomialSpace<dim>(
         Polynomials::Legendre::generate_complete_basis(degree)),
       FiniteElementData<dim>(get_dpo_vector(degree),
index 314950e33dbc1a50e227f6ae8f732d039dcf5b1f..f505bb986f5febd623689648d9c6f8ec8b79ab44 100644 (file)
@@ -130,7 +130,7 @@ namespace internal
 
 template <int dim>
 FE_DGPMonomial<dim>::FE_DGPMonomial(const unsigned int degree)
-  : FE_Poly<PolynomialsP<dim>, dim>(
+  : FE_Poly<dim>(
       PolynomialsP<dim>(degree),
       FiniteElementData<dim>(get_dpo_vector(degree),
                              1,
@@ -143,8 +143,8 @@ FE_DGPMonomial<dim>::FE_DGPMonomial(const unsigned int degree)
         FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
         std::vector<bool>(1, true)))
 {
-  Assert(this->poly_space.n() == this->dofs_per_cell, ExcInternalError());
-  Assert(this->poly_space.degree() == this->degree, ExcInternalError());
+  Assert(this->poly_space->n() == this->dofs_per_cell, ExcInternalError());
+  Assert(this->poly_space->degree() == this->degree, ExcInternalError());
 
   // DG doesn't have constraints, so
   // leave them empty
@@ -233,9 +233,13 @@ FE_DGPMonomial<dim>::get_interpolation_matrix(
           source_fe_matrix(k, j) = source_fe.shape_value(j, unit_points[k]);
 
       FullMatrix<double> this_matrix(this->dofs_per_cell, this->dofs_per_cell);
+      auto *const        polynomial_space_p =
+        dynamic_cast<PolynomialsP<dim> *>(this->poly_space.get());
+      Assert(polynomial_space_p != nullptr, ExcInternalError());
       for (unsigned int j = 0; j < this->dofs_per_cell; ++j)
         for (unsigned int k = 0; k < unit_points.size(); ++k)
-          this_matrix(k, j) = this->poly_space.compute_value(j, unit_points[k]);
+          this_matrix(k, j) =
+            polynomial_space_p->compute_value(j, unit_points[k]);
 
       this_matrix.gauss_jordan();
 
@@ -454,8 +458,11 @@ FE_DGPMonomial<2>::has_support_on_face(const unsigned int shape_index,
     support_on_face = true;
   else
     {
+      auto *const polynomial_space_p =
+        dynamic_cast<PolynomialsP<2> *>(this->poly_space.get());
+      Assert(polynomial_space_p != nullptr, ExcInternalError());
       const std::array<unsigned int, 2> degrees =
-        this->poly_space.directional_degrees(shape_index);
+        polynomial_space_p->directional_degrees(shape_index);
 
       if ((face_index == 0 && degrees[1] == 0) ||
           (face_index == 3 && degrees[0] == 0))
@@ -476,8 +483,11 @@ FE_DGPMonomial<3>::has_support_on_face(const unsigned int shape_index,
     support_on_face = true;
   else
     {
+      auto *const polynomial_space_p =
+        dynamic_cast<PolynomialsP<3> *>(this->poly_space.get());
+      Assert(polynomial_space_p != nullptr, ExcInternalError());
       const std::array<unsigned int, 3> degrees =
-        this->poly_space.directional_degrees(shape_index);
+        polynomial_space_p->directional_degrees(shape_index);
 
       if ((face_index == 0 && degrees[1] == 0) ||
           (face_index == 2 && degrees[2] == 0) ||
index 818ddb0b6f4c5320d7f33f82e143c9d062dc124c..f54154595d5992cce08fc2e2f348f1925042a7cc 100644 (file)
@@ -60,7 +60,7 @@ namespace internal
 
 template <int dim, int spacedim>
 FE_DGQ<dim, spacedim>::FE_DGQ(const unsigned int degree)
-  : FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>(
+  : FE_Poly<dim, spacedim>(
       TensorProductPolynomials<dim>(
         Polynomials::generate_complete_Lagrange_basis(
           internal::FE_DGQ::get_QGaussLobatto_points(degree))),
@@ -93,7 +93,7 @@ FE_DGQ<dim, spacedim>::FE_DGQ(const unsigned int degree)
 template <int dim, int spacedim>
 FE_DGQ<dim, spacedim>::FE_DGQ(
   const std::vector<Polynomials::Polynomial<double>> &polynomials)
-  : FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>(
+  : FE_Poly<dim, spacedim>(
       TensorProductPolynomials<dim>(polynomials),
       FiniteElementData<dim>(get_dpo_vector(polynomials.size() - 1),
                              1,
@@ -303,11 +303,14 @@ FE_DGQ<dim, spacedim>::get_interpolation_matrix(
       // cell and evaluate the
       // shape functions there
       const Point<dim> p = this->unit_support_points[j];
+      auto *const      polynomial_space_p =
+        dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
+      Assert(polynomial_space_p != nullptr, ExcInternalError());
       for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
-        cell_interpolation(j, i) = this->poly_space.compute_value(i, p);
+        cell_interpolation(j, i) = polynomial_space_p->compute_value(i, p);
 
       for (unsigned int i = 0; i < source_fe.dofs_per_cell; ++i)
-        source_interpolation(j, i) = source_fe.poly_space.compute_value(i, p);
+        source_interpolation(j, i) = polynomial_space_p->compute_value(i, p);
     }
 
   // then compute the
@@ -832,8 +835,11 @@ FE_DGQArbitraryNodes<dim, spacedim>::get_name() const
   bool                equidistant = true;
   std::vector<double> points(this->degree + 1);
 
+  auto *const polynomial_space_p =
+    dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
+  Assert(polynomial_space_p != nullptr, ExcInternalError());
   std::vector<unsigned int> lexicographic =
-    this->poly_space.get_numbering_inverse();
+    polynomial_space_p->get_numbering_inverse();
   for (unsigned int j = 0; j <= this->degree; j++)
     points[j] = this->unit_support_points[lexicographic[j]][0];
 
@@ -945,9 +951,12 @@ std::unique_ptr<FiniteElement<dim, spacedim>>
 FE_DGQArbitraryNodes<dim, spacedim>::clone() const
 {
   // Construct a dummy quadrature formula containing the FE's nodes:
-  std::vector<Point<1>>     qpoints(this->degree + 1);
+  std::vector<Point<1>> qpoints(this->degree + 1);
+  auto *const           polynomial_space_p =
+    dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
+  Assert(polynomial_space_p != nullptr, ExcInternalError());
   std::vector<unsigned int> lexicographic =
-    this->poly_space.get_numbering_inverse();
+    polynomial_space_p->get_numbering_inverse();
   for (unsigned int i = 0; i <= this->degree; ++i)
     qpoints[i] = Point<1>(this->unit_support_points[lexicographic[i]][0]);
   Quadrature<1> pquadrature(qpoints);
index c17fd45f7da3b42e5dbec2c990224cb81f83434b..bee64acba87ab7f0b73d0df17cae7f574f75b41d 100644 (file)
 DEAL_II_NAMESPACE_OPEN
 
 
-template <>
-void
-FE_Poly<TensorProductPolynomials<1>, 1, 2>::fill_fe_values(
-  const Triangulation<1, 2>::cell_iterator &,
-  const CellSimilarity::Similarity       cell_similarity,
-  const Quadrature<1> &                  quadrature,
-  const Mapping<1, 2> &                  mapping,
-  const Mapping<1, 2>::InternalDataBase &mapping_internal,
-  const dealii::internal::FEValuesImplementation::MappingRelatedData<1, 2>
-    &                                          mapping_data,
-  const FiniteElement<1, 2>::InternalDataBase &fe_internal,
-  dealii::internal::FEValuesImplementation::FiniteElementRelatedData<1, 2>
-    &output_data) const
-{
-  // convert data object to internal data for this class. fails with an
-  // exception if that is not possible
-  Assert(dynamic_cast<const InternalData *>(&fe_internal) != nullptr,
-         ExcInternalError());
-  const InternalData &fe_data =
-    static_cast<const InternalData &>(fe_internal); // NOLINT
+template <int dim, int spacedim>
+FE_Poly<dim, spacedim>::FE_Poly(const FE_Poly &fe)
+  : FiniteElement<dim, spacedim>(fe)
+  , poly_space(fe.poly_space->clone())
+{}
 
-  const bool need_to_correct_higher_derivatives =
-    higher_derivatives_need_correcting(mapping,
-                                       mapping_data,
-                                       quadrature.size(),
-                                       fe_data.update_each);
-
-  // transform gradients and higher derivatives. there is nothing to do
-  // for values since we already emplaced them into output_data when
-  // we were in get_data()
-  if (fe_data.update_each & update_gradients &&
-      cell_similarity != CellSimilarity::translation)
-    for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
-      mapping.transform(make_array_view(fe_data.shape_gradients, k),
-                        mapping_covariant,
-                        mapping_internal,
-                        make_array_view(output_data.shape_gradients, k));
-
-  if (fe_data.update_each & update_hessians &&
-      cell_similarity != CellSimilarity::translation)
-    {
-      for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
-        mapping.transform(make_array_view(fe_data.shape_hessians, k),
-                          mapping_covariant_gradient,
-                          mapping_internal,
-                          make_array_view(output_data.shape_hessians, k));
-
-      if (need_to_correct_higher_derivatives)
-        correct_hessians(output_data, mapping_data, quadrature.size());
-    }
-
-  if (fe_data.update_each & update_3rd_derivatives &&
-      cell_similarity != CellSimilarity::translation)
-    {
-      for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
-        mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, k),
-                          mapping_covariant_hessian,
-                          mapping_internal,
-                          make_array_view(output_data.shape_3rd_derivatives,
-                                          k));
-
-      if (need_to_correct_higher_derivatives)
-        correct_third_derivatives(output_data, mapping_data, quadrature.size());
-    }
-}
-
-
-
-template <>
-void
-FE_Poly<TensorProductPolynomials<2>, 2, 3>::fill_fe_values(
-  const Triangulation<2, 3>::cell_iterator &,
-  const CellSimilarity::Similarity       cell_similarity,
-  const Quadrature<2> &                  quadrature,
-  const Mapping<2, 3> &                  mapping,
-  const Mapping<2, 3>::InternalDataBase &mapping_internal,
-  const dealii::internal::FEValuesImplementation::MappingRelatedData<2, 3>
-    &                                          mapping_data,
-  const FiniteElement<2, 3>::InternalDataBase &fe_internal,
-  dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2, 3>
-    &output_data) const
-{
-  // convert data object to internal data for this class. fails with an
-  // exception if that is not possible
-  Assert(dynamic_cast<const InternalData *>(&fe_internal) != nullptr,
-         ExcInternalError());
-  const InternalData &fe_data =
-    static_cast<const InternalData &>(fe_internal); // NOLINT
-
-  const bool need_to_correct_higher_derivatives =
-    higher_derivatives_need_correcting(mapping,
-                                       mapping_data,
-                                       quadrature.size(),
-                                       fe_data.update_each);
-
-  // transform gradients and higher derivatives. there is nothing to do
-  // for values since we already emplaced them into output_data when
-  // we were in get_data()
-  if (fe_data.update_each & update_gradients &&
-      cell_similarity != CellSimilarity::translation)
-    for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
-      mapping.transform(make_array_view(fe_data.shape_gradients, k),
-                        mapping_covariant,
-                        mapping_internal,
-                        make_array_view(output_data.shape_gradients, k));
-
-  if (fe_data.update_each & update_hessians &&
-      cell_similarity != CellSimilarity::translation)
-    {
-      for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
-        mapping.transform(make_array_view(fe_data.shape_hessians, k),
-                          mapping_covariant_gradient,
-                          mapping_internal,
-                          make_array_view(output_data.shape_hessians, k));
-
-      if (need_to_correct_higher_derivatives)
-        correct_hessians(output_data, mapping_data, quadrature.size());
-    }
-
-  if (fe_data.update_each & update_3rd_derivatives &&
-      cell_similarity != CellSimilarity::translation)
-    {
-      for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
-        mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, k),
-                          mapping_covariant_hessian,
-                          mapping_internal,
-                          make_array_view(output_data.shape_3rd_derivatives,
-                                          k));
-
-      if (need_to_correct_higher_derivatives)
-        correct_third_derivatives(output_data, mapping_data, quadrature.size());
-    }
-}
 
 
 #include "fe_poly.inst"
index 486fbd92dd5b070613f1690f47fa22d6d275eaae..dcaa87fc0dee7e8f3a6162835074cbdc81d1b43c 100644 (file)
 for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
   {
 #if deal_II_dimension <= deal_II_space_dimension
-    template class FE_Poly<TensorProductPolynomials<deal_II_dimension>,
-                           deal_II_dimension,
-                           deal_II_space_dimension>;
-    template class FE_Poly<TensorProductPolynomialsConst<deal_II_dimension>,
-                           deal_II_dimension,
-                           deal_II_space_dimension>;
-    template class FE_Poly<TensorProductPolynomialsBubbles<deal_II_dimension>,
-                           deal_II_dimension,
-                           deal_II_space_dimension>;
-    template class FE_Poly<
-      TensorProductPolynomials<deal_II_dimension,
-                               Polynomials::PiecewisePolynomial<double>>,
-      deal_II_dimension,
-      deal_II_space_dimension>;
-    template class FE_Poly<PolynomialSpace<deal_II_dimension>,
-                           deal_II_dimension,
-                           deal_II_space_dimension>;
-    template class FE_Poly<PolynomialsP<deal_II_dimension>,
-                           deal_II_dimension,
-                           deal_II_space_dimension>;
-    template class FE_Poly<PolynomialsRannacherTurek<deal_II_dimension>,
-                           deal_II_dimension,
-                           deal_II_space_dimension>;
+    template class FE_Poly<deal_II_dimension, deal_II_space_dimension>;
 #endif
   }
index 006f9e1c4ec337e4ec5ed5a1d3491498b18714b1..db825ba22da7b3eebd7f2e101ecd473acf5582a8 100644 (file)
@@ -99,8 +99,10 @@ FE_Q<dim, spacedim>::get_name() const
   std::vector<double> points(this->degree + 1);
 
   // Decode the support points in one coordinate direction.
+  TensorProductPolynomials<dim> *poly_space_derived_ptr =
+    dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
   std::vector<unsigned int> lexicographic =
-    this->poly_space.get_numbering_inverse();
+    poly_space_derived_ptr->get_numbering_inverse();
   for (unsigned int j = 0; j <= this->degree; j++)
     points[j] = this->unit_support_points[lexicographic[j]][0];
 
index 4ab6de7034b6b490a439b38893a6d0709700413d..dc183f51510103e444c9fb6ff51e4118f07a6767 100644 (file)
@@ -180,12 +180,14 @@ struct FE_Q_Base<PolynomialType, xdim, xspacedim>::Implementation
 
     // use that the element evaluates to 1 at index 0 and along the line at
     // zero
+    TensorProductPolynomials<dim> *poly_space_derived_ptr =
+      dynamic_cast<TensorProductPolynomials<dim> *>(fe.poly_space.get());
     const std::vector<unsigned int> &index_map_inverse =
-      fe.poly_space.get_numbering_inverse();
+      poly_space_derived_ptr->get_numbering_inverse();
     const std::vector<unsigned int> face_index_map =
       FETools::lexicographic_to_hierarchic_numbering<dim - 1>(q_deg);
     Assert(std::abs(
-             fe.poly_space.compute_value(index_map_inverse[0], Point<dim>()) -
+             fe.poly_space->compute_value(index_map_inverse[0], Point<dim>()) -
              1.) < 1e-14,
            ExcInternalError());
 
@@ -195,7 +197,7 @@ struct FE_Q_Base<PolynomialType, xdim, xspacedim>::Implementation
           Point<dim> p;
           p[0] = constraint_points[i](0);
           fe.interface_constraints(i, face_index_map[j]) =
-            fe.poly_space.compute_value(index_map_inverse[j], p);
+            fe.poly_space->compute_value(index_map_inverse[j], p);
 
           // if the value is small up to round-off, then simply set it to zero
           // to avoid unwanted fill-in of the constraint matrices (which would
@@ -315,12 +317,14 @@ struct FE_Q_Base<PolynomialType, xdim, xspacedim>::Implementation
 
     // use that the element evaluates to 1 at index 0 and along the line at
     // zero
+    TensorProductPolynomials<dim> *poly_space_derived_ptr =
+      dynamic_cast<TensorProductPolynomials<dim> *>(fe.poly_space.get());
     const std::vector<unsigned int> &index_map_inverse =
-      fe.poly_space.get_numbering_inverse();
+      poly_space_derived_ptr->get_numbering_inverse();
     const std::vector<unsigned int> face_index_map =
       FETools::lexicographic_to_hierarchic_numbering<dim - 1>(q_deg);
     Assert(std::abs(
-             fe.poly_space.compute_value(index_map_inverse[0], Point<dim>()) -
+             fe.poly_space->compute_value(index_map_inverse[0], Point<dim>()) -
              1.) < 1e-14,
            ExcInternalError());
 
@@ -385,8 +389,8 @@ struct FE_Q_Base<PolynomialType, xdim, xspacedim>::Implementation
               indices[1] * (q_deg + 1) + indices[0];
 
             fe.interface_constraints(i, face_index_map[j]) =
-              fe.poly_space.compute_value(index_map_inverse[new_index],
-                                          constraint_point);
+              fe.poly_space->compute_value(index_map_inverse[new_index],
+                                           constraint_point);
 
             // if the value is small up to round-off, then simply set it to
             // zero to avoid unwanted fill-in of the constraint matrices
@@ -407,7 +411,7 @@ FE_Q_Base<PolynomialType, dim, spacedim>::FE_Q_Base(
   const PolynomialType &        poly_space,
   const FiniteElementData<dim> &fe_data,
   const std::vector<bool> &     restriction_is_additive_flags)
-  : FE_Poly<PolynomialType, dim, spacedim>(
+  : FE_Poly<dim, spacedim>(
       poly_space,
       fe_data,
       restriction_is_additive_flags,
@@ -445,7 +449,9 @@ FE_Q_Base<PolynomialType, dim, spacedim>::initialize(
       FETools::hierarchic_to_lexicographic_numbering<dim>(q_degree);
     for (unsigned int i = q_dofs_per_cell; i < this->dofs_per_cell; ++i)
       renumber.push_back(i);
-    this->poly_space.set_numbering(renumber);
+    TensorProductPolynomials<dim> *poly_space_derived_ptr =
+      dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
+    poly_space_derived_ptr->set_numbering(renumber);
   }
 
   // Finally fill in support points on cell and face and initialize
@@ -502,12 +508,12 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_interpolation_matrix(
 
           // FE_Q element evaluates to 1 in unit support point and to zero in
           // all other points by construction
-          Assert(std::abs(this->poly_space.compute_value(j, p) - 1.) < 1e-13,
+          Assert(std::abs(this->poly_space->compute_value(j, p) - 1.) < 1e-13,
                  ExcInternalError());
 
           for (unsigned int i = 0; i < source_q_dofs_per_cell; ++i)
             interpolation_matrix(j, i) =
-              source_fe->poly_space.compute_value(i, p);
+              source_fe->poly_space->compute_value(i, p);
         }
 
       // for FE_Q_DG0, add one last row of identity
@@ -748,10 +754,15 @@ FE_Q_Base<PolynomialType, dim, spacedim>::hp_line_dof_identities(
 
       std::vector<std::pair<unsigned int, unsigned int>> identities;
 
+      TensorProductPolynomials<dim> *poly_space_derived_ptr =
+        dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
       const std::vector<unsigned int> &index_map_inverse =
-        this->poly_space.get_numbering_inverse();
+        poly_space_derived_ptr->get_numbering_inverse();
+      TensorProductPolynomials<dim> *poly_space_derived_ptr_other =
+        dynamic_cast<TensorProductPolynomials<dim> *>(
+          fe_q_other->poly_space.get());
       const std::vector<unsigned int> &index_map_inverse_other =
-        fe_q_other->poly_space.get_numbering_inverse();
+        poly_space_derived_ptr_other->get_numbering_inverse();
 
       for (unsigned int i = 0; i < p - 1; ++i)
         for (unsigned int j = 0; j < q - 1; ++j)
@@ -810,10 +821,15 @@ FE_Q_Base<PolynomialType, dim, spacedim>::hp_quad_dof_identities(
 
       std::vector<std::pair<unsigned int, unsigned int>> identities;
 
+      TensorProductPolynomials<dim> *poly_space_derived_ptr =
+        dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
       const std::vector<unsigned int> &index_map_inverse =
-        this->poly_space.get_numbering_inverse();
+        poly_space_derived_ptr->get_numbering_inverse();
+      TensorProductPolynomials<dim> *poly_space_derived_ptr_other =
+        dynamic_cast<TensorProductPolynomials<dim> *>(
+          fe_q_other->poly_space.get());
       const std::vector<unsigned int> &index_map_inverse_other =
-        fe_q_other->poly_space.get_numbering_inverse();
+        poly_space_derived_ptr_other->get_numbering_inverse();
 
       for (unsigned int i1 = 0; i1 < p - 1; ++i1)
         for (unsigned int i2 = 0; i2 < p - 1; ++i2)
@@ -870,8 +886,10 @@ void
 FE_Q_Base<PolynomialType, dim, spacedim>::initialize_unit_support_points(
   const std::vector<Point<1>> &points)
 {
+  TensorProductPolynomials<dim> *poly_space_derived_ptr =
+    dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
   const std::vector<unsigned int> &index_map_inverse =
-    this->poly_space.get_numbering_inverse();
+    poly_space_derived_ptr->get_numbering_inverse();
 
   // We can compute the support points by computing the tensor
   // product of the 1d set of points. We could do this by hand, but it's
@@ -1175,7 +1193,7 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_prolongation_matrix(
       // current numbering gives the identity operation
       for (unsigned int i = 0; i < q_dofs_per_cell; ++i)
         {
-          Assert(std::fabs(1. - this->poly_space.compute_value(
+          Assert(std::fabs(1. - this->poly_space->compute_value(
                                   i, this->unit_support_points[i])) < eps,
                  ExcInternalError("The Lagrange polynomial does not evaluate "
                                   "to one or zero in a nodal point. "
@@ -1185,7 +1203,7 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_prolongation_matrix(
                                   "prevents the sum to be one."));
           for (unsigned int j = 0; j < q_dofs_per_cell; ++j)
             if (j != i)
-              Assert(std::fabs(this->poly_space.compute_value(
+              Assert(std::fabs(this->poly_space->compute_value(
                        i, this->unit_support_points[j])) < eps,
                      ExcInternalError(
                        "The Lagrange polynomial does not evaluate "
@@ -1204,8 +1222,11 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_prolongation_matrix(
       const unsigned int            dofs1d = q_degree + 1;
       std::vector<Table<2, double>> subcell_evaluations(
         dim, Table<2, double>(dofs1d, dofs1d));
+
+      TensorProductPolynomials<dim> *poly_space_derived_ptr =
+        dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
       const std::vector<unsigned int> &index_map_inverse =
-        this->poly_space.get_numbering_inverse();
+        poly_space_derived_ptr->get_numbering_inverse();
 
       // helper value: step size how to walk through diagonal and how many
       // points we have left apart from the first dimension
@@ -1238,7 +1259,7 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_prolongation_matrix(
                 Point<dim> point;
                 point[0] = p_cell[d];
                 const double cell_value =
-                  this->poly_space.compute_value(index_map_inverse[i], point);
+                  this->poly_space->compute_value(index_map_inverse[i], point);
 
                 // cut off values that are too small. note that we have here
                 // Lagrange interpolation functions, so they should be zero at
@@ -1280,7 +1301,7 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_prolongation_matrix(
                   subcell_evaluations[d](j_indices[d - 1], i_indices[d - 1]);
 
               // innermost sum where we actually compute. the same as
-              // prolongate(j,i) = this->poly_space.compute_value (i, p_cell)
+              // prolongate(j,i) = this->poly_space->compute_value (i, p_cell)
               for (unsigned int jj = 0; jj < dofs1d; ++jj)
                 {
                   const unsigned int j_ind = index_map_inverse[j + jj];
@@ -1379,9 +1400,12 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_restriction_matrix(
       // assumption that whenever a row makes a non-zero contribution to the
       // mother's residual, the correct value is interpolated.
 
-      const double                     eps = 1e-15 * q_degree * dim;
+      const double eps = 1e-15 * q_degree * dim;
+
+      TensorProductPolynomials<dim> *poly_space_derived_ptr =
+        dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
       const std::vector<unsigned int> &index_map_inverse =
-        this->poly_space.get_numbering_inverse();
+        poly_space_derived_ptr->get_numbering_inverse();
 
       const unsigned int          dofs1d = q_degree + 1;
       std::vector<Tensor<1, dim>> evaluations1d(dofs1d);
@@ -1411,8 +1435,8 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_restriction_matrix(
                     Point<dim> point;
                     point[0] = p_subcell[d];
                     evaluations1d[j][d] =
-                      this->poly_space.compute_value(index_map_inverse[j],
-                                                     point);
+                      this->poly_space->compute_value(index_map_inverse[j],
+                                                      point);
                   }
               unsigned int j_indices[dim];
               internal::FE_Q_Base::zero_indices<dim>(j_indices);
index d77f389ad5613bcb2e445d19db196e68d25629a5..41e70212824893065347e43767764906f248686e 100644 (file)
@@ -58,8 +58,9 @@ namespace internal
 
 template <int dim>
 FE_Q_Hierarchical<dim>::FE_Q_Hierarchical(const unsigned int degree)
-  : FE_Poly<TensorProductPolynomials<dim>, dim>(
-      Polynomials::Hierarchical::generate_complete_basis(degree),
+  : FE_Poly<dim>(
+      TensorProductPolynomials<dim>(
+        Polynomials::Hierarchical::generate_complete_basis(degree)),
       FiniteElementData<dim>(get_dpo_vector(degree),
                              1,
                              degree,
@@ -72,7 +73,9 @@ FE_Q_Hierarchical<dim>::FE_Q_Hierarchical(const unsigned int degree)
         std::vector<bool>(1, true)))
   , face_renumber(face_fe_q_hierarchical_to_hierarchic_numbering(degree))
 {
-  this->poly_space.set_numbering(
+  TensorProductPolynomials<dim> *poly_space_derived_ptr =
+    dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
+  poly_space_derived_ptr->set_numbering(
     hierarchic_to_fe_q_hierarchical_numbering(*this));
 
   // The matrix @p{dofs_cell} contains the
@@ -673,7 +676,10 @@ FE_Q_Hierarchical<dim>::initialize_embedding_and_restriction(
   unsigned int iso = RefinementCase<dim>::isotropic_refinement - 1;
 
   const unsigned int dofs_1d = 2 * this->dofs_per_vertex + this->dofs_per_line;
-  const std::vector<unsigned int> &renumber = this->poly_space.get_numbering();
+  TensorProductPolynomials<dim> *poly_space_derived_ptr =
+    dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
+  const std::vector<unsigned int> &renumber =
+    poly_space_derived_ptr->get_numbering();
 
   for (unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell; ++c)
     {
@@ -810,8 +816,10 @@ FE_Q_Hierarchical<dim>::initialize_generalized_support_points()
 
   this->generalized_support_points.resize(n);
 
+  TensorProductPolynomials<dim> *poly_space_derived_ptr =
+    dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
   const std::vector<unsigned int> &index_map_inverse =
-    this->poly_space.get_numbering_inverse();
+    poly_space_derived_ptr->get_numbering_inverse();
 
   Point<dim> p;
   // the method of numbering allows
index 24d4a5714bc35a38f7e87ff03828503829778b19..dded3b04f54eb5e9a9055404e7d09328a6badd27 100644 (file)
@@ -32,14 +32,13 @@ template <int dim>
 FE_RannacherTurek<dim>::FE_RannacherTurek(
   const unsigned int order,
   const unsigned int n_face_support_points)
-  : FE_Poly<PolynomialsRannacherTurek<dim>, dim>(
-      PolynomialsRannacherTurek<dim>(),
-      FiniteElementData<dim>(this->get_dpo_vector(),
-                             1,
-                             2,
-                             FiniteElementData<dim>::L2),
-      std::vector<bool>(4, false), // restriction not implemented
-      std::vector<ComponentMask>(4, std::vector<bool>(1, true)))
+  : FE_Poly<dim>(PolynomialsRannacherTurek<dim>(),
+                 FiniteElementData<dim>(this->get_dpo_vector(),
+                                        1,
+                                        2,
+                                        FiniteElementData<dim>::L2),
+                 std::vector<bool>(4, false), // restriction not implemented
+                 std::vector<ComponentMask>(4, std::vector<bool>(1, true)))
   , order(order)
   , n_face_support_points(n_face_support_points)
 {

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.