From 64d86d6c553de2a0fb05c1862eb469e82ddd5093 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 28 Jun 2022 07:33:06 +0200 Subject: [PATCH] Speed up ReferenceCell::standard_vs_true_line_orientation --- include/deal.II/grid/reference_cell.h | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index 251dd39888..c1a922361c 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -2243,26 +2243,11 @@ ReferenceCell::standard_vs_true_line_orientation( { if (*this == ReferenceCells::Hexahedron) { - static const bool bool_table[2][2][2][2] = { - {{{true, false}, // lines 0/1, face_orientation=false, - // face_flip=false, face_rotation=false and true - {false, true}}, // lines 0/1, face_orientation=false, - // face_flip=true, face_rotation=false and true - {{true, true}, // lines 0/1, face_orientation=true, - // face_flip=false, face_rotation=false and true - {false, false}}}, // lines 0/1, face_orientation=true, - // face_flip=true, face_rotation=false and true - - {{{true, true}, // lines 2/3 ... - {false, false}}, - {{true, false}, {false, true}}}}; + static constexpr dealii::ndarray bool_table{ + {{{true, true, false, true, false, false, true, false}}, + {{true, true, true, false, false, false, false, true}}}}; - const bool face_orientation = Utilities::get_bit(face_orientation_raw, 0); - const bool face_flip = Utilities::get_bit(face_orientation_raw, 2); - const bool face_rotation = Utilities::get_bit(face_orientation_raw, 1); - - return (line_orientation == - bool_table[line / 2][face_orientation][face_flip][face_rotation]); + return (line_orientation == bool_table[line / 2][face_orientation_raw]); } else // TODO: This might actually be wrong for some of the other -- 2.39.5