From 2252e5e8e798bacfb1a21cf03dd1ebb5f8724aca Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 21 Jan 2023 17:40:29 -0500 Subject: [PATCH] Consistently name things 'combined face orientation'. --- include/deal.II/dofs/dof_accessor.templates.h | 6 +- include/deal.II/grid/connectivity.h | 8 +-- include/deal.II/grid/reference_cell.h | 48 ++++++++-------- .../deal.II/grid/tria_accessor.templates.h | 36 ++++++------ .../deal.II/grid/tria_objects_orientations.h | 37 +++++++------ source/grid/tria.cc | 55 +++++++++++-------- 6 files changed, 102 insertions(+), 88 deletions(-) diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index c24adfda4c..10931b3ad1 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -1085,10 +1085,10 @@ namespace internal if (structdim == 3 && fe.max_dofs_per_quad() > 0) for (const auto quad : accessor.face_indices()) { - const unsigned int raw_orientation = TriaAccessorImplementation:: - Implementation::face_orientation_raw(accessor, quad); + const auto combined_orientation = TriaAccessorImplementation:: + Implementation::combined_face_orientation(accessor, quad); const unsigned int quad_index = accessor.quad_index(quad); - if (raw_orientation == + if (combined_orientation == ReferenceCell::default_combined_face_orientation()) dof_operation.process_dofs( accessor.get_dof_handler(), diff --git a/include/deal.II/grid/connectivity.h b/include/deal.II/grid/connectivity.h index 882727b701..dad07743aa 100644 --- a/include/deal.II/grid/connectivity.h +++ b/include/deal.II/grid/connectivity.h @@ -1164,10 +1164,10 @@ namespace internal { // previously seen key: set orientation relative to the first // occurrence - orientations.set_raw_orientation( + orientations.set_combined_orientation( offset_i, ad_entity_types[offset_i] - .template get_orientation_index( + .template get_combined_orientation( make_array_view(ad_entity_vertices[offset_i].begin(), ad_entity_vertices[offset_i].begin() + ad_entity_types[offset_i].n_vertices()), @@ -1317,7 +1317,7 @@ namespace internal const unsigned int f = con_cq.col[f_]; // only faces with default orientation have to do something - if (ori_cq.get_raw_orientation(f_) != + if (ori_cq.get_combined_orientation(f_) != ReferenceCell::default_combined_face_orientation()) continue; @@ -1350,7 +1350,7 @@ namespace internal } // ... comparison gives orientation - ori_ql.set_raw_orientation( + ori_ql.set_combined_orientation( con_ql.ptr[f] + l, same ? ReferenceCell::default_combined_face_orientation() : ReferenceCell::reversed_combined_line_orientation()); diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index d6c4263377..286f7f2855 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -605,7 +605,7 @@ public: * arrays are read from or written to that correspond to valid vertex * indices. * - * @deprecated Use get_orientation_index() instead. + * @deprecated Use get_combined_orientation() instead. */ template DEAL_II_DEPRECATED_EARLY unsigned char @@ -634,13 +634,13 @@ public: * * @returns A number that describes a relative orientation. How exactly * this index is defined is not important, but it is consistent with the - * understanding the reorient_based_on_orientation_index() has of + * understanding the permute_by_combined_orientation() has of * these orientation indices. */ template unsigned char - get_orientation_index(const ArrayView &vertices_0, - const ArrayView &vertices_1) const; + get_combined_orientation(const ArrayView &vertices_0, + const ArrayView &vertices_1) const; /** @@ -654,7 +654,7 @@ public: * arrays are read from or written to that correspond to valid vertex * indices. * - * @deprecated Use reorient_based_on_orientation_index() instead. + * @deprecated Use permute_by_combined_orientation() instead. */ template DEAL_II_DEPRECATED_EARLY std::array @@ -662,7 +662,7 @@ public: const unsigned int orientation) const; /** - * This is the inverse function to get_orientation_index(): Given a set of + * This is the inverse function to get_combined_orientation(): Given a set of * vertex-associated objects (such as vertex indices, locations, etc.) and * a desired orientation permutation, return the permuted vertex information. * @@ -674,8 +674,8 @@ public: */ template boost::container::small_vector - reorient_based_on_orientation_index(const ArrayView &vertices, - const unsigned char orientation) const; + permute_by_combined_orientation(const ArrayView &vertices, + const unsigned char orientation) const; /** * Return a vector of faces a given @p vertex_index belongs to. @@ -1462,7 +1462,7 @@ inline unsigned int ReferenceCell::child_cell_on_face( const unsigned int face, const unsigned int subface, - const unsigned char face_orientation_raw) const + const unsigned char combined_face_orientation) const { AssertIndexRange(face, n_faces()); AssertIndexRange(subface, face_reference_cell(face).n_isotropic_children()); @@ -1485,10 +1485,11 @@ ReferenceCell::child_cell_on_face( case ReferenceCells::Quadrilateral: { const bool face_orientation = - Utilities::get_bit(face_orientation_raw, 0); - const bool face_flip = Utilities::get_bit(face_orientation_raw, 2); + Utilities::get_bit(combined_face_orientation, 0); + const bool face_flip = + Utilities::get_bit(combined_face_orientation, 2); const bool face_rotation = - Utilities::get_bit(face_orientation_raw, 1); + Utilities::get_bit(combined_face_orientation, 1); return GeometryInfo<2>::child_cell_on_face( RefinementCase<2>(RefinementPossibilities<2>::isotropic_refinement), @@ -1508,10 +1509,11 @@ ReferenceCell::child_cell_on_face( case ReferenceCells::Hexahedron: { const bool face_orientation = - Utilities::get_bit(face_orientation_raw, 0); - const bool face_flip = Utilities::get_bit(face_orientation_raw, 2); + Utilities::get_bit(combined_face_orientation, 0); + const bool face_flip = + Utilities::get_bit(combined_face_orientation, 2); const bool face_rotation = - Utilities::get_bit(face_orientation_raw, 1); + Utilities::get_bit(combined_face_orientation, 1); return GeometryInfo<3>::child_cell_on_face( RefinementCase<3>(RefinementPossibilities<3>::isotropic_refinement), @@ -2551,7 +2553,7 @@ ReferenceCell::n_face_orientations(const unsigned int face_no) const inline bool ReferenceCell::standard_vs_true_line_orientation( const unsigned int line, - const unsigned char face_orientation_raw, + const unsigned char combined_face_orientation, const bool line_orientation) const { if (*this == ReferenceCells::Hexahedron) @@ -2560,7 +2562,8 @@ ReferenceCell::standard_vs_true_line_orientation( {{{true, true, false, true, false, false, true, false}}, {{true, true, true, false, false, false, false, true}}}}; - return (line_orientation == bool_table[line / 2][face_orientation_raw]); + return (line_orientation == + bool_table[line / 2][combined_face_orientation]); } else // TODO: This might actually be wrong for some of the other @@ -2657,7 +2660,7 @@ ReferenceCell::compute_orientation(const std::array &vertices_0, // those array elements that we actually care about (see the note // in the documentation about the arguments potentially being // larger arrays than necessary). - return get_orientation_index( + return get_combined_orientation( make_array_view(vertices_0.begin(), vertices_0.begin() + n_vertices()), make_array_view(vertices_1.begin(), vertices_1.begin() + n_vertices())); } @@ -2666,8 +2669,9 @@ ReferenceCell::compute_orientation(const std::array &vertices_0, template unsigned char -ReferenceCell::get_orientation_index(const ArrayView &vertices_0, - const ArrayView &vertices_1) const +ReferenceCell::get_combined_orientation( + const ArrayView &vertices_0, + const ArrayView &vertices_1) const { Assert(vertices_0.size() == n_vertices(), ExcMessage("The number of array elements must be equal to " @@ -2785,7 +2789,7 @@ ReferenceCell::permute_according_orientation( // those array elements that we actually care about (see the note // in the documentation about the arguments potentially being // larger arrays than necessary). - const auto permutation = reorient_based_on_orientation_index( + const auto permutation = permute_by_combined_orientation( make_array_view(vertices.begin(), vertices.begin() + n_vertices()), orientation); @@ -2799,7 +2803,7 @@ ReferenceCell::permute_according_orientation( template boost::container::small_vector -ReferenceCell::reorient_based_on_orientation_index( +ReferenceCell::permute_by_combined_orientation( const ArrayView &vertices, const unsigned char orientation) const { diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index d0d1511e81..4494fc5f8c 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -627,7 +627,7 @@ namespace internal const auto quad_index = pair[0]; const auto line_index = accessor.reference_cell().standard_to_real_face_line( - pair[1], pair[0], face_orientation_raw(accessor, quad_index)); + pair[1], pair[0], combined_face_orientation(accessor, quad_index)); return accessor.quad(quad_index)->line_index(line_index); } @@ -698,12 +698,12 @@ namespace internal inline static unsigned int - face_orientation_raw(const TriaAccessor<3, 3, 3> &accessor, - const unsigned int face) + combined_face_orientation(const TriaAccessor<3, 3, 3> &accessor, + const unsigned int face) { AssertIndexRange(face, accessor.n_faces()); return accessor.tria->levels[accessor.present_level] - ->face_orientations.get_raw_orientation( + ->face_orientations.get_combined_orientation( accessor.present_index * GeometryInfo<3>::faces_per_cell + face); } @@ -831,12 +831,12 @@ namespace internal const auto quad_index = pair[0]; const auto line_within_face_index = accessor.reference_cell().standard_to_real_face_line( - pair[1], pair[0], face_orientation_raw(accessor, quad_index)); + pair[1], pair[0], combined_face_orientation(accessor, quad_index)); // Then query how that line is oriented within that face: return accessor.reference_cell().standard_vs_true_line_orientation( pair[1], - face_orientation_raw(accessor, quad_index), + combined_face_orientation(accessor, quad_index), accessor.quad(quad_index)->line_orientation(line_within_face_index)); } @@ -862,7 +862,7 @@ namespace internal { AssertIndexRange(face, accessor.n_faces()); accessor.tria->levels[accessor.present_level] - ->face_orientations.set_raw_orientation( + ->face_orientations.set_combined_orientation( accessor.present_index * GeometryInfo<3>::faces_per_cell + face, combined_orientation); } @@ -964,7 +964,7 @@ namespace internal const auto face_index = pair[0]; const auto vertex_index = accessor.reference_cell().standard_to_real_face_vertex( - pair[1], pair[0], face_orientation_raw(accessor, face_index)); + pair[1], pair[0], combined_face_orientation(accessor, face_index)); return accessor.quad(face_index)->vertex_index(vertex_index); } @@ -1015,7 +1015,7 @@ namespace internal const unsigned char orientation = cell.get_triangulation() .levels[cell.level()] - ->face_orientations.get_raw_orientation( + ->face_orientations.get_combined_orientation( cell.index() * GeometryInfo<3>::faces_per_cell + f); // It might seem superfluous to spell out the four indices @@ -1039,7 +1039,7 @@ namespace internal const unsigned char orientation = cell.get_triangulation() .levels[cell.level()] - ->face_orientations.get_raw_orientation( + ->face_orientations.get_combined_orientation( cell.index() * GeometryInfo<3>::faces_per_cell + f); const std::array my_indices{ {ref_cell.standard_to_real_face_line(0, f, orientation), @@ -1052,9 +1052,9 @@ namespace internal else if (ref_cell == ReferenceCells::Tetrahedron) { std::array orientations{ - {face_orientation_raw(cell, 0), - face_orientation_raw(cell, 1), - face_orientation_raw(cell, 2)}}; + {combined_face_orientation(cell, 0), + combined_face_orientation(cell, 1), + combined_face_orientation(cell, 2)}}; const std::array my_indices{ {ref_cell.standard_to_real_face_line(0, 0, orientations[0]), ref_cell.standard_to_real_face_line(1, 0, orientations[0]), @@ -1133,7 +1133,7 @@ namespace internal const unsigned char orientation = cell.get_triangulation() .levels[cell.level()] - ->face_orientations.get_raw_orientation( + ->face_orientations.get_combined_orientation( cell.index() * GeometryInfo<3>::faces_per_cell + f); // It might seem superfluous to spell out the four indices and @@ -1165,7 +1165,7 @@ namespace internal const unsigned char orientation = cell.get_triangulation() .levels[cell.level()] - ->face_orientations.get_raw_orientation( + ->face_orientations.get_combined_orientation( cell.index() * GeometryInfo<3>::faces_per_cell + f); const std::array my_indices{ {ref_cell.standard_to_real_face_line(0, f, orientation), @@ -1183,9 +1183,9 @@ namespace internal else if (ref_cell == ReferenceCells::Tetrahedron) { std::array orientations{ - {face_orientation_raw(cell, 0), - face_orientation_raw(cell, 1), - face_orientation_raw(cell, 2)}}; + {combined_face_orientation(cell, 0), + combined_face_orientation(cell, 1), + combined_face_orientation(cell, 2)}}; const std::array my_indices{ {ref_cell.standard_to_real_face_line(0, 0, orientations[0]), ref_cell.standard_to_real_face_line(1, 0, orientations[0]), diff --git a/include/deal.II/grid/tria_objects_orientations.h b/include/deal.II/grid/tria_objects_orientations.h index 6916f63df6..149cde3adb 100644 --- a/include/deal.II/grid/tria_objects_orientations.h +++ b/include/deal.II/grid/tria_objects_orientations.h @@ -36,11 +36,11 @@ namespace internal * Class storing orientation information for various objects in a * Triangulation. * - * In deal.II, we express the orientation of an object with three - * Booleans: orientation, rotate, and flip. The default values for these - * are true, false, and false. These are represented either as individual - * booleans or as a 'raw' orientation: the raw format places orientation - * in the least significant bit, then rotate, then flip. + * In deal.II, we express the orientation of an object with three Booleans: + * orientation, rotate, and flip. The default values for these are true, + * false, and false. These are represented either as individual booleans or + * as a 'combined' orientation: the combined format places orientation in + * the least significant bit, then rotate, then flip. * * For a quadrilateral, these values correspond to * - *orientation* : `true` is the default orientation and `false` means @@ -58,12 +58,12 @@ namespace internal * product of two lines in their standard orientation (which, e.g., points * into the hexahedron for face 0 but out of the hexahedron for face 1). * - * For triangles, to enable indexing from the raw orientation, we do not - * consider flip-rotate or flip-orient-rotate as those cases are - * equivalent, respectively, to the identity operation or the orientation - * = `true` case as flip-rotate is equal to the identity operation. This - * choice ensures that the integer value of the raw orientation is in $[0, - * 5]$. + * For triangles, to enable indexing from the combined orientation, we do + * not consider flip-rotate or flip-orient-rotate as those cases are + * equivalent, respectively, to the identity operation or the orientation = + * `true` case as flip-rotate is equal to the identity operation. This + * choice ensures that the integer value of the combined orientation is in + * $[0, 5]$. */ class TriaObjectsOrientations { @@ -105,11 +105,11 @@ namespace internal memory_consumption() const; /** - * Get the raw orientation of the object, as described in the class + * Get the combined orientation of the object, as described in the class * documentation. */ unsigned char - get_raw_orientation(const unsigned int object) const; + get_combined_orientation(const unsigned int object) const; /** * Get the orientation bit of the object. @@ -130,11 +130,12 @@ namespace internal get_flip(const unsigned int object) const; /** - * Set the raw orientation of the object, as described in the class + * Set the combined orientation of the object, as described in the class * documentation. */ void - set_raw_orientation(const unsigned int object, const unsigned char value); + set_combined_orientation(const unsigned int object, + const unsigned char value); /** * Set the orientation bit of the object. @@ -231,7 +232,7 @@ namespace internal inline unsigned char - TriaObjectsOrientations::get_raw_orientation( + TriaObjectsOrientations::get_combined_orientation( const unsigned int object) const { AssertIndexRange(object, n_stored_objects); @@ -268,8 +269,8 @@ namespace internal inline void - TriaObjectsOrientations::set_raw_orientation(const unsigned int object, - const unsigned char value) + TriaObjectsOrientations::set_combined_orientation(const unsigned int object, + const unsigned char value) { AssertIndexRange(object, n_stored_objects); flags[object] = value; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index a5d70891d8..90d1c18c76 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -2349,20 +2349,20 @@ namespace internal crs.col[i]; // set line orientations - const unsigned char raw_orientation = - connectivity.entity_orientations(1).get_raw_orientation( - k); + const unsigned char combined_orientation = + connectivity.entity_orientations(1) + .get_combined_orientation(k); // it doesn't make sense to set any flags except // orientation for a line Assert( - raw_orientation == + combined_orientation == ReferenceCell::default_combined_face_orientation() || - raw_orientation == + combined_orientation == ReferenceCell::reversed_combined_line_orientation(), ExcInternalError()); faces.quads_line_orientations [q * GeometryInfo<3>::lines_per_face + j] = - raw_orientation == + combined_orientation == ReferenceCell::default_combined_face_orientation(); } } @@ -2386,7 +2386,7 @@ namespace internal { const auto &orientations = connectivity.entity_orientations(1); for (unsigned int i = 0; i < orientations.n_objects(); ++i) - if (orientations.get_raw_orientation(i) != + if (orientations.get_combined_orientation(i) != ReferenceCell::default_combined_face_orientation()) { orientation_needed = true; @@ -2427,10 +2427,10 @@ namespace internal // set face orientation if needed if (orientation_needed) { - level.face_orientations.set_raw_orientation( + level.face_orientations.set_combined_orientation( cell * GeometryInfo::faces_per_cell + j, connectivity.entity_orientations(dim - 1) - .get_raw_orientation(i)); + .get_combined_orientation(i)); } } } @@ -4350,7 +4350,7 @@ namespace internal if (new_lines[line_no]->vertex_index(1) != new_vertices[vertex_no]) triangulation.levels[subcells[subcell_no]->level()] - ->face_orientations.set_raw_orientation( + ->face_orientations.set_combined_orientation( subcells[subcell_no]->index() * GeometryInfo<2>::faces_per_cell + subcell_line_no, @@ -5522,7 +5522,7 @@ namespace internal vertex_indices[quad_line_vertices_tri[i][f][1]]}}; const auto orientation = - ReferenceCells::Line.get_orientation_index( + ReferenceCells::Line.get_combined_orientation( make_array_view(vertices_0), make_array_view(vertices_1)); @@ -5828,7 +5828,7 @@ namespace internal ->line( table[triangulation.levels[hex->level()] ->face_orientations - .get_raw_orientation( + .get_combined_orientation( hex->index() * GeometryInfo:: faces_per_cell + f)][l]); @@ -5965,7 +5965,7 @@ namespace internal vertex_indices[table[q][l][1]]}}; const auto orientation = - ReferenceCells::Line.get_orientation_index( + ReferenceCells::Line.get_combined_orientation( make_array_view(vertices_0), make_array_view(vertices_1)); @@ -6018,7 +6018,8 @@ namespace internal c, f, triangulation.levels[hex->level()] - ->face_orientations.get_raw_orientation( + ->face_orientations + .get_combined_orientation( hex->index() * GeometryInfo::faces_per_cell + f))); @@ -6146,9 +6147,10 @@ namespace internal new_hex->set_combined_face_orientation( f, - face->reference_cell().get_orientation_index( - make_array_view(vertices_1), - make_array_view(vertices_0))); + face->reference_cell() + .get_combined_orientation( + make_array_view(vertices_1), + make_array_view(vertices_0))); } } else if (new_hex->n_faces() == 6) @@ -14608,14 +14610,21 @@ Triangulation::reset_cell_vertex_indices_cache() face_iter->line(0)->vertex_index(line_orientations[0]), face_iter->line(1)->vertex_index(line_orientations[1])}}; - const unsigned char orientate = - levels[l]->face_orientations.get_raw_orientation( + const unsigned char combined_orientation = + levels[l]->face_orientations.get_combined_orientation( cell->index() * GeometryInfo<3>::faces_per_cell + face); std::array vertex_order{ - {ref_cell.standard_to_real_face_vertex(0, face, orientate), - ref_cell.standard_to_real_face_vertex(1, face, orientate), - ref_cell.standard_to_real_face_vertex(2, face, orientate), - ref_cell.standard_to_real_face_vertex(3, face, orientate)}}; + {ref_cell.standard_to_real_face_vertex(0, + face, + combined_orientation), + ref_cell.standard_to_real_face_vertex(1, + face, + combined_orientation), + ref_cell.standard_to_real_face_vertex(2, + face, + combined_orientation), + ref_cell.standard_to_real_face_vertex( + 3, face, combined_orientation)}}; const unsigned int index = my_index + 4 * (face - 4); for (unsigned int i = 0; i < 4; ++i) -- 2.39.5