From f424f071c4328f28f56f3f5a55c408abf3429fd0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 21 Jan 2021 12:48:58 -0700 Subject: [PATCH] Make get_hypercube/simplex static members of ReferenceCell::Type. --- include/deal.II/base/qprojector.h | 3 +- include/deal.II/fe/fe_poly_face.h | 2 +- include/deal.II/grid/grid_tools.h | 14 +++---- include/deal.II/grid/grid_tools_cache.h | 2 +- include/deal.II/grid/reference_cell.h | 41 +++++++++++++------ .../matrix_free/mapping_info.templates.h | 4 +- .../matrix_free/matrix_free.templates.h | 2 +- .../matrix_free/shape_info.templates.h | 2 +- .../numerics/vector_tools_constraints.h | 8 ++-- .../numerics/vector_tools_project.templates.h | 2 +- include/deal.II/particles/generators.h | 10 ++--- source/base/data_out_base.cc | 35 +++++++++------- source/base/qprojector.cc | 26 ++++++------ source/fe/fe_nedelec.cc | 6 +-- source/fe/fe_nothing.cc | 4 +- source/fe/fe_q_base.cc | 10 ++--- source/fe/mapping_cartesian.cc | 11 +++-- source/fe/mapping_fe_field.cc | 11 +++-- source/fe/mapping_manifold.cc | 9 ++-- source/fe/mapping_q_generic.cc | 9 ++-- source/grid/manifold.cc | 2 +- source/grid/reference_cell.cc | 12 +++--- source/grid/tria.cc | 3 +- source/multigrid/mg_tools.cc | 6 ++- source/numerics/data_out.cc | 2 +- tests/simplex/cell_measure_01.cc | 2 +- 26 files changed, 133 insertions(+), 105 deletions(-) diff --git a/include/deal.II/base/qprojector.h b/include/deal.II/base/qprojector.h index 4036d1b4e1..501e6eeabb 100644 --- a/include/deal.II/base/qprojector.h +++ b/include/deal.II/base/qprojector.h @@ -602,7 +602,8 @@ template Quadrature inline QProjector::project_to_all_faces( const Quadrature &quadrature) { - return project_to_all_faces(ReferenceCell::get_hypercube(), quadrature); + return project_to_all_faces(ReferenceCell::Type::get_hypercube(), + quadrature); } diff --git a/include/deal.II/fe/fe_poly_face.h b/include/deal.II/fe/fe_poly_face.h index 3038921d24..5e3db0d40d 100644 --- a/include/deal.II/fe/fe_poly_face.h +++ b/include/deal.II/fe/fe_poly_face.h @@ -178,7 +178,7 @@ protected: update_flags, mapping, hp::QCollection(QProjector::project_to_all_children( - ReferenceCell::get_hypercube(), quadrature)), + ReferenceCell::Type::get_hypercube(), quadrature)), output_data); } diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 3f70a9e302..17661eeb38 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -177,7 +177,7 @@ namespace GridTools volume(const Triangulation &tria, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Return an approximation of the diameter of the smallest active cell of a @@ -195,7 +195,7 @@ namespace GridTools const Triangulation &triangulation, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Return an approximation of the diameter of the largest active cell of a @@ -213,7 +213,7 @@ namespace GridTools const Triangulation &triangulation, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Given a list of vertices (typically obtained using @@ -1045,7 +1045,7 @@ namespace GridTools const Triangulation &container, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Find and return the index of the closest vertex to a given point in the @@ -1873,7 +1873,7 @@ namespace GridTools const Point & position, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Compute a globally unique index for each vertex and hanging node @@ -3261,7 +3261,7 @@ namespace GridTools !cell->face(face)->at_boundary()) { Assert(cell->reference_cell_type() == - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); // this line has children @@ -3281,7 +3281,7 @@ namespace GridTools !cell->face(face)->at_boundary()) { Assert(cell->reference_cell_type() == - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); // this face has hanging nodes diff --git a/include/deal.II/grid/grid_tools_cache.h b/include/deal.II/grid/grid_tools_cache.h index e3dd0b8b20..99112c91f1 100644 --- a/include/deal.II/grid/grid_tools_cache.h +++ b/include/deal.II/grid/grid_tools_cache.h @@ -77,7 +77,7 @@ namespace GridTools Cache(const Triangulation &tria, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Destructor. diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index 0a33f62393..1eda918fca 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -61,6 +61,25 @@ namespace ReferenceCell static const Type Hex; static const Type Invalid; + /** + * 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, Tri, or Tet. + */ + template + static constexpr const Type & + get_simplex(); + + + /** + * Return the correct hypercube reference cell type for the given dimension + * `dim`. Depending on the template argument `dim`, this function returns a + * reference to either Vertex, Quad, or Hex. + */ + template + static constexpr const Type & + get_hypercube(); + /** * Default constructor. Initialize this object as an invalid object. */ @@ -362,13 +381,11 @@ namespace ReferenceCell return "Invalid"; } - /** - * Return the correct simplex reference cell type for the given dimension - * @p dim. - */ + + template - inline const Type & - get_simplex() + inline constexpr const Type & + Type::get_simplex() { switch (dim) { @@ -386,13 +403,11 @@ namespace ReferenceCell } } - /** - * Return the correct hypercube reference cell type for the given dimension - * @p dim. - */ + + template - inline const Type & - get_hypercube() + inline constexpr const Type & + Type::get_hypercube() { switch (dim) { @@ -640,7 +655,7 @@ namespace ReferenceCell { AssertDimension(dim, reference_cell.get_dimension()); - if (reference_cell == get_hypercube()) + if (reference_cell == Type::get_hypercube()) { AssertIndexRange(face_no, GeometryInfo::faces_per_cell); return GeometryInfo::unit_normal_vector[face_no]; diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 29c506c454..8fbbca7d50 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -1756,8 +1756,8 @@ namespace internal Assert(index < dim, ExcInternalError()); if ((reference_cell_type == ReferenceCell::Type::Invalid || - reference_cell_type == ReferenceCell::get_hypercube()) == - false) + reference_cell_type == + ReferenceCell::Type::get_hypercube()) == false) { #ifdef DEAL_II_WITH_SIMPLEX_SUPPORT return index; diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index bf45d40edb..14f25e4a76 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -1481,7 +1481,7 @@ MatrixFree::initialize_indices( ++fe_no) shape_info_dummy(c, fe_no).reinit( dof_handlers[no]->get_fe(fe_no).reference_cell_type() == - ReferenceCell::get_hypercube() ? + ReferenceCell::Type::get_hypercube() ? quad : quad_simplex, dof_handlers[no]->get_fe(fe_no), diff --git a/include/deal.II/matrix_free/shape_info.templates.h b/include/deal.II/matrix_free/shape_info.templates.h index 6b36dc12bc..c738ba254b 100644 --- a/include/deal.II/matrix_free/shape_info.templates.h +++ b/include/deal.II/matrix_free/shape_info.templates.h @@ -317,7 +317,7 @@ namespace internal try { const auto reference_cell_type = - ReferenceCell::get_simplex(); + ReferenceCell::Type::get_simplex(); const auto quad_face = get_face_quadrature(quad); this->n_q_points_face = quad_face.size(); diff --git a/include/deal.II/numerics/vector_tools_constraints.h b/include/deal.II/numerics/vector_tools_constraints.h index 1c948d1b12..3d53a53a4b 100644 --- a/include/deal.II/numerics/vector_tools_constraints.h +++ b/include/deal.II/numerics/vector_tools_constraints.h @@ -281,7 +281,7 @@ namespace VectorTools AffineConstraints & constraints, const Mapping &mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * This function does the same as the @@ -304,7 +304,7 @@ namespace VectorTools AffineConstraints & constraints, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Compute the constraints that correspond to boundary conditions of the @@ -333,7 +333,7 @@ namespace VectorTools AffineConstraints & constraints, const Mapping &mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * Same as above for homogeneous tangential-flux constraints. @@ -352,7 +352,7 @@ namespace VectorTools AffineConstraints & constraints, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); //@} } // namespace VectorTools diff --git a/include/deal.II/numerics/vector_tools_project.templates.h b/include/deal.II/numerics/vector_tools_project.templates.h index 0f0c5a6ae2..bd79339fba 100644 --- a/include/deal.II/numerics/vector_tools_project.templates.h +++ b/include/deal.II/numerics/vector_tools_project.templates.h @@ -184,7 +184,7 @@ namespace VectorTools Quadrature quadrature_mf; if (dof.get_fe(0).reference_cell_type() == - ReferenceCell::get_hypercube()) + ReferenceCell::Type::get_hypercube()) quadrature_mf = QGauss(dof.get_fe().degree + 2); else // TODO: since we have currently only implemented a handful quadrature diff --git a/include/deal.II/particles/generators.h b/include/deal.II/particles/generators.h index ca1c12d621..a5dd84ba75 100644 --- a/include/deal.II/particles/generators.h +++ b/include/deal.II/particles/generators.h @@ -70,7 +70,7 @@ namespace Particles ParticleHandler & particle_handler, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * A function that generates one particle at a random location in cell @p cell and with @@ -109,7 +109,7 @@ namespace Particles std::mt19937 & random_number_generator, const Mapping &mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube())); + ReferenceCell::Type::get_hypercube())); /** * A function that generates particles randomly in the domain with a @@ -165,7 +165,7 @@ namespace Particles ParticleHandler & particle_handler, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube()), + ReferenceCell::Type::get_hypercube()), const unsigned int random_number_seed = 5432); @@ -212,7 +212,7 @@ namespace Particles ParticleHandler &particle_handler, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube()), + ReferenceCell::Type::get_hypercube()), const ComponentMask & components = ComponentMask(), const std::vector> &properties = {}); @@ -257,7 +257,7 @@ namespace Particles ParticleHandler &particle_handler, const Mapping & mapping = ReferenceCell::get_default_linear_mapping( - ReferenceCell::get_hypercube()), + ReferenceCell::Type::get_hypercube()), const std::vector> &properties = {}); } // namespace Generators } // namespace Particles diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 300918747c..66d97d7f2e 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -294,7 +294,7 @@ namespace DataOutBase n_data_sets, patch.data.n_rows())); Assert(patch.reference_cell_type != - ReferenceCell::get_hypercube() || + ReferenceCell::Type::get_hypercube() || (n_data_sets == 0) || (patch.data.n_cols() == Utilities::fixed_power(n_subdivisions + 1)), @@ -616,7 +616,8 @@ namespace if (write_higher_order_cells) { - if (patch.reference_cell_type == ReferenceCell::get_hypercube()) + if (patch.reference_cell_type == + ReferenceCell::Type::get_hypercube()) { const std::array cell_type_by_dim{ {VTK_VERTEX, @@ -667,7 +668,8 @@ namespace vtk_cell_id[0] = VTK_PYRAMID; vtk_cell_id[1] = 1; } - else if (patch.reference_cell_type == ReferenceCell::get_hypercube()) + else if (patch.reference_cell_type == + ReferenceCell::Type::get_hypercube()) { const std::array cell_type_by_dim{ {VTK_VERTEX, VTK_LINE, VTK_QUAD, VTK_HEXAHEDRON}}; @@ -679,7 +681,8 @@ namespace Assert(false, ExcNotImplemented()); } - if (patch.reference_cell_type != ReferenceCell::get_hypercube() || + if (patch.reference_cell_type != + ReferenceCell::Type::get_hypercube() || write_higher_order_cells) vtk_cell_id[2] = patch.data.n_cols(); else @@ -915,7 +918,8 @@ namespace for (const auto &patch : patches) { // The following formula doesn't hold for non-tensor products. - if (patch.reference_cell_type == ReferenceCell::get_hypercube()) + if (patch.reference_cell_type == + ReferenceCell::Type::get_hypercube()) { n_nodes += Utilities::fixed_power(patch.n_subdivisions + 1); n_cells += Utilities::fixed_power(patch.n_subdivisions); @@ -946,7 +950,8 @@ namespace for (const auto &patch : patches) { // The following formulas don't hold for non-tensor products. - if (patch.reference_cell_type == ReferenceCell::get_hypercube()) + if (patch.reference_cell_type == + ReferenceCell::Type::get_hypercube()) { n_nodes += Utilities::fixed_power(patch.n_subdivisions + 1); @@ -1862,7 +1867,7 @@ namespace DataOutBase : patch_index(no_neighbor) , n_subdivisions(1) , points_are_available(false) - , reference_cell_type(ReferenceCell::get_hypercube()) + , reference_cell_type(ReferenceCell::Type::get_hypercube()) // all the other data has a constructor of its own, except for the "neighbors" // field, which we set to invalid values. { @@ -1964,7 +1969,7 @@ namespace DataOutBase Patch<0, spacedim>::Patch() : patch_index(no_neighbor) , points_are_available(false) - , reference_cell_type(ReferenceCell::get_hypercube<0>()) + , reference_cell_type(ReferenceCell::Type::get_hypercube<0>()) { Assert(spacedim <= 3, ExcNotImplemented()); } @@ -2627,7 +2632,8 @@ namespace DataOutBase // special treatment of simplices since they are not subdivided, such // that no new nodes have to be created, but the precomputed ones can be // used - if (patch.reference_cell_type != ReferenceCell::get_hypercube()) + if (patch.reference_cell_type != + ReferenceCell::Type::get_hypercube()) { Point node; @@ -2671,7 +2677,8 @@ namespace DataOutBase for (const auto &patch : patches) { // special treatment of simplices since they are not subdivided - if (patch.reference_cell_type != ReferenceCell::get_hypercube()) + if (patch.reference_cell_type != + ReferenceCell::Type::get_hypercube()) { out.write_cell_single(count++, first_vertex_of_patch, @@ -8647,16 +8654,16 @@ XDMFEntry::get_xdmf_content(const unsigned int indent_level) const { case 0: return get_xdmf_content(indent_level, - ReferenceCell::get_hypercube<0>()); + ReferenceCell::Type::get_hypercube<0>()); case 1: return get_xdmf_content(indent_level, - ReferenceCell::get_hypercube<1>()); + ReferenceCell::Type::get_hypercube<1>()); case 2: return get_xdmf_content(indent_level, - ReferenceCell::get_hypercube<2>()); + ReferenceCell::Type::get_hypercube<2>()); case 3: return get_xdmf_content(indent_level, - ReferenceCell::get_hypercube<3>()); + ReferenceCell::Type::get_hypercube<3>()); default: Assert(false, ExcNotImplemented()); } diff --git a/source/base/qprojector.cc b/source/base/qprojector.cc index 1b0a60e397..6d05bf719b 100644 --- a/source/base/qprojector.cc +++ b/source/base/qprojector.cc @@ -1159,7 +1159,7 @@ Quadrature QProjector::project_to_child(const Quadrature &quadrature, const unsigned int child_no) { - return project_to_child(ReferenceCell::get_hypercube(), + return project_to_child(ReferenceCell::Type::get_hypercube(), quadrature, child_no); } @@ -1172,7 +1172,7 @@ QProjector::project_to_child(const ReferenceCell::Type reference_cell_type, const Quadrature & quadrature, const unsigned int child_no) { - Assert(reference_cell_type == ReferenceCell::get_hypercube(), + Assert(reference_cell_type == ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); (void)reference_cell_type; @@ -1202,7 +1202,7 @@ template Quadrature QProjector::project_to_all_children(const Quadrature &quadrature) { - return project_to_all_children(ReferenceCell::get_hypercube(), + return project_to_all_children(ReferenceCell::Type::get_hypercube(), quadrature); } @@ -1214,7 +1214,7 @@ QProjector::project_to_all_children( const ReferenceCell::Type reference_cell_type, const Quadrature & quadrature) { - Assert(reference_cell_type == ReferenceCell::get_hypercube(), + Assert(reference_cell_type == ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); (void)reference_cell_type; @@ -1246,7 +1246,7 @@ QProjector::project_to_line(const Quadrature<1> &quadrature, const Point & p1, const Point & p2) { - return project_to_line(ReferenceCell::get_hypercube(), + return project_to_line(ReferenceCell::Type::get_hypercube(), quadrature, p1, p2); @@ -1261,7 +1261,7 @@ QProjector::project_to_line(const ReferenceCell::Type reference_cell_type, const Point & p1, const Point & p2) { - Assert(reference_cell_type == ReferenceCell::get_hypercube(), + Assert(reference_cell_type == ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); (void)reference_cell_type; @@ -1290,7 +1290,7 @@ QProjector::DataSetDescriptor::face(const unsigned int face_no, const bool face_rotation, const unsigned int n_quadrature_points) { - return face(ReferenceCell::get_hypercube(), + return face(ReferenceCell::Type::get_hypercube(), face_no, face_orientation, face_flip, @@ -1323,7 +1323,7 @@ QProjector::DataSetDescriptor::face( } } - Assert(reference_cell_type == ReferenceCell::get_hypercube(), + Assert(reference_cell_type == ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); Assert(face_no < GeometryInfo::faces_per_cell, ExcInternalError()); @@ -1442,7 +1442,7 @@ QProjector::DataSetDescriptor::face( } } - Assert(reference_cell_type == ReferenceCell::get_hypercube(), + Assert(reference_cell_type == ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); Assert(face_no < GeometryInfo::faces_per_cell, ExcInternalError()); @@ -1905,7 +1905,7 @@ Quadrature QProjector::project_to_face(const SubQuadrature &quadrature, const unsigned int face_no) { - return project_to_face(ReferenceCell::get_hypercube(), + return project_to_face(ReferenceCell::Type::get_hypercube(), quadrature, face_no); } @@ -1918,7 +1918,7 @@ QProjector::project_to_face(const ReferenceCell::Type reference_cell_type, const SubQuadrature & quadrature, const unsigned int face_no) { - Assert(reference_cell_type == ReferenceCell::get_hypercube(), + Assert(reference_cell_type == ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); (void)reference_cell_type; @@ -1936,7 +1936,7 @@ QProjector::project_to_subface(const SubQuadrature & quadrature, const unsigned int subface_no, const RefinementCase &ref_case) { - return project_to_subface(ReferenceCell::get_hypercube(), + return project_to_subface(ReferenceCell::Type::get_hypercube(), quadrature, face_no, subface_no, @@ -1954,7 +1954,7 @@ QProjector::project_to_subface( const unsigned int subface_no, const RefinementCase &ref_case) { - Assert(reference_cell_type == ReferenceCell::get_hypercube(), + Assert(reference_cell_type == ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); (void)reference_cell_type; diff --git a/source/fe/fe_nedelec.cc b/source/fe/fe_nedelec.cc index b8c57c48bf..53fdcf559c 100644 --- a/source/fe/fe_nedelec.cc +++ b/source/fe/fe_nedelec.cc @@ -381,7 +381,7 @@ FE_Nedelec<3>::initialize_support_points(const unsigned int order) const unsigned int n_edge_points = reference_edge_quadrature.size(); const Quadrature &edge_quadrature = QProjector::project_to_all_faces( - ReferenceCell::get_hypercube(), reference_edge_quadrature); + ReferenceCell::Type::get_hypercube(), reference_edge_quadrature); if (order > 0) { @@ -414,7 +414,7 @@ FE_Nedelec<3>::initialize_support_points(const unsigned int order) q_point] = edge_quadrature.point( QProjector::DataSetDescriptor::face( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), line, true, false, @@ -515,7 +515,7 @@ FE_Nedelec<3>::initialize_support_points(const unsigned int order) q_point] = edge_quadrature.point( QProjector::DataSetDescriptor::face( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), line, true, false, diff --git a/source/fe/fe_nothing.cc b/source/fe/fe_nothing.cc index 70936e79ce..fc79ef6675 100644 --- a/source/fe/fe_nothing.cc +++ b/source/fe/fe_nothing.cc @@ -51,7 +51,7 @@ FE_Nothing::FE_Nothing(const ReferenceCell::Type &type, template FE_Nothing::FE_Nothing(const unsigned int n_components, const bool dominate) - : FE_Nothing(ReferenceCell::get_hypercube(), + : FE_Nothing(ReferenceCell::Type::get_hypercube(), n_components, dominate) {} @@ -75,7 +75,7 @@ FE_Nothing::get_name() const namebuf << "FE_Nothing<" << Utilities::dim_string(dim, spacedim) << ">("; std::vector name_components; - if (this->reference_cell_type() != ReferenceCell::get_hypercube()) + if (this->reference_cell_type() != ReferenceCell::Type::get_hypercube()) name_components.push_back(this->reference_cell_type().to_string()); if (this->n_components() > 1) name_components.push_back(std::to_string(this->n_components())); diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 4b61a9fc0e..77a219bca4 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -263,22 +263,22 @@ struct FE_Q_Base::Implementation // line 5: use line 9 QProjector::project_to_subface( - ReferenceCell::get_hypercube(), qline, 0, 0, p_line); + ReferenceCell::Type::get_hypercube(), qline, 0, 0, p_line); for (unsigned int i = 0; i < n; ++i) constraint_points.push_back(p_line[i] + Point(0.5, 0)); // line 6: use line 10 QProjector::project_to_subface( - ReferenceCell::get_hypercube(), qline, 0, 1, p_line); + ReferenceCell::Type::get_hypercube(), qline, 0, 1, p_line); for (unsigned int i = 0; i < n; ++i) constraint_points.push_back(p_line[i] + Point(0.5, 0)); // line 7: use line 13 QProjector::project_to_subface( - ReferenceCell::get_hypercube(), qline, 2, 0, p_line); + ReferenceCell::Type::get_hypercube(), qline, 2, 0, p_line); for (unsigned int i = 0; i < n; ++i) constraint_points.push_back(p_line[i] + Point(0, 0.5)); // line 8: use line 14 QProjector::project_to_subface( - ReferenceCell::get_hypercube(), qline, 2, 1, p_line); + ReferenceCell::Type::get_hypercube(), qline, 2, 1, p_line); for (unsigned int i = 0; i < n; ++i) constraint_points.push_back(p_line[i] + Point(0, 0.5)); @@ -291,7 +291,7 @@ struct FE_Q_Base::Implementation ++subface) { QProjector::project_to_subface( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), qline, face, subface, diff --git a/source/fe/mapping_cartesian.cc b/source/fe/mapping_cartesian.cc index 70cfc44890..dbb65d925e 100644 --- a/source/fe/mapping_cartesian.cc +++ b/source/fe/mapping_cartesian.cc @@ -117,9 +117,8 @@ MappingCartesian::get_face_data( AssertDimension(quadrature.size(), 1); std::unique_ptr::InternalDataBase> data_ptr = - std::make_unique( - QProjector::project_to_all_faces(ReferenceCell::get_hypercube(), - quadrature[0])); + std::make_unique(QProjector::project_to_all_faces( + ReferenceCell::Type::get_hypercube(), quadrature[0])); auto &data = dynamic_cast(*data_ptr); // verify that we have computed the transitive hull of the required @@ -144,7 +143,7 @@ MappingCartesian::get_subface_data( { std::unique_ptr::InternalDataBase> data_ptr = std::make_unique(QProjector::project_to_all_subfaces( - ReferenceCell::get_hypercube(), quadrature)); + ReferenceCell::Type::get_hypercube(), quadrature)); auto &data = dynamic_cast(*data_ptr); // verify that we have computed the transitive hull of the required @@ -227,7 +226,7 @@ MappingCartesian::maybe_update_face_quadrature_points( if (data.update_each & update_quadrature_points) { const auto offset = QProjector::DataSetDescriptor::face( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, cell->face_orientation(face_no), cell->face_flip(face_no), @@ -260,7 +259,7 @@ MappingCartesian::maybe_update_subface_quadrature_points( if (data.update_each & update_quadrature_points) { const auto offset = QProjector::DataSetDescriptor::subface( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, sub_no, cell->face_orientation(face_no), diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index bf64cef305..0cad06d6f4 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -624,9 +624,8 @@ MappingFEField::get_face_data( std::unique_ptr::InternalDataBase> data_ptr = std::make_unique(euler_dof_handler->get_fe(), fe_mask); auto & data = dynamic_cast(*data_ptr); - const Quadrature q( - QProjector::project_to_all_faces(ReferenceCell::get_hypercube(), - quadrature[0])); + const Quadrature q(QProjector::project_to_all_faces( + ReferenceCell::Type::get_hypercube(), quadrature[0])); this->compute_face_data(update_flags, q, quadrature[0].size(), data); return data_ptr; @@ -643,7 +642,7 @@ MappingFEField::get_subface_data( std::make_unique(euler_dof_handler->get_fe(), fe_mask); auto & data = dynamic_cast(*data_ptr); const Quadrature q(QProjector::project_to_all_subfaces( - ReferenceCell::get_hypercube(), quadrature)); + ReferenceCell::Type::get_hypercube(), quadrature)); this->compute_face_data(update_flags, q, quadrature.size(), data); return data_ptr; @@ -1701,7 +1700,7 @@ MappingFEField::fill_fe_face_values( face_no, numbers::invalid_unsigned_int, QProjector::DataSetDescriptor::face( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, cell->face_orientation(face_no), cell->face_flip(face_no), @@ -1742,7 +1741,7 @@ MappingFEField::fill_fe_subface_values( face_no, numbers::invalid_unsigned_int, QProjector::DataSetDescriptor::subface( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, subface_no, cell->face_orientation(face_no), diff --git a/source/fe/mapping_manifold.cc b/source/fe/mapping_manifold.cc index bc67670abb..2e4926da34 100644 --- a/source/fe/mapping_manifold.cc +++ b/source/fe/mapping_manifold.cc @@ -292,7 +292,8 @@ MappingManifold::get_face_data( auto &data = dynamic_cast(*data_ptr); data.initialize_face(this->requires_update_flags(update_flags), QProjector::project_to_all_faces( - ReferenceCell::get_hypercube(), quadrature[0]), + ReferenceCell::Type::get_hypercube(), + quadrature[0]), quadrature[0].size()); return data_ptr; @@ -311,7 +312,7 @@ MappingManifold::get_subface_data( auto &data = dynamic_cast(*data_ptr); data.initialize_face(this->requires_update_flags(update_flags), QProjector::project_to_all_subfaces( - ReferenceCell::get_hypercube(), quadrature), + ReferenceCell::Type::get_hypercube(), quadrature), quadrature.size()); return data_ptr; @@ -1228,7 +1229,7 @@ MappingManifold::fill_fe_face_values( face_no, numbers::invalid_unsigned_int, QProjector::DataSetDescriptor::face( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, cell->face_orientation(face_no), cell->face_flip(face_no), @@ -1263,7 +1264,7 @@ MappingManifold::fill_fe_subface_values( face_no, subface_no, QProjector::DataSetDescriptor::subface( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, subface_no, cell->face_orientation(face_no), diff --git a/source/fe/mapping_q_generic.cc b/source/fe/mapping_q_generic.cc index d52f46d86b..02dd963685 100644 --- a/source/fe/mapping_q_generic.cc +++ b/source/fe/mapping_q_generic.cc @@ -885,7 +885,8 @@ MappingQGeneric::get_face_data( auto &data = dynamic_cast(*data_ptr); data.initialize_face(this->requires_update_flags(update_flags), QProjector::project_to_all_faces( - ReferenceCell::get_hypercube(), quadrature[0]), + ReferenceCell::Type::get_hypercube(), + quadrature[0]), quadrature[0].size()); return data_ptr; @@ -904,7 +905,7 @@ MappingQGeneric::get_subface_data( auto &data = dynamic_cast(*data_ptr); data.initialize_face(this->requires_update_flags(update_flags), QProjector::project_to_all_subfaces( - ReferenceCell::get_hypercube(), quadrature), + ReferenceCell::Type::get_hypercube(), quadrature), quadrature.size()); return data_ptr; @@ -1170,7 +1171,7 @@ MappingQGeneric::fill_fe_face_values( face_no, numbers::invalid_unsigned_int, QProjector::DataSetDescriptor::face( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, cell->face_orientation(face_no), cell->face_flip(face_no), @@ -1218,7 +1219,7 @@ MappingQGeneric::fill_fe_subface_values( face_no, subface_no, QProjector::DataSetDescriptor::subface( - ReferenceCell::get_hypercube(), + ReferenceCell::Type::get_hypercube(), face_no, subface_no, cell->face_orientation(face_no), diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index db3fe29da4..7e1c46d797 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -895,7 +895,7 @@ FlatManifold::normal_vector( const auto face_reference_cell_type = face->reference_cell_type(); - if (face_reference_cell_type == ReferenceCell::get_hypercube()) + if (face_reference_cell_type == ReferenceCell::Type::get_hypercube()) { for (unsigned int i = 0; i < facedim; ++i) xi[i] = 1. / 2; diff --git a/source/grid/reference_cell.cc b/source/grid/reference_cell.cc index e0c923af1f..e35fc47476 100644 --- a/source/grid/reference_cell.cc +++ b/source/grid/reference_cell.cc @@ -50,7 +50,7 @@ namespace ReferenceCell { AssertDimension(dim, reference_cell.get_dimension()); - if (reference_cell == get_hypercube()) + if (reference_cell == Type::get_hypercube()) { GridGenerator::hyper_cube(tria, 0, 1); } @@ -123,7 +123,7 @@ namespace ReferenceCell { AssertDimension(dim, reference_cell.get_dimension()); - if (reference_cell == get_hypercube()) + if (reference_cell == Type::get_hypercube()) return std::make_unique>(degree); else if (reference_cell == Type::Tri || reference_cell == Type::Tet) return std::make_unique>( @@ -149,7 +149,7 @@ namespace ReferenceCell { AssertDimension(dim, reference_cell.get_dimension()); - if (reference_cell == get_hypercube()) + if (reference_cell == Type::get_hypercube()) { return StaticMappingQ1::mapping; } @@ -208,7 +208,7 @@ namespace ReferenceCell { AssertDimension(dim, reference_cell.get_dimension()); - if (reference_cell == get_hypercube()) + if (reference_cell == Type::get_hypercube()) return QGauss(n_points_1D); else if (reference_cell == Type::Tri || reference_cell == Type::Tet) return Simplex::QGauss(n_points_1D); @@ -222,6 +222,8 @@ namespace ReferenceCell return Quadrature(); // never reached } + + template Quadrature & get_nodal_type_quadrature(const Type &reference_cell) @@ -235,7 +237,7 @@ namespace ReferenceCell return Quadrature(tria.get_vertices()); }; - if (reference_cell == get_hypercube()) + if (reference_cell == Type::get_hypercube()) { static Quadrature quadrature = create_quadrature(reference_cell); return quadrature; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 09bd146f76..89a6c94cfb 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -13535,7 +13535,8 @@ Triangulation::all_reference_cell_types_are_hyper_cube() const { return (this->reference_cell_types.size() == 0) || (this->reference_cell_types.size() == 1 && - this->reference_cell_types[0] == ReferenceCell::get_hypercube()); + this->reference_cell_types[0] == + ReferenceCell::Type::get_hypercube()); } diff --git a/source/multigrid/mg_tools.cc b/source/multigrid/mg_tools.cc index c52eee597e..d6277b47ee 100644 --- a/source/multigrid/mg_tools.cc +++ b/source/multigrid/mg_tools.cc @@ -165,7 +165,8 @@ namespace MGTools // TODO: This assumes that the dofs per face on all faces coincide! const unsigned int face_no = 0; - Assert(fe.reference_cell_type() == ReferenceCell::get_hypercube(), + Assert(fe.reference_cell_type() == + ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); unsigned int increment = @@ -345,7 +346,8 @@ namespace MGTools // TODO: This assumes that the dofs per face on all faces coincide! const unsigned int face_no = 0; - Assert(fe.reference_cell_type() == ReferenceCell::get_hypercube(), + Assert(fe.reference_cell_type() == + ReferenceCell::Type::get_hypercube(), ExcNotImplemented()); Assert(couplings.n_rows() == fe.n_components(), diff --git a/source/numerics/data_out.cc b/source/numerics/data_out.cc index 6798abcb1f..cf3eb29666 100644 --- a/source/numerics/data_out.cc +++ b/source/numerics/data_out.cc @@ -148,7 +148,7 @@ DataOut::build_one_patch( (cell_and_index->first->at_boundary() || (DoFHandlerType::dimension != DoFHandlerType::space_dimension))) || (cell_and_index->first->reference_cell_type() != - ReferenceCell::get_hypercube())) + ReferenceCell::Type::get_hypercube())) { Assert(patch.space_dim == DoFHandlerType::space_dimension, ExcInternalError()); diff --git a/tests/simplex/cell_measure_01.cc b/tests/simplex/cell_measure_01.cc index 712ca481fe..2c0157d131 100644 --- a/tests/simplex/cell_measure_01.cc +++ b/tests/simplex/cell_measure_01.cc @@ -47,7 +47,7 @@ process(const std::vector> &vertices, AssertDimension(reference_cell_types.size(), 1); - if (reference_cell_types[0] == ReferenceCell::get_simplex()) + if (reference_cell_types[0] == ReferenceCell::Type::get_simplex()) mapping = std::make_shared>(Simplex::FE_P(1)); else if (reference_cell_types[0] == ReferenceCell::Type::Wedge) mapping = std::make_shared>(Simplex::FE_WedgeP(1)); -- 2.39.5