From: hartmann Date: Thu, 18 Mar 2004 08:24:31 +0000 (+0000) Subject: Move degree and get_degree to FE_Poly base class. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58dea94d1cabb07dd997e9ea35eea8c549cbb387;p=dealii-svn.git Move degree and get_degree to FE_Poly base class. git-svn-id: https://svn.dealii.org/trunk@8813 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/fe/fe_dgp.h b/deal.II/deal.II/include/fe/fe_dgp.h index 9d1d0b9591..c705483430 100644 --- a/deal.II/deal.II/include/fe/fe_dgp.h +++ b/deal.II/deal.II/include/fe/fe_dgp.h @@ -52,14 +52,6 @@ class FE_DGP : public FE_Poly,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,dim> * @p{FiniteElementData}. */ static std::vector get_dpo_vector(unsigned int degree); - - /** - * Degree of the polynomials. - */ - const unsigned int degree; /** * Allow access from other dimensions. diff --git a/deal.II/deal.II/include/fe/fe_dgp_monomial.h b/deal.II/deal.II/include/fe/fe_dgp_monomial.h index e6865e48a6..6d4b2f5fb1 100644 --- a/deal.II/deal.II/include/fe/fe_dgp_monomial.h +++ b/deal.II/deal.II/include/fe/fe_dgp_monomial.h @@ -54,14 +54,6 @@ class FE_DGPMonomial : public FE_Poly,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,dim> /*@}*/ -template -inline unsigned int -FE_DGPMonomial::get_degree () const -{ - return this->poly_space.degree(); -} - #endif diff --git a/deal.II/deal.II/include/fe/fe_dgq.h b/deal.II/deal.II/include/fe/fe_dgq.h index 5bd213fe0b..b2e007aa85 100644 --- a/deal.II/deal.II/include/fe/fe_dgq.h +++ b/deal.II/deal.II/include/fe/fe_dgq.h @@ -54,14 +54,6 @@ class FE_DGQ : public FE_Poly,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,dim> */ void rotate_indices (std::vector &indices, const char direction) const; - - /** - * Degree of the polynomials. - */ - const unsigned int degree; /** * Allow access from other dimensions. diff --git a/deal.II/deal.II/include/fe/fe_poly.h b/deal.II/deal.II/include/fe/fe_poly.h index be0f707c26..9a22974b6a 100644 --- a/deal.II/deal.II/include/fe/fe_poly.h +++ b/deal.II/deal.II/include/fe/fe_poly.h @@ -64,11 +64,20 @@ class FE_Poly : public FiniteElement /** * Constructor. */ - FE_Poly (const POLY& poly_space, + FE_Poly (unsigned int degree, + const POLY& poly_space, const FiniteElementData &fe_data, const std::vector &restriction_is_additive_flags, const std::vector > &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 * ith shape function at @@ -388,6 +397,11 @@ class FE_Poly : public FiniteElement */ Table<2,Tensor<1,dim> > shape_gradients; }; + + /** + * Degree of the polynomials. + */ + const unsigned int degree; /** * The polynomial space. Its type diff --git a/deal.II/deal.II/include/fe/fe_q.h b/deal.II/deal.II/include/fe/fe_q.h index 8491866a8d..2dacccea9e 100644 --- a/deal.II/deal.II/include/fe/fe_q.h +++ b/deal.II/deal.II/include/fe/fe_q.h @@ -255,14 +255,6 @@ class FE_Q : public FE_Poly,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,dim> * constructor. */ void initialize_unit_face_support_points (); - - /** - * Degree of the polynomials. - */ - const unsigned int degree; /** * Mapping from hierarchic to diff --git a/deal.II/deal.II/include/fe/fe_q_hierarchical.h b/deal.II/deal.II/include/fe/fe_q_hierarchical.h index 2ddad0c47c..5b4ffc63d0 100644 --- a/deal.II/deal.II/include/fe/fe_q_hierarchical.h +++ b/deal.II/deal.II/include/fe/fe_q_hierarchical.h @@ -16,10 +16,7 @@ #include #include #include -#include -//#include -template class TensorProductPolynomials; template class MappingQ; @@ -253,14 +250,6 @@ class FE_Q_Hierarchical : public FE_Poly,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,dim> * constructor. */ void initialize_unit_face_support_points (); - - /** - * Degree of the polynomials. - */ - const unsigned int degree; /** * Mapping from lexicographic to diff --git a/deal.II/deal.II/source/fe/fe_dgp.cc b/deal.II/deal.II/source/fe/fe_dgp.cc index 3674811da9..c833fc630a 100644 --- a/deal.II/deal.II/source/fe/fe_dgp.cc +++ b/deal.II/deal.II/source/fe/fe_dgp.cc @@ -24,12 +24,12 @@ template FE_DGP::FE_DGP (const unsigned int degree) : FE_Poly, dim> ( + degree, PolynomialSpace(Polynomials::Legendre::generate_complete_basis(degree)), FiniteElementData(get_dpo_vector(degree), 1, degree), std::vector(FiniteElementData(get_dpo_vector(degree), 1, degree).dofs_per_cell,true), std::vector >(FiniteElementData( - get_dpo_vector(degree), 1, degree).dofs_per_cell, std::vector(1,true))), - degree(degree) + get_dpo_vector(degree), 1, degree).dofs_per_cell, std::vector(1,true))) { // if defined, copy over matrices // from precomputed arrays @@ -148,14 +148,4 @@ FE_DGP::memory_consumption () const -template -unsigned int -FE_DGP::get_degree () const -{ - return degree; -} - - - - template class FE_DGP; diff --git a/deal.II/deal.II/source/fe/fe_dgp_monomial.cc b/deal.II/deal.II/source/fe/fe_dgp_monomial.cc index d86f3c513a..32defe27b4 100644 --- a/deal.II/deal.II/source/fe/fe_dgp_monomial.cc +++ b/deal.II/deal.II/source/fe/fe_dgp_monomial.cc @@ -111,6 +111,7 @@ template FE_DGPMonomial::FE_DGPMonomial (const unsigned int degree) : FE_Poly, dim> ( + degree, PolynomialsP(degree), FiniteElementData(get_dpo_vector(degree), 1, degree), std::vector(FiniteElementData(get_dpo_vector(degree), 1, degree).dofs_per_cell,true), @@ -118,6 +119,7 @@ FE_DGPMonomial::FE_DGPMonomial (const unsigned int degree) get_dpo_vector(degree), 1, degree).dofs_per_cell, std::vector(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::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 FiniteElement * FE_DGPMonomial::clone() const { - return new FE_DGPMonomial(get_degree()); + return new FE_DGPMonomial(this->degree); } @@ -211,7 +213,7 @@ void FE_DGPMonomial::initialize_embedding () { std::vector > unit_points(this->dofs_per_cell); - generate_unit_points(get_degree(), unit_points); + generate_unit_points(this->degree, unit_points); FullMatrix cell_interpolation (this->dofs_per_cell, this->dofs_per_cell); @@ -245,7 +247,7 @@ FE_DGPMonomial::initialize_embedding () // cut off very small values for (unsigned int i=0; idofs_per_cell; ++i) for (unsigned int j=0; jdofs_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 diff --git a/deal.II/deal.II/source/fe/fe_dgq.cc b/deal.II/deal.II/source/fe/fe_dgq.cc index 0e5e6f8e9e..a55ec58c91 100644 --- a/deal.II/deal.II/source/fe/fe_dgq.cc +++ b/deal.II/deal.II/source/fe/fe_dgq.cc @@ -136,12 +136,12 @@ template FE_DGQ::FE_DGQ (const unsigned int degree) : FE_Poly, dim> ( + degree, TensorProductPolynomials(Polynomials::LagrangeEquidistant::generate_complete_basis(degree)), FiniteElementData(get_dpo_vector(degree), 1, degree), std::vector(FiniteElementData(get_dpo_vector(degree),1, degree).dofs_per_cell, true), std::vector >(FiniteElementData( - get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector(1,true))), - degree(degree) + get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector(1,true))) { // generate permutation/rotation // index sets to generate some @@ -623,14 +623,4 @@ FE_DGQ::memory_consumption () const -template -unsigned int -FE_DGQ::get_degree () const -{ - return degree; -} - - - - template class FE_DGQ; diff --git a/deal.II/deal.II/source/fe/fe_poly.cc b/deal.II/deal.II/source/fe/fe_poly.cc index 02df1791a9..00262b4d27 100644 --- a/deal.II/deal.II/source/fe/fe_poly.cc +++ b/deal.II/deal.II/source/fe/fe_poly.cc @@ -18,17 +18,26 @@ template -FE_Poly::FE_Poly (const POLY& poly_space, +FE_Poly::FE_Poly (unsigned int degree, + const POLY& poly_space, const FiniteElementData &fe_data, const std::vector &restriction_is_additive_flags, const std::vector > &nonzero_components): FiniteElement (fe_data, restriction_is_additive_flags, nonzero_components), - poly_space(poly_space) + degree(degree), + poly_space(poly_space) {} +template +unsigned int +FE_Poly::get_degree () const +{ + return degree; +} + template double diff --git a/deal.II/deal.II/source/fe/fe_q.cc b/deal.II/deal.II/source/fe/fe_q.cc index 89aa457bc9..755a56d2ee 100644 --- a/deal.II/deal.II/source/fe/fe_q.cc +++ b/deal.II/deal.II/source/fe/fe_q.cc @@ -423,13 +423,13 @@ template FE_Q::FE_Q (const unsigned int degree) : FE_Poly, dim> ( + degree, TensorProductPolynomials(Polynomials::LagrangeEquidistant::generate_complete_basis(degree)), FiniteElementData(get_dpo_vector(degree),1, degree), std::vector (FiniteElementData( get_dpo_vector(degree),1, degree).dofs_per_cell, false), std::vector >(FiniteElementData( get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector(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::memory_consumption () const -template -unsigned int -FE_Q::get_degree () const -{ - return degree; -} - - - template class FE_Q; diff --git a/deal.II/deal.II/source/fe/fe_q_hierarchical.cc b/deal.II/deal.II/source/fe/fe_q_hierarchical.cc index f835f87060..1054eb7e3a 100644 --- a/deal.II/deal.II/source/fe/fe_q_hierarchical.cc +++ b/deal.II/deal.II/source/fe/fe_q_hierarchical.cc @@ -39,13 +39,13 @@ template FE_Q_Hierarchical::FE_Q_Hierarchical (const unsigned int degree) : FE_Poly, dim> ( + degree, Polynomials::Hierarchical::generate_complete_basis(degree), FiniteElementData(get_dpo_vector(degree),1, degree), std::vector (FiniteElementData( get_dpo_vector(degree),1, degree).dofs_per_cell, false), std::vector >(FiniteElementData( get_dpo_vector(degree),1, degree).dofs_per_cell, std::vector(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::memory_consumption () const -template -unsigned int -FE_Q_Hierarchical::get_degree () const -{ - return degree; -} - - - template class FE_Q_Hierarchical;