From 7b0fd10dd102461cf9f5af8a31c6f00797846eb4 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 30 Jun 2023 18:15:52 -0400 Subject: [PATCH] Clean up some orientation code in FiniteElement. --- source/fe/fe.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/source/fe/fe.cc b/source/fe/fe.cc index 617c1c0579..06c10664de 100644 --- a/source/fe/fe.cc +++ b/source/fe/fe.cc @@ -59,8 +59,7 @@ FiniteElement::FiniteElement( const std::vector & r_i_a_f, const std::vector &nonzero_c) : FiniteElementData(fe_data) - , adjust_line_dof_index_for_line_orientation_table( - dim == 3 ? this->n_dofs_per_line() : 0) + , adjust_line_dof_index_for_line_orientation_table(this->n_dofs_per_line()) , system_to_base_table(this->n_dofs_per_cell()) , component_to_base_table(this->components, std::make_pair(std::make_pair(0U, 0U), 0U)) @@ -572,12 +571,12 @@ FiniteElement::face_to_cell_index(const unsigned int face_index, AssertIndexRange(face, this->reference_cell().n_faces()); // TODO: we could presumably solve the 3d case below using the - // adjust_quad_dof_index_for_face_orientation_table field. for the - // 2d case, we can't use adjust_line_dof_index_for_line_orientation_table - // since that array is empty (presumably because we thought that - // there are no flipped edges in 2d, but these can happen in - // DoFTools::make_periodicity_constraints, for example). so we - // would need to either fill this field, or rely on derived classes + // adjust_quad_dof_index_for_face_orientation_table field. For the 2d case, we + // can't use adjust_line_dof_index_for_line_orientation_table since that array + // is not populated for elements with quadrilateral reference cells + // (presumably because we thought that there are no flipped edges in 2d, but + // these can happen in DoFTools::make_periodicity_constraints(), for example). + // so we would need to either fill this field, or rely on derived classes // implementing this function, as we currently do // see the function's documentation for an explanation of this @@ -697,11 +696,13 @@ FiniteElement::adjust_line_dof_index_for_line_orientation( const unsigned int index, const bool line_orientation) const { - // general template for 1d and 2d: do - // nothing. Do not throw an Assertion, - // however, in order to allow to call this - // function in 2d as well - if (dim < 3) + // We orient quads (and 1D meshes are always oriented) so always skip those + // cases + // + // TODO - we may want to change this in the future: see also the notes in + // face_to_cell_index() + if (this->reference_cell() == ReferenceCells::Line || + this->reference_cell() == ReferenceCells::Quadrilateral) return index; AssertIndexRange(index, this->n_dofs_per_line()); -- 2.39.5