]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Clean up some orientation code in FiniteElement. 15553/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 30 Jun 2023 22:15:52 +0000 (18:15 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sun, 2 Jul 2023 01:40:57 +0000 (21:40 -0400)
source/fe/fe.cc

index 617c1c057980813f06722fc3f63b7b1a87d74f28..06c10664de93c5e8617f8e137e7b61e81a962e68 100644 (file)
@@ -59,8 +59,7 @@ FiniteElement<dim, spacedim>::FiniteElement(
   const std::vector<bool> &         r_i_a_f,
   const std::vector<ComponentMask> &nonzero_c)
   : FiniteElementData<dim>(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<dim, spacedim>::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<dim, spacedim>::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());

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.