]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Move degree and get_degree to FE_Poly base class.
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 18 Mar 2004 08:24:31 +0000 (08:24 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 18 Mar 2004 08:24:31 +0000 (08:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@8813 0785d39b-7218-0410-832d-ea1e28bc413d

12 files changed:
deal.II/deal.II/include/fe/fe_dgp.h
deal.II/deal.II/include/fe/fe_dgp_monomial.h
deal.II/deal.II/include/fe/fe_dgq.h
deal.II/deal.II/include/fe/fe_poly.h
deal.II/deal.II/include/fe/fe_q.h
deal.II/deal.II/include/fe/fe_q_hierarchical.h
deal.II/deal.II/source/fe/fe_dgp.cc
deal.II/deal.II/source/fe/fe_dgp_monomial.cc
deal.II/deal.II/source/fe/fe_dgq.cc
deal.II/deal.II/source/fe/fe_poly.cc
deal.II/deal.II/source/fe/fe_q.cc
deal.II/deal.II/source/fe/fe_q_hierarchical.cc

index 9d1d0b9591fd67aafa81e5838a48c55dc6f80b92..c705483430b435c25a745e33e071eb9825efa08a 100644 (file)
@@ -52,14 +52,6 @@ class FE_DGP : public FE_Poly<PolynomialSpace<dim>,dim>
                                      * values.
                                      */
     virtual std::string get_name () const;
-
-                                    /**
-                                     * Return the polynomial degree
-                                     * of this finite element,
-                                     * i.e. the value passed to the
-                                     * constructor.
-                                     */
-    unsigned int get_degree () const;
     
                                     /**
                                      * Check for non-zero values on a face.
@@ -161,11 +153,6 @@ class FE_DGP : public FE_Poly<PolynomialSpace<dim>,dim>
                                      * @p{FiniteElementData}.
                                      */
     static std::vector<unsigned int> get_dpo_vector(unsigned int degree);
-  
-                                    /**
-                                     * Degree of the polynomials.
-                                     */  
-    const unsigned int degree;
     
                                     /**
                                      * Allow access from other dimensions.
index e6865e48a66654569e9dbea4ffd184174b9919d8..6d4b2f5fb138e26c4917e4ab87ad15aa0639442b 100644 (file)
@@ -54,14 +54,6 @@ class FE_DGPMonomial : public FE_Poly<PolynomialsP<dim>,dim>
                                      * appropriate values.
                                      */
     virtual std::string get_name () const;
-
-                                    /**
-                                     * Return the polynomial degree
-                                     * of this finite element,
-                                     * i.e. the value passed to the
-                                     * constructor.
-                                     */
-    unsigned int get_degree () const;
     
                                     /**
                                      * Return the matrix
@@ -161,12 +153,5 @@ class FE_DGPMonomial : public FE_Poly<PolynomialsP<dim>,dim>
 
 /*@}*/
 
-template <int dim>
-inline unsigned int
-FE_DGPMonomial<dim>::get_degree () const
-{
-  return this->poly_space.degree();
-}
-
 
 #endif
index 5bd213fe0b4c26dc233e93bddaa35b1a11cc5426..b2e007aa85041ae215da336dc11d8ac09a7647e9 100644 (file)
@@ -54,14 +54,6 @@ class FE_DGQ : public FE_Poly<TensorProductPolynomials<dim>,dim>
                                      * values.
                                      */
     virtual std::string get_name () const;
-
-                                    /**
-                                     * Return the polynomial degree
-                                     * of this finite element,
-                                     * i.e. the value passed to the
-                                     * constructor.
-                                     */
-    unsigned int get_degree () const;
     
                                     /**
                                      * Return the matrix
@@ -212,11 +204,6 @@ class FE_DGQ : public FE_Poly<TensorProductPolynomials<dim>,dim>
                                      */
     void rotate_indices (std::vector<unsigned int> &indices,
                         const char                 direction) const;
-  
-                                    /**
-                                     * Degree of the polynomials.
-                                     */  
-    const unsigned int degree;
     
                                     /**
                                      * Allow access from other dimensions.
index be0f707c26c9afb84d03b60ce730d4bccbb5824f..9a22974b6af8aac67bc38e3da4b02f2784f509ec 100644 (file)
@@ -64,11 +64,20 @@ class FE_Poly : public FiniteElement<dim>
                                     /**
                                      * Constructor.
                                      */
-    FE_Poly (const POLY& poly_space,
+    FE_Poly (unsigned int degree,
+            const POLY& poly_space,
             const FiniteElementData<dim> &fe_data,
             const std::vector<bool> &restriction_is_additive_flags,
             const std::vector<std::vector<bool> > &nonzero_components);
 
+                                    /**
+                                     * Return the polynomial degree
+                                     * of this finite element,
+                                     * i.e. the value passed to the
+                                     * constructor.
+                                     */
+    unsigned int get_degree () const;
+
                                     /**
                                      * Return the value of the
                                      * <tt>i</tt>th shape function at
@@ -388,6 +397,11 @@ class FE_Poly : public FiniteElement<dim>
                                          */      
        Table<2,Tensor<1,dim> > shape_gradients;
     };
+    
+                                    /**
+                                     * Degree of the polynomials.
+                                     */  
+    const unsigned int degree;
 
                                      /**
                                       * The polynomial space. Its type
index 8491866a8d7a1f1b4580ed1094404a0438405301..2dacccea9e403e22d120eb6183b963230f912009 100644 (file)
@@ -255,14 +255,6 @@ class FE_Q : public FE_Poly<TensorProductPolynomials<dim>,dim>
                                      * values.
                                      */
     virtual std::string get_name () const;
-
-                                    /**
-                                     * Return the polynomial degree
-                                     * of this finite element,
-                                     * i.e. the value passed to the
-                                     * constructor.
-                                     */
-    unsigned int get_degree () const;
     
                                     /**
                                      * Return the matrix
@@ -491,11 +483,6 @@ class FE_Q : public FE_Poly<TensorProductPolynomials<dim>,dim>
                                      * constructor.
                                      */
     void initialize_unit_face_support_points ();
-    
-                                    /**
-                                     * Degree of the polynomials.
-                                     */  
-    const unsigned int degree;
              
                                     /**
                                      * Mapping from hierarchic to
index 2ddad0c47cc7b8673d8ab935ee3815baa13ac505..5b4ffc63d024cb27ae74a157548b5bc1fa25f37a 100644 (file)
 #include <base/config.h>
 #include <base/tensor_product_polynomials.h>
 #include <fe/fe_poly.h>
-#include <fe/fe.h>
-//#include <lac/full_matrix.h>
 
-template <int dim> class TensorProductPolynomials;
 template <int dim> class MappingQ;
 
 
@@ -253,14 +250,6 @@ class FE_Q_Hierarchical : public FE_Poly<TensorProductPolynomials<dim>,dim>
                                      * values.
                                      */
     virtual std::string get_name () const;
-
-                                    /**
-                                     * Return the polynomial degree
-                                     * of this finite element,
-                                     * i.e. the value passed to the
-                                     * constructor.
-                                     */
-    unsigned int get_degree () const;
     
                                     /**
                                      * Check for non-zero values on a face.
@@ -446,11 +435,6 @@ class FE_Q_Hierarchical : public FE_Poly<TensorProductPolynomials<dim>,dim>
                                      * constructor.
                                      */
     void initialize_unit_face_support_points ();
-    
-                                    /**
-                                     * Degree of the polynomials.
-                                     */  
-    const unsigned int degree;
              
                                     /**
                                      * Mapping from lexicographic to
index 3674811da9535e2d147ddbb1db3f7f32f49a45b2..c833fc630aa58077d79d1a64b21350cdcb9f690a 100644 (file)
@@ -24,12 +24,12 @@ template <int dim>
 FE_DGP<dim>::FE_DGP (const unsigned int degree)
                :
                FE_Poly<PolynomialSpace<dim>, dim> (
+                 degree,
                  PolynomialSpace<dim>(Polynomials::Legendre::generate_complete_basis(degree)),
                  FiniteElementData<dim>(get_dpo_vector(degree), 1, degree),
                  std::vector<bool>(FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,true),
                  std::vector<std::vector<bool> >(FiniteElementData<dim>(
-                   get_dpo_vector(degree), 1, degree).dofs_per_cell, std::vector<bool>(1,true))),
-                                                   degree(degree)
+                   get_dpo_vector(degree), 1, degree).dofs_per_cell, std::vector<bool>(1,true)))
 {
                                   // if defined, copy over matrices
                                   // from precomputed arrays
@@ -148,14 +148,4 @@ FE_DGP<dim>::memory_consumption () const
 
 
 
-template <int dim>
-unsigned int
-FE_DGP<dim>::get_degree () const
-{
-  return degree;
-}
-
-
-
-
 template class FE_DGP<deal_II_dimension>;
index d86f3c513acdcc6436c3336faf2d4c2bdb6450f2..32defe27b45c4dde79e227c36a697fde8388a32f 100644 (file)
@@ -111,6 +111,7 @@ template <int dim>
 FE_DGPMonomial<dim>::FE_DGPMonomial (const unsigned int degree)
                :
                FE_Poly<PolynomialsP<dim>, dim> (
+                 degree,
                  PolynomialsP<dim>(degree),
                  FiniteElementData<dim>(get_dpo_vector(degree), 1, degree),
                  std::vector<bool>(FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,true),
@@ -118,6 +119,7 @@ FE_DGPMonomial<dim>::FE_DGPMonomial (const unsigned int degree)
                    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());
   
                                   // DG doesn't have constraints, so
                                   // leave them empty
@@ -152,7 +154,7 @@ FE_DGPMonomial<dim>::get_name () const
   std::ostrstream namebuf;
 #endif
   
-  namebuf << "FE_DGPMonomial<" << dim << ">(" << get_degree() << ")";
+  namebuf << "FE_DGPMonomial<" << dim << ">(" << this->degree << ")";
 
 #ifndef HAVE_STD_STRINGSTREAM
   namebuf << std::ends;
@@ -166,7 +168,7 @@ template <int dim>
 FiniteElement<dim> *
 FE_DGPMonomial<dim>::clone() const
 {
-  return new FE_DGPMonomial<dim>(get_degree());
+  return new FE_DGPMonomial<dim>(this->degree);
 }
 
 
@@ -211,7 +213,7 @@ void
 FE_DGPMonomial<dim>::initialize_embedding ()
 {
   std::vector<Point<dim> > unit_points(this->dofs_per_cell);
-  generate_unit_points(get_degree(), unit_points);
+  generate_unit_points(this->degree, unit_points);
   
   FullMatrix<double> cell_interpolation (this->dofs_per_cell,
                                         this->dofs_per_cell);
@@ -245,7 +247,7 @@ FE_DGPMonomial<dim>::initialize_embedding ()
                                       // cut off very small values
       for (unsigned int i=0; i<this->dofs_per_cell; ++i)
        for (unsigned int j=0; j<this->dofs_per_cell; ++j)
-         if (std::fabs(this->prolongation[child](i,j)) < 2e-14*get_degree()*dim)
+         if (std::fabs(this->prolongation[child](i,j)) < 2e-14*this->degree*dim)
            this->prolongation[child](i,j) = 0.;      
     }
 }
@@ -286,7 +288,7 @@ bool
 FE_DGPMonomial<1>::has_support_on_face (const unsigned int,
                                        const unsigned int face_index) const
 {
-  return face_index==1 || (face_index==0 && get_degree()==0);
+  return face_index==1 || (face_index==0 && this->degree==0);
 }
 
 #endif
index 0e5e6f8e9e150968b6d6cf68a776b749490cbccf..a55ec58c910bf9bb3e867ba9b98d75d6fd8484a8 100644 (file)
@@ -136,12 +136,12 @@ template <int dim>
 FE_DGQ<dim>::FE_DGQ (const unsigned int degree)
                :
                FE_Poly<TensorProductPolynomials<dim>, dim> (
+                 degree,
                  TensorProductPolynomials<dim>(Polynomials::LagrangeEquidistant::generate_complete_basis(degree)),
                  FiniteElementData<dim>(get_dpo_vector(degree), 1, degree),
                  std::vector<bool>(FiniteElementData<dim>(get_dpo_vector(degree),1, degree).dofs_per_cell, true),
                  std::vector<std::vector<bool> >(FiniteElementData<dim>(
-                   get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector<bool>(1,true))),
-                                                   degree(degree)
+                   get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector<bool>(1,true)))
 {
                                   // generate permutation/rotation
                                   // index sets to generate some
@@ -623,14 +623,4 @@ FE_DGQ<dim>::memory_consumption () const
 
 
 
-template <int dim>
-unsigned int
-FE_DGQ<dim>::get_degree () const
-{
-  return degree;
-}
-
-
-
-
 template class FE_DGQ<deal_II_dimension>;
index 02df1791a9f1fc70dcd457f1f7267b99fb506a8a..00262b4d2757c130f713ae0cd6ac55b89a9a46e6 100644 (file)
 
 
 template <class POLY, int dim>
-FE_Poly<POLY,dim>::FE_Poly (const POLY& poly_space,
+FE_Poly<POLY,dim>::FE_Poly (unsigned int degree,
+                           const POLY& poly_space,
                            const FiniteElementData<dim> &fe_data,
                            const std::vector<bool> &restriction_is_additive_flags,
                            const std::vector<std::vector<bool> > &nonzero_components):
                FiniteElement<dim> (fe_data,
                                    restriction_is_additive_flags,
                                    nonzero_components),
-               poly_space(poly_space)
+                degree(degree),
+                poly_space(poly_space)
 {}
 
 
+template <class POLY, int dim>
+unsigned int
+FE_Poly<POLY,dim>::get_degree () const
+{
+  return degree;
+}
+
 
 template <class POLY, int dim>
 double
index 89aa457bc94cf59fba9835a83d434c2b68f5aff5..755a56d2ee7e528aacce2e9a96af43f7d8a73c29 100644 (file)
@@ -423,13 +423,13 @@ template <int dim>
 FE_Q<dim>::FE_Q (const unsigned int degree)
                :
                FE_Poly<TensorProductPolynomials<dim>, dim> (
+                 degree,
                  TensorProductPolynomials<dim>(Polynomials::LagrangeEquidistant::generate_complete_basis(degree)),
                  FiniteElementData<dim>(get_dpo_vector(degree),1, degree),
                  std::vector<bool> (FiniteElementData<dim>(
                    get_dpo_vector(degree),1, degree).dofs_per_cell, false),
                  std::vector<std::vector<bool> >(FiniteElementData<dim>(
                    get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector<bool>(1,true))),
-                                                   degree(degree),
                                                    face_index_map(FE_Q_Helper::invert_numbering(face_lexicographic_to_hierarchic_numbering (degree)))
 {
   this->poly_space.set_numbering(FE_Q_Helper::invert_numbering(
@@ -1698,13 +1698,4 @@ FE_Q<dim>::memory_consumption () const
 
 
 
-template <int dim>
-unsigned int
-FE_Q<dim>::get_degree () const
-{
-  return degree;
-}
-
-
-
 template class FE_Q<deal_II_dimension>;
index f835f8706063f580b71b6e4a90c08a7340c7239b..1054eb7e3a334c1b584a72934388db24a0f9b48a 100644 (file)
@@ -39,13 +39,13 @@ template <int dim>
 FE_Q_Hierarchical<dim>::FE_Q_Hierarchical (const unsigned int degree)
                :
                FE_Poly<TensorProductPolynomials<dim>, dim> (
+                 degree,
                  Polynomials::Hierarchical::generate_complete_basis(degree),
                  FiniteElementData<dim>(get_dpo_vector(degree),1, degree),
                  std::vector<bool> (FiniteElementData<dim>(
                    get_dpo_vector(degree),1, degree).dofs_per_cell, false),
                  std::vector<std::vector<bool> >(FiniteElementData<dim>(
                    get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector<bool>(1,true))),
-                                                   degree(degree),
                                                    face_renumber(face_lexicographic_to_hierarchic_numbering (degree))
 {
   this->poly_space.set_numbering(invert_numbering(
@@ -1098,13 +1098,4 @@ FE_Q_Hierarchical<dim>::memory_consumption () const
 
 
 
-template <int dim>
-unsigned int
-FE_Q_Hierarchical<dim>::get_degree () const
-{
-  return degree;
-}
-
-
-
 template class FE_Q_Hierarchical<deal_II_dimension>;

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.