From 382ba57b80899993d29f91ed93f42fdd406528b5 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 3 Jul 2021 09:51:08 -0400 Subject: [PATCH] Add a more general ctor for FE_SimplexPoly. This will let us implement FE_SimplexP_Bubbles as an inheriting class in a few more commits. --- include/deal.II/fe/fe_simplex_p.h | 16 +++++++- source/fe/fe_simplex_p.cc | 67 +++++++++++++++++-------------- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/include/deal.II/fe/fe_simplex_p.h b/include/deal.II/fe/fe_simplex_p.h index fc228114e5..85c05da306 100644 --- a/include/deal.II/fe/fe_simplex_p.h +++ b/include/deal.II/fe/fe_simplex_p.h @@ -25,7 +25,7 @@ DEAL_II_NAMESPACE_OPEN /** - * Base class of FE_SimplexP and FE_SimplexDGP. + * Base class of FE_SimplexP, FE_SimplexDGP, and FE_SimplexP_Bubbles. * * @note Only implemented for 2D and 3D. * @@ -42,6 +42,16 @@ public: const std::vector & dpo_vector, const typename FiniteElementData::Conformity conformity); + /** + * Constructor. + */ + FE_SimplexPoly( + const BarycentricPolynomials polynomials, + const FiniteElementData & fe_data, + const std::vector> & unit_support_points, + const std::vector>> unit_face_support_points, + const FullMatrix & interface_constraints); + /** * Return a list of constant modes of the element. For this element, the * list consists of true arguments for all components. @@ -103,6 +113,10 @@ public: const std::vector> &support_point_values, std::vector & nodal_values) const override; +protected: + /** + * Mutex used to guard computation of some internal lookup tables. + */ mutable Threads::Mutex mutex; }; diff --git a/source/fe/fe_simplex_p.cc b/source/fe/fe_simplex_p.cc index 629623fb54..25b4ff98ce 100644 --- a/source/fe/fe_simplex_p.cc +++ b/source/fe/fe_simplex_p.cc @@ -163,8 +163,14 @@ namespace */ template std::vector>> - unit_face_support_points_fe_poly(const unsigned int degree) + unit_face_support_points_fe_poly( + const unsigned int degree, + typename FiniteElementData::Conformity conformity) { + // Discontinuous elements don't have face support points + if (conformity == FiniteElementData::Conformity::L2) + return {}; + // this concept doesn't exist in 1D so just return an empty vector if (dim == 1) return {}; @@ -313,37 +319,38 @@ FE_SimplexPoly::FE_SimplexPoly( const unsigned int degree, const std::vector & dpo_vector, const typename FiniteElementData::Conformity conformity) + : FE_SimplexPoly(BarycentricPolynomials::get_fe_p_basis(degree), + FiniteElementData(dpo_vector, + dim == 2 ? + ReferenceCells::Triangle : + ReferenceCells::Tetrahedron, + 1, + degree, + conformity), + unit_support_points_fe_poly(degree), + unit_face_support_points_fe_poly(degree, conformity), + constraints_fe_poly(degree)) +{} + + + +template +FE_SimplexPoly::FE_SimplexPoly( + const BarycentricPolynomials polynomials, + const FiniteElementData & fe_data, + const std::vector> & unit_support_points, + const std::vector>> unit_face_support_points, + const FullMatrix & interface_constraints) : dealii::FE_Poly( - BarycentricPolynomials::get_fe_p_basis(degree), - FiniteElementData(dpo_vector, - dim == 2 ? ReferenceCells::Triangle : - ReferenceCells::Tetrahedron, - 1, - degree, - conformity), - std::vector(FiniteElementData(dpo_vector, - dim == 2 ? - ReferenceCells::Triangle : - ReferenceCells::Tetrahedron, - 1, - degree) - .dofs_per_cell, - true), - std::vector( - FiniteElementData(dpo_vector, - dim == 2 ? ReferenceCells::Triangle : - ReferenceCells::Tetrahedron, - 1, - degree) - .dofs_per_cell, - std::vector(1, true))) + polynomials, + fe_data, + std::vector(fe_data.dofs_per_cell), + std::vector(fe_data.dofs_per_cell, + std::vector(1, true))) { - this->unit_support_points = unit_support_points_fe_poly(degree); - // Discontinuous elements don't have face support points - if (conformity == FiniteElementData::Conformity::H1) - this->unit_face_support_points = - unit_face_support_points_fe_poly(degree); - this->interface_constraints = constraints_fe_poly(degree); + this->unit_support_points = unit_support_points; + this->unit_face_support_points = unit_face_support_points; + this->interface_constraints = interface_constraints; } -- 2.39.5