]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Made FE_DGQ with arbitrary nodes a derivation from FE_DGQ with equidistant nodes.
authorprill <prill@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Nov 2006 08:26:59 +0000 (08:26 +0000)
committerprill <prill@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Nov 2006 08:26:59 +0000 (08:26 +0000)
git-svn-id: https://svn.dealii.org/trunk@14169 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe_dgq.h
deal.II/deal.II/source/fe/fe_dgq.cc

index 7fd475fb9b4fae780f32d004870b636a52dc9287..84e3c9a74680d76e23381a0329c486b6cab1ecfa 100644 (file)
@@ -88,18 +88,6 @@ class FE_DGQ : public FE_Poly<TensorProductPolynomials<dim>,dim>
                                      */
     FE_DGQ (const unsigned int p);
 
-                                    /**
-                                     * Constructor for tensor product
-                                     * polynomials based on
-                                     * Polynomials::Lagrange
-                                     * interpolation of the support
-                                     * points in the quadrature rule
-                                     * <tt>points</tt>. The degree of
-                                     * these polynomials is
-                                     * <tt>points.size()-1</tt>.
-                                     */
-    FE_DGQ (const Quadrature<1>& points);
-    
                                     /**
                                      * Return a string that uniquely
                                      * identifies a finite
@@ -324,6 +312,21 @@ class FE_DGQ : public FE_Poly<TensorProductPolynomials<dim>,dim>
 
 
   protected:
+                                    /**
+                                     * Constructor for tensor product
+                                     * polynomials based on
+                                     * Polynomials::Lagrange
+                                     * interpolation of the support
+                                     * points in the quadrature rule
+                                     * <tt>points</tt>. The degree of
+                                     * these polynomials is
+                                     * <tt>points.size()-1</tt>.
+                                     *
+                                     * Note: The FE_DGQ::clone function
+                                     * does not work properly for FE with
+                                     * arbitrary nodes!
+                                     */
+    FE_DGQ (const Quadrature<1>& points);
 
                                     /**
                                      * @p clone function instead of
@@ -389,6 +392,55 @@ class FE_DGQ : public FE_Poly<TensorProductPolynomials<dim>,dim>
     template <int dim1> friend class MappingQ;
 };
 
+
+
+/**
+ * Implementation of scalar, discontinuous tensor product elements
+ * based on Lagrange polynomials with arbitrary nodes.
+ *
+ * See base class documentation for details.
+ *
+ * @author F. Prill 2006
+ */
+template <int dim>
+class FE_DGQArbitraryNodes : public FE_DGQ<dim>
+{
+  public:
+                                    /**
+                                     * Constructor for tensor product
+                                     * polynomials based on
+                                     * Polynomials::Lagrange
+                                     * interpolation of the support
+                                     * points in the quadrature rule
+                                     * <tt>points</tt>. The degree of
+                                     * these polynomials is
+                                     * <tt>points.size()-1</tt>.
+                                     */
+    FE_DGQArbitraryNodes (const Quadrature<1>& points);
+
+                                    /**
+                                     * Return a string that uniquely
+                                     * identifies a finite
+                                     * element. This class returns
+                                     * <tt>FE_DGQArbitraryNodes<dim>(degree)</tt> ,
+                                     * with <tt>dim</tt> and <tt>degree</tt>
+                                     * replaced by appropriate
+                                     * values.
+                                     */
+    virtual std::string get_name () const;
+
+  protected:
+                                    /**
+                                     * @p clone function instead of
+                                     * a copy constructor.
+                                     *
+                                     * This function is needed by the
+                                     * constructors of @p FESystem.
+                                     */
+    virtual FiniteElement<dim> *clone() const;
+};
+
+
 /*@}*/
 
 DEAL_II_NAMESPACE_CLOSE
index 01bd899ccca3ec7885b990db9bce21ee02ca1e65..47d6365c0969b96bdddc78c2b0500d2360cdd032 100644 (file)
@@ -242,18 +242,7 @@ template <int dim>
 FiniteElement<dim> *
 FE_DGQ<dim>::clone() const
 {
-                                  // TODO[Prill] : There must be a better way
-                                  // to extract 1D quadrature points from the
-                                  // tensor product FE.
-  
-                                  // Construct a dummy quadrature formula
-                                  // containing the FE's nodes:
-  std::vector<Point<1> > qpoints(this->degree+1);
-  for (unsigned int i=0; i<=this->degree; ++i)
-    qpoints[i] = Point<1>(this->unit_support_points[i][0]);
-  Quadrature<1> pquadrature(qpoints);
-  
-  return new FE_DGQ<dim>(pquadrature);
+  return new FE_DGQ<dim>(this->degree);
 }
 
 
@@ -661,6 +650,52 @@ FE_DGQ<dim>::memory_consumption () const
 
 
 
+template <int dim>
+FE_DGQArbitraryNodes<dim>::FE_DGQArbitraryNodes (const Quadrature<1>& points)
+               : FE_DGQ<dim>(points)
+{}
+
+
+
+template <int dim>
+std::string
+FE_DGQArbitraryNodes<dim>::get_name () const
+{
+                                  // note that the
+                                  // FETools::get_fe_from_name
+                                  // function does not work for
+                                  // FE_DGQArbitraryNodes since
+                                  // there is no initialization by
+                                  // a degree value.
+  std::ostringstream namebuf;  
+  namebuf << "FE_DGQArbitraryNodes<" << dim << ">(" << this->degree << ")";
+
+  return namebuf.str();
+}
+
+
+
+template <int dim>
+FiniteElement<dim> *
+FE_DGQArbitraryNodes<dim>::clone() const
+{
+                                  // TODO[Prill] : There must be a better way
+                                  // to extract 1D quadrature points from the
+                                  // tensor product FE.
+  
+                                  // Construct a dummy quadrature formula
+                                  // containing the FE's nodes:
+  std::vector<Point<1> > qpoints(this->degree+1);
+  for (unsigned int i=0; i<=this->degree; ++i)
+    qpoints[i] = Point<1>(this->unit_support_points[i][0]);
+  Quadrature<1> pquadrature(qpoints);
+  
+  return new FE_DGQArbitraryNodes<dim>(pquadrature);
+}
+
+
+
 template class FE_DGQ<deal_II_dimension>;
+template class FE_DGQArbitraryNodes<deal_II_dimension>;
 
 DEAL_II_NAMESPACE_CLOSE

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.