From: David Wells Date: Sat, 21 Jan 2023 18:54:24 +0000 (-0500) Subject: Remove the internal::ReferenceCell namespace. X-Git-Tag: v9.5.0-rc1~626^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d43c8c53374eee9066af1043fdf7fdd1b67ce984;p=dealii.git Remove the internal::ReferenceCell namespace. This namespace is annoying since it has the same name as a class (and therefore takes precedence in lookup inside internal namespaces) --- diff --git a/contrib/python-bindings/source/reference_cell_wrapper.cc b/contrib/python-bindings/source/reference_cell_wrapper.cc index 97849c6fa9..34e14ee3a0 100644 --- a/contrib/python-bindings/source/reference_cell_wrapper.cc +++ b/contrib/python-bindings/source/reference_cell_wrapper.cc @@ -35,7 +35,7 @@ namespace python ReferenceCellWrapper::ReferenceCellWrapper(const std::uint8_t &kind) { - cell_type = internal::ReferenceCell::make_reference_cell_from_int(kind); + cell_type = internal::make_reference_cell_from_int(kind); } diff --git a/include/deal.II/fe/fe_data.h b/include/deal.II/fe/fe_data.h index 7d47986005..21bf469922 100644 --- a/include/deal.II/fe/fe_data.h +++ b/include/deal.II/fe/fe_data.h @@ -700,7 +700,7 @@ namespace internal internal::GenericDoFsPerObject expand(const unsigned int dim, const std::vector &dofs_per_object, - const dealii::ReferenceCell reference_cell); + const ReferenceCell reference_cell); } // namespace internal diff --git a/include/deal.II/grid/connectivity.h b/include/deal.II/grid/connectivity.h index 4c258efa57..1319163c65 100644 --- a/include/deal.II/grid/connectivity.h +++ b/include/deal.II/grid/connectivity.h @@ -72,14 +72,14 @@ namespace internal /** * Geometric entity type of the @p e-th sub-entity of dimension @p d. */ - virtual dealii::ReferenceCell + virtual ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const { Assert(false, ExcNotImplemented()); (void)d; (void)e; - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } /** @@ -152,17 +152,17 @@ namespace internal return {}; } - dealii::ReferenceCell + ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const override { (void)e; if (d == 1) - return dealii::ReferenceCells::Line; + return ReferenceCells::Line; Assert(false, ExcNotImplemented()); - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } unsigned int @@ -206,20 +206,20 @@ namespace internal return {}; } - virtual dealii::ReferenceCell + virtual ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const override { (void)e; if (d == 2) - return dealii::ReferenceCells::Triangle; + return ReferenceCells::Triangle; if (d == 1) - return dealii::ReferenceCells::Line; + return ReferenceCells::Line; Assert(false, ExcNotImplemented()); - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } unsigned int @@ -263,20 +263,20 @@ namespace internal return {}; } - virtual dealii::ReferenceCell + virtual ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const override { (void)e; if (d == 2) - return dealii::ReferenceCells::Quadrilateral; + return ReferenceCells::Quadrilateral; if (d == 1) - return dealii::ReferenceCells::Line; + return ReferenceCells::Line; Assert(false, ExcNotImplemented()); - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } unsigned int @@ -328,23 +328,23 @@ namespace internal return {}; } - virtual dealii::ReferenceCell + virtual ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const override { (void)e; if (d == 3) - return dealii::ReferenceCells::Tetrahedron; + return ReferenceCells::Tetrahedron; if (d == 2) - return dealii::ReferenceCells::Triangle; + return ReferenceCells::Triangle; if (d == 1) - return dealii::ReferenceCells::Line; + return ReferenceCells::Line; Assert(false, ExcNotImplemented()); - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } unsigned int @@ -439,25 +439,25 @@ namespace internal return {}; } - virtual dealii::ReferenceCell + virtual ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const override { (void)e; if (d == 3) - return dealii::ReferenceCells::Pyramid; + return ReferenceCells::Pyramid; if (d == 2 && e == 0) - return dealii::ReferenceCells::Quadrilateral; + return ReferenceCells::Quadrilateral; else if (d == 2) - return dealii::ReferenceCells::Triangle; + return ReferenceCells::Triangle; if (d == 1) - return dealii::ReferenceCells::Line; + return ReferenceCells::Line; Assert(false, ExcNotImplemented()); - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } unsigned int @@ -565,25 +565,25 @@ namespace internal return {}; } - virtual dealii::ReferenceCell + virtual ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const override { (void)e; if (d == 3) - return dealii::ReferenceCells::Wedge; + return ReferenceCells::Wedge; if (d == 2 && e > 1) - return dealii::ReferenceCells::Quadrilateral; + return ReferenceCells::Quadrilateral; else if (d == 2) - return dealii::ReferenceCells::Triangle; + return ReferenceCells::Triangle; if (d == 1) - return dealii::ReferenceCells::Line; + return ReferenceCells::Line; Assert(false, ExcNotImplemented()); - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } unsigned int @@ -693,23 +693,23 @@ namespace internal return {}; } - virtual dealii::ReferenceCell + virtual ReferenceCell type_of_entity(const unsigned int d, const unsigned int e) const override { (void)e; if (d == 3) - return dealii::ReferenceCells::Hexahedron; + return ReferenceCells::Hexahedron; if (d == 2) - return dealii::ReferenceCells::Quadrilateral; + return ReferenceCells::Quadrilateral; if (d == 1) - return dealii::ReferenceCells::Line; + return ReferenceCells::Line; Assert(false, ExcNotImplemented()); - return dealii::ReferenceCells::Vertex; + return ReferenceCells::Vertex; } unsigned int @@ -822,8 +822,8 @@ namespace internal template struct Connectivity { - Connectivity(const unsigned int dim, - const std::vector &cell_types) + Connectivity(const unsigned int dim, + const std::vector &cell_types) : dim(dim) , cell_types(cell_types) {} @@ -850,7 +850,7 @@ namespace internal return quad_orientation; } - inline std::vector & + inline std::vector & entity_types(const unsigned int structdim) { if (structdim == dim) @@ -863,7 +863,7 @@ namespace internal return quad_types; } - inline const std::vector & + inline const std::vector & entity_types(const unsigned int structdim) const { if (structdim == dim) @@ -915,8 +915,8 @@ namespace internal } private: - const unsigned int dim; - std::vector cell_types; + const unsigned int dim; + std::vector cell_types; CRS line_vertices; @@ -930,7 +930,7 @@ namespace internal CRS cell_entities; CRS neighbors; - std::vector quad_types; + std::vector quad_types; }; @@ -1000,7 +1000,7 @@ namespace internal build_face_entities_templated( const unsigned int face_dimensionality, const std::vector> &cell_types, - const std::vector & cell_types_index, + const std::vector & cell_types_index, const CRS & crs, CRS & crs_d, // result CRS & crs_0, // result @@ -1040,7 +1040,7 @@ namespace internal keys; // key (sorted vertices), cell-entity index std::vector> ad_entity_vertices; - std::vector ad_entity_types; + std::vector ad_entity_types; std::vector> ad_compatibility; keys.reserve(n_entities); @@ -1191,7 +1191,7 @@ namespace internal build_face_entities( const unsigned int face_dimensionality, const std::vector> &cell_types, - const std::vector & cell_types_index, + const std::vector & cell_types_index, const CRS & crs, CRS & crs_d, CRS & crs_0, @@ -1255,7 +1255,7 @@ namespace internal inline void build_intersection( const std::vector> &cell_types, - const std::vector & cell_types_index, + const std::vector & cell_types_index, const CRS & con_cv, const CRS & con_cl, const CRS & con_lv, @@ -1264,7 +1264,7 @@ namespace internal const TriaObjectsOrientations & ori_cq, CRS & con_ql, // result TriaObjectsOrientations & ori_ql, // result - std::vector & quad_t_id // result + std::vector & quad_t_id // result ) { // reset output @@ -1369,8 +1369,8 @@ namespace internal Connectivity build_connectivity(const unsigned int dim, const std::vector> &cell_t, - const std::vector &cell_t_id, - const CRS & con_cv) + const std::vector &cell_t_id, + const CRS & con_cv) { Connectivity connectivity(dim, cell_t_id); @@ -1462,23 +1462,20 @@ namespace internal std::vector> cell_types_impl(8); cell_types_impl[static_cast( - dealii::ReferenceCells::Line)] = std::make_shared(); + ReferenceCells::Line)] = std::make_shared(); cell_types_impl[static_cast( - dealii::ReferenceCells::Triangle)] = - std::make_shared(); + ReferenceCells::Triangle)] = std::make_shared(); cell_types_impl[static_cast( - dealii::ReferenceCells::Quadrilateral)] = + ReferenceCells::Quadrilateral)] = std::make_shared(); cell_types_impl[static_cast( - dealii::ReferenceCells::Tetrahedron)] = - std::make_shared(); + ReferenceCells::Tetrahedron)] = std::make_shared(); cell_types_impl[static_cast( - dealii::ReferenceCells::Pyramid)] = std::make_shared(); + ReferenceCells::Pyramid)] = std::make_shared(); cell_types_impl[static_cast( - dealii::ReferenceCells::Wedge)] = std::make_shared(); + ReferenceCells::Wedge)] = std::make_shared(); cell_types_impl[static_cast( - dealii::ReferenceCells::Hexahedron)] = - std::make_shared(); + ReferenceCells::Hexahedron)] = std::make_shared(); // determine cell types and process vertices std::vector cell_vertices; @@ -1494,7 +1491,7 @@ namespace internal cell_vertices_ptr.reserve(cells.size() + 1); cell_vertices_ptr.push_back(0); - std::vector cell_types_indices; + std::vector cell_types_indices; cell_types_indices.reserve(cells.size()); // loop over cells and create CRS @@ -1517,11 +1514,10 @@ namespace internal "CellData.")); #endif - const dealii::ReferenceCell reference_cell = - dealii::ReferenceCell::n_vertices_to_type(dim, - cell.vertices.size()); + const ReferenceCell reference_cell = + ReferenceCell::n_vertices_to_type(dim, cell.vertices.size()); - Assert(reference_cell != dealii::ReferenceCells::Invalid, + Assert(reference_cell != ReferenceCells::Invalid, ExcNotImplemented()); AssertIndexRange(static_cast( reference_cell), diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index 37ca0b012d..5ff5140e4d 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -46,25 +46,20 @@ class ReferenceCell; namespace internal { - namespace ReferenceCell - { - /** - * A helper function to create a ReferenceCell object from an - * integer. ReferenceCell objects are "singletons" (actually, - * "multitons" -- there are multiple, but they are only a handful and - * these are all that can be used). What is then necessary is to - * have a way to create these with their internal id to distinguish - * the few possible ones in existence. We could do this via a public - * constructor of ReferenceCell, but that would allow users - * to create ones outside the range we envision, and we don't want to do - * that. Rather, the constructor that takes an integer is made `private` - * but we have this one function in an internal namespace that is a friend - * of the class and can be used to create the objects. - */ - constexpr dealii::ReferenceCell - make_reference_cell_from_int(const std::uint8_t kind); - - } // namespace ReferenceCell + /** + * A helper function to create a ReferenceCell object from an integer. + * ReferenceCell objects are "singletons" (actually, "multitons" -- there are + * multiple, but they are only a handful and these are all that can be used). + * What is then necessary is to have a way to create these with their internal + * id to distinguish the few possible ones in existence. We could do this via + * a public constructor of ReferenceCell, but that would allow users to create + * ones outside the range we envision, and we don't want to do that. Rather, + * the constructor that takes an integer is made `private` but we have this + * one function in an internal namespace that is a friend of the class and can + * be used to create the objects. + */ + constexpr ReferenceCell + make_reference_cell_from_int(const std::uint8_t kind); } // namespace internal @@ -816,7 +811,7 @@ private: * called by anyone, but at least hidden in an internal namespace. */ friend constexpr ReferenceCell - internal::ReferenceCell::make_reference_cell_from_int(const std::uint8_t); + internal::make_reference_cell_from_int(const std::uint8_t); friend std::ostream & operator<<(std::ostream &out, const ReferenceCell &reference_cell); @@ -878,23 +873,20 @@ ReferenceCell::operator!=(const ReferenceCell &type) const namespace internal { - namespace ReferenceCell + inline constexpr ReferenceCell + make_reference_cell_from_int(const std::uint8_t kind) { - inline constexpr dealii::ReferenceCell - make_reference_cell_from_int(const std::uint8_t kind) - { #ifndef DEAL_II_CXX14_CONSTEXPR_BUG - // Make sure these are the only indices from which objects can be - // created. - Assert((kind == static_cast(-1)) || (kind < 8), - ExcInternalError()); + // Make sure these are the only indices from which objects can be + // created. + Assert((kind == static_cast(-1)) || (kind < 8), + ExcInternalError()); #endif - // Call the private constructor, which we can from here because this - // function is a 'friend'. - return {kind}; - } - } // namespace ReferenceCell + // Call the private constructor, which we can from here because this + // function is a 'friend'. + return {kind}; + } } // namespace internal @@ -909,24 +901,23 @@ namespace internal namespace ReferenceCells { constexpr const ReferenceCell Vertex = - internal::ReferenceCell::make_reference_cell_from_int(0); + internal::make_reference_cell_from_int(0); constexpr const ReferenceCell Line = - internal::ReferenceCell::make_reference_cell_from_int(1); + internal::make_reference_cell_from_int(1); constexpr const ReferenceCell Triangle = - internal::ReferenceCell::make_reference_cell_from_int(2); + internal::make_reference_cell_from_int(2); constexpr const ReferenceCell Quadrilateral = - internal::ReferenceCell::make_reference_cell_from_int(3); + internal::make_reference_cell_from_int(3); constexpr const ReferenceCell Tetrahedron = - internal::ReferenceCell::make_reference_cell_from_int(4); + internal::make_reference_cell_from_int(4); constexpr const ReferenceCell Pyramid = - internal::ReferenceCell::make_reference_cell_from_int(5); + internal::make_reference_cell_from_int(5); constexpr const ReferenceCell Wedge = - internal::ReferenceCell::make_reference_cell_from_int(6); + internal::make_reference_cell_from_int(6); constexpr const ReferenceCell Hexahedron = - internal::ReferenceCell::make_reference_cell_from_int(7); + internal::make_reference_cell_from_int(7); constexpr const ReferenceCell Invalid = - internal::ReferenceCell::make_reference_cell_from_int( - static_cast(-1)); + internal::make_reference_cell_from_int(static_cast(-1)); /** * Return the correct simplex reference cell type for the given dimension @@ -2599,9 +2590,9 @@ namespace internal /** * Constructor. */ - NoPermutation(const dealii::ReferenceCell &entity_type, - const ArrayView & vertices_0, - const ArrayView & vertices_1) + NoPermutation(const ReferenceCell & entity_type, + const ArrayView &vertices_0, + const ArrayView &vertices_1) : entity_type(entity_type) , vertices_0(vertices_0) , vertices_1(vertices_1) @@ -2647,7 +2638,7 @@ namespace internal /** * Entity type. */ - const dealii::ReferenceCell entity_type; + const ReferenceCell entity_type; /** * First set of values. diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 1f70704949..02bf7e461c 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -55,8 +55,8 @@ namespace internal GeometryInfo::vertices_per_cell> vertices) { - const dealii::ReferenceCell reference_cell = - dealii::ReferenceCell::n_vertices_to_type(dim, vertices.size()); + const ReferenceCell reference_cell = + ReferenceCell::n_vertices_to_type(dim, vertices.size()); if (reference_cell == dealii::ReferenceCells::Line) // Return the distance between the two vertices diff --git a/include/deal.II/grid/tria_faces.h b/include/deal.II/grid/tria_faces.h index c1548c8018..be7e6a2215 100644 --- a/include/deal.II/grid/tria_faces.h +++ b/include/deal.II/grid/tria_faces.h @@ -85,15 +85,14 @@ namespace internal /** * Helper accessor function for quad_is_quadrilateral */ - dealii::ReferenceCell + ReferenceCell get_quad_type(const std::size_t index) const; /** * Helper accessor function for quad_is_quadrilateral */ void - set_quad_type(const std::size_t index, - const dealii::ReferenceCell face_type); + set_quad_type(const std::size_t index, const ReferenceCell face_type); /** * The TriaObject containing the data of lines. @@ -121,7 +120,7 @@ namespace internal - inline dealii::ReferenceCell + inline ReferenceCell TriaFaces::get_quad_type(const std::size_t index) const { AssertIndexRange(index, quad_is_quadrilateral.size()); @@ -132,8 +131,8 @@ namespace internal inline void - TriaFaces::set_quad_type(const std::size_t index, - const dealii::ReferenceCell face_type) + TriaFaces::set_quad_type(const std::size_t index, + const ReferenceCell face_type) { AssertIndexRange(index, quad_is_quadrilateral.size()); Assert(face_type == ReferenceCells::Quadrilateral || diff --git a/include/deal.II/grid/tria_levels.h b/include/deal.II/grid/tria_levels.h index c06ca0fd1f..aba0df879c 100644 --- a/include/deal.II/grid/tria_levels.h +++ b/include/deal.II/grid/tria_levels.h @@ -223,7 +223,7 @@ namespace internal * * @note Used only for dim=2 and dim=3. */ - std::vector reference_cell; + std::vector reference_cell; /** * A cache for the vertex indices of the cells (`structdim == dim`), in diff --git a/include/deal.II/matrix_free/mapping_info.h b/include/deal.II/matrix_free/mapping_info.h index 6113903f85..0b8b4cb76a 100644 --- a/include/deal.II/matrix_free/mapping_info.h +++ b/include/deal.II/matrix_free/mapping_info.h @@ -199,7 +199,7 @@ namespace internal * Reference-cell type related to each quadrature and active quadrature * index. */ - std::vector> reference_cell_types; + std::vector> reference_cell_types; /** * Internal function to compute the geometry for the case the mapping is diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 62ffd3e98f..2fe883a140 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -1537,10 +1537,9 @@ namespace internal template unsigned int reorder_face_derivative_indices( - const unsigned int face_no, - const unsigned int index, - const dealii::ReferenceCell reference_cell = - dealii::ReferenceCells::Invalid) + const unsigned int face_no, + const unsigned int index, + const ReferenceCell reference_cell = dealii::ReferenceCells::Invalid) { Assert(index < dim, ExcInternalError()); diff --git a/include/deal.II/matrix_free/util.h b/include/deal.II/matrix_free/util.h index 0c6b27baca..fcdff955ca 100644 --- a/include/deal.II/matrix_free/util.h +++ b/include/deal.II/matrix_free/util.h @@ -40,7 +40,7 @@ namespace internal * are defined on each face. */ template - inline std::pair> + inline std::pair> get_face_quadrature_collection(const Quadrature &quad, const bool do_assert = true) { diff --git a/include/deal.II/numerics/data_out_dof_data.templates.h b/include/deal.II/numerics/data_out_dof_data.templates.h index f203ae74a1..19ede03d00 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -235,7 +235,7 @@ namespace internal // to test there if dim<3. static const auto has_fe_with_reference_cell = [](const dealii::hp::FECollection &fe_collection, - const dealii::ReferenceCell & reference_cell) { + const ReferenceCell & reference_cell) { for (unsigned int i = 0; i < fe_collection.size(); ++i) if (fe_collection[i].reference_cell() == reference_cell) return true; @@ -341,7 +341,7 @@ namespace internal for (unsigned int j = 0; j < finite_elements[i]->size(); ++j) { - const dealii::ReferenceCell reference_cell = + const ReferenceCell reference_cell = (*finite_elements[i])[j].reference_cell(); if (reference_cell.is_hyper_cube()) @@ -427,7 +427,7 @@ namespace internal for (unsigned int j = 0; j < finite_elements[i]->size(); ++j) { - const dealii::ReferenceCell reference_cell = + const ReferenceCell reference_cell = (*finite_elements[i])[j].reference_cell(); // In 1d/2d and for hypercube/wedge/pyramid elements, we diff --git a/source/fe/fe_data.cc b/source/fe/fe_data.cc index 12e5a56f75..98b9cd8f2f 100644 --- a/source/fe/fe_data.cc +++ b/source/fe/fe_data.cc @@ -24,7 +24,7 @@ namespace internal internal::GenericDoFsPerObject expand(const unsigned int dim, const std::vector &dofs_per_object, - const dealii::ReferenceCell cell_type) + const ReferenceCell cell_type) { internal::GenericDoFsPerObject result; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 78780bf413..2b5ee8ac43 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -1234,8 +1234,8 @@ namespace internal tria_level.reference_cell.insert( tria_level.reference_cell.end(), total_cells - tria_level.reference_cell.size(), - tria_level.dim == 2 ? dealii::ReferenceCells::Quadrilateral : - dealii::ReferenceCells::Hexahedron); + tria_level.dim == 2 ? ReferenceCells::Quadrilateral : + ReferenceCells::Hexahedron); } } } @@ -2662,7 +2662,7 @@ namespace internal level.neighbors.assign(size * max_faces_per_cell, {-1, -1}); - level.reference_cell.assign(size, dealii::ReferenceCells::Invalid); + level.reference_cell.assign(size, ReferenceCells::Invalid); if (orientation_needed) level.face_orientations.reinit(size * max_faces_per_cell); diff --git a/tests/gmsh/gmsh_api_02.cc b/tests/gmsh/gmsh_api_02.cc index 5d0d035716..3929b091f2 100644 --- a/tests/gmsh/gmsh_api_02.cc +++ b/tests/gmsh/gmsh_api_02.cc @@ -29,8 +29,8 @@ test(const std::uint8_t kind, const std::string out = "") << ',' << spacedim << '>' << std::endl; Triangulation tria; - GridGenerator::reference_cell( - tria, internal::ReferenceCell::make_reference_cell_from_int(kind)); + GridGenerator::reference_cell(tria, + internal::make_reference_cell_from_int(kind)); GridOut go; go.write_msh(tria, "output.msh"); cat_file("output.msh"); diff --git a/tests/gmsh/gmsh_api_04.cc b/tests/gmsh/gmsh_api_04.cc index d7641f7325..236d391220 100644 --- a/tests/gmsh/gmsh_api_04.cc +++ b/tests/gmsh/gmsh_api_04.cc @@ -31,8 +31,8 @@ test(const std::uint8_t kind, const std::string out = "") << ',' << spacedim << '>' << std::endl; Triangulation tria; - GridGenerator::reference_cell( - tria, internal::ReferenceCell::make_reference_cell_from_int(kind)); + GridGenerator::reference_cell(tria, + internal::make_reference_cell_from_int(kind)); GridOut go; go.write_msh(tria, "output.msh");