From 3ef3545b4b8446c65de87b2b0b2f8c2db7d12f6c Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 3 Jul 2021 11:04:21 -0400 Subject: [PATCH] Make FE_SimplexP work better in 1D. This is useful when initializing face info. --- include/deal.II/grid/reference_cell.h | 2 +- source/fe/fe_simplex_p.cc | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index 1b25b65c72..41d53d6c64 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -656,7 +656,7 @@ namespace ReferenceCells /** * Return the correct simplex reference cell type for the given dimension * `dim`. Depending on the template argument `dim`, this function returns a - * reference to either Vertex, Triangle, or Tetrahedron. + * reference to either Vertex, Line, Triangle, or Tetrahedron. */ template constexpr const ReferenceCell & diff --git a/source/fe/fe_simplex_p.cc b/source/fe/fe_simplex_p.cc index a41434af29..4d559e5363 100644 --- a/source/fe/fe_simplex_p.cc +++ b/source/fe/fe_simplex_p.cc @@ -84,6 +84,12 @@ namespace unit_support_points_fe_p(const unsigned int degree) { std::vector> unit_points; + // If we do dim - 1 we can get here in dim = 0: + if (dim == 0) + { + unit_points.emplace_back(); + return unit_points; + } // Piecewise constants are a special case: use a support point at the // centroid and only the centroid @@ -178,9 +184,7 @@ namespace std::vector>> unit_face_points; // all faces have the same support points - for (auto face_n : - (dim == 2 ? ReferenceCells::Triangle : ReferenceCells::Tetrahedron) - .face_indices()) + for (auto face_n : ReferenceCells::get_simplex().face_indices()) { (void)face_n; unit_face_points.emplace_back( @@ -610,8 +614,7 @@ FE_SimplexP::FE_SimplexP(const unsigned int degree) : FE_SimplexPoly( BarycentricPolynomials::get_fe_p_basis(degree), FiniteElementData(get_dpo_vector_fe_p(dim, degree), - dim == 2 ? ReferenceCells::Triangle : - ReferenceCells::Tetrahedron, + ReferenceCells::get_simplex(), 1, degree, FiniteElementData::H1), @@ -838,8 +841,7 @@ FE_SimplexDGP::FE_SimplexDGP(const unsigned int degree) : FE_SimplexPoly( BarycentricPolynomials::get_fe_p_basis(degree), FiniteElementData(get_dpo_vector_fe_dgp(dim, degree), - dim == 2 ? ReferenceCells::Triangle : - ReferenceCells::Tetrahedron, + ReferenceCells::get_simplex(), 1, degree, FiniteElementData::L2), -- 2.39.5