From a0decfdf3c0ae8f989f6028676ec08bcaeac08ad Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sun, 9 Aug 2020 18:00:56 +0200 Subject: [PATCH] Work on internal::MatrixFreeFunctions::FaceToCellTopology::face_orientation --- include/deal.II/matrix_free/face_info.h | 9 +++++-- include/deal.II/matrix_free/fe_evaluation.h | 29 +++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/deal.II/matrix_free/face_info.h b/include/deal.II/matrix_free/face_info.h index 2c03927bc5..43d8d820e8 100644 --- a/include/deal.II/matrix_free/face_info.h +++ b/include/deal.II/matrix_free/face_info.h @@ -100,8 +100,13 @@ namespace internal * In 3D, one of the two cells adjacent to a face might use a different * orientation (also called as face orientation, face flip and face * rotation) than the standard orientation. This variable stores the - * value (for one of the interior or exterior side) for the present batch - * of faces. + * values of face orientation, face flip and face + * rotation (for one of the interior or exterior side) for the present + * batch of faces in the first free bits. The forth bit is one if the + * internal cell has non-standard orientation. + * + * @note In contrast to other place in the library, the face-orientation + * bit (first bit) is flipped. */ unsigned char face_orientation; diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index b5b172956e..75773881dc 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -7722,22 +7722,19 @@ FEFaceEvaluationface_no = (this->is_interior_face ? faces.interior_face_no : faces.exterior_face_no); - this->subface_index = faces.subface_index; - if (this->is_interior_face == true) - { - this->subface_index = GeometryInfo::max_children_per_cell; - if (faces.face_orientation > 8) - this->face_orientation = faces.face_orientation - 8; - else - this->face_orientation = 0; - } - else - { - if (faces.face_orientation < 8) - this->face_orientation = faces.face_orientation; - else - this->face_orientation = 0; - } + this->subface_index = this->is_interior_face == true ? + GeometryInfo::max_children_per_cell : + faces.subface_index; + + // First check if interior or exterior cell has non-standard orientation + // (i.e. the third bit is one or not). Then set zero if this cell has + // standard-orientation else copy the first three bits + // (which is equivalent to modulo 8). See also the documentation of + // internal::MatrixFreeFunctions::FaceToCellTopology::face_orientation. + this->face_orientation = + (this->is_interior_face == (faces.face_orientation >= 8)) ? + (faces.face_orientation % 8) : + 0; this->cell_type = this->matrix_info->get_mapping_info().face_type[face_index]; const unsigned int offsets = -- 2.39.5