From 7e814509e9261ab876115055ed1cc1bdd156c7c4 Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 9 Apr 2025 22:07:39 -0400 Subject: [PATCH] MatrixFree: remove some hardcoded inverses. --- include/deal.II/matrix_free/face_setup_internal.h | 9 +++++---- include/deal.II/matrix_free/fe_evaluation.h | 14 +++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/include/deal.II/matrix_free/face_setup_internal.h b/include/deal.II/matrix_free/face_setup_internal.h index 4121592efd..9412551195 100644 --- a/include/deal.II/matrix_free/face_setup_internal.h +++ b/include/deal.II/matrix_free/face_setup_internal.h @@ -1106,11 +1106,12 @@ namespace internal { const Table<2, unsigned int> orientation = ShapeInfo::compute_orientation_table(2); - const std::array inverted_orientations{ - {0, 1, 6, 3, 4, 5, 2, 7}}; + const auto face_reference_cell = + cell->face(face_no)->reference_cell(); info.subface_index = - orientation[inverted_orientations[exterior_face_orientation]] - [info.subface_index]; + orientation(face_reference_cell.get_inverse_combined_orientation( + exterior_face_orientation), + info.subface_index); } return info; diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index d819941a54..a481c9f6b8 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -7511,13 +7511,17 @@ FEFaceEvaluationface_numbers[i] = faces.exterior_face_no; } - const bool orientation_interior_face = faces.face_orientation >= 8; - unsigned int face_orientation = faces.face_orientation % 8; + const bool orientation_interior_face = faces.face_orientation >= 8; + auto face_orientation = faces.face_orientation % 8; if (face_identifies_as_interior != orientation_interior_face) { - constexpr std::array table{ - {0, 1, 6, 3, 4, 5, 2, 7}}; - face_orientation = table[face_orientation]; + Assert(this->matrix_free->get_cell_iterator(cell_index, i) + ->reference_cell() == + ReferenceCells::get_hypercube(), + ExcNotImplemented()); + face_orientation = + ReferenceCells::get_hypercube() + .get_inverse_combined_orientation(face_orientation); } this->face_orientations[i] = face_orientation; } -- 2.39.5