From d811fc3cba02ce155698630fd098562534dd4c15 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 4 May 2024 12:26:40 -0400 Subject: [PATCH] Consolidate combined_face_orientation() functions. --- include/deal.II/dofs/dof_accessor.templates.h | 4 +- .../deal.II/grid/tria_accessor.templates.h | 73 +++++++------------ 2 files changed, 29 insertions(+), 48 deletions(-) diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index 9b49b62950..f1b4738613 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -1090,8 +1090,8 @@ namespace internal if (structdim == 3 && fe.max_dofs_per_quad() > 0) for (const auto face_no : accessor.face_indices()) { - const auto combined_orientation = TriaAccessorImplementation:: - Implementation::combined_face_orientation(accessor, face_no); + const auto combined_orientation = + accessor.combined_face_orientation(face_no); const unsigned int quad_index = accessor.quad_index(face_no); if (combined_orientation == ReferenceCell::default_combined_face_orientation()) diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 3c737dadec..790e304a61 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -618,7 +618,7 @@ namespace internal accessor.reference_cell().standard_to_real_face_line( line_index, face_index, - combined_face_orientation(accessor, face_index)); + accessor.combined_face_orientation(face_index)); return accessor.quad(face_index)->line_index(line_within_face_index); } @@ -651,42 +651,6 @@ namespace internal - template - inline static unsigned char - combined_face_orientation( - const TriaAccessor<1, dim, spacedim> & /*accessor*/, - const unsigned int /*face*/) - { - // There is only one way to orient a vertex - return ReferenceCell::default_combined_face_orientation(); - } - - - - template - inline static unsigned char - combined_face_orientation(const TriaAccessor<2, dim, spacedim> &accessor, - const unsigned int face) - { - return line_orientation(accessor, face) == true ? - ReferenceCell::default_combined_face_orientation() : - ReferenceCell::reversed_combined_line_orientation(); - } - - - - inline static unsigned char - 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_combined_orientation( - accessor.present_index * GeometryInfo<3>::faces_per_cell + face); - } - - - /** * Implementation of the function of some name in the mother class. */ @@ -895,7 +859,7 @@ namespace internal accessor.reference_cell().standard_to_real_face_vertex( vertex_index, face_index, - combined_face_orientation(accessor, face_index)); + accessor.combined_face_orientation(face_index)); return accessor.quad(face_index) ->vertex_index(vertex_within_face_index); @@ -984,9 +948,9 @@ namespace internal else if (ref_cell == ReferenceCells::Tetrahedron) { std::array orientations{ - {combined_face_orientation(cell, 0), - combined_face_orientation(cell, 1), - combined_face_orientation(cell, 2)}}; + {cell.combined_face_orientation(0), + cell.combined_face_orientation(1), + cell.combined_face_orientation(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]), @@ -1124,9 +1088,9 @@ namespace internal else if (ref_cell == ReferenceCells::Tetrahedron) { std::array orientations{ - {combined_face_orientation(cell, 0), - combined_face_orientation(cell, 1), - combined_face_orientation(cell, 2)}}; + {cell.combined_face_orientation(0), + cell.combined_face_orientation(1), + cell.combined_face_orientation(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]), @@ -1319,8 +1283,25 @@ inline unsigned char TriaAccessor::combined_face_orientation( const unsigned int face) const { - return dealii::internal::TriaAccessorImplementation::Implementation:: - combined_face_orientation(*this, face); + Assert(used(), TriaAccessorExceptions::ExcCellNotUsed()); + AssertIndexRange(face, n_faces()); + Assert(structdim == dim, + ExcMessage("This function can only be used on objects " + "that are cells, but not on faces or edges " + "that bound cells.")); + // work around a bogus GCC-9 warning which considers face unused except in 3d + (void)face; + + if constexpr (structdim == 1) + return ReferenceCell::default_combined_face_orientation(); + else if constexpr (structdim == 2) + return this->line_orientation(face) == true ? + ReferenceCell::default_combined_face_orientation() : + ReferenceCell::reversed_combined_line_orientation(); + else + return this->tria->levels[this->present_level] + ->face_orientations.get_combined_orientation( + this->present_index * GeometryInfo::faces_per_cell + face); } -- 2.39.5