]> https://gitweb.dealii.org/ - dealii.git/commitdiff
FE_Q_Base: Simplify some code with 'if constexpr'.
authorDavid Wells <drwells@email.unc.edu>
Tue, 9 Apr 2024 23:41:39 +0000 (19:41 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 13 Apr 2024 11:44:53 +0000 (07:44 -0400)
source/fe/fe_q_base.cc

index f1c8e2150bfcfab05d41fc81f8ec2f77db27bd74..195907161878783a5f3b2c57e12b4593f9c698e2 100644 (file)
@@ -1641,15 +1641,12 @@ FE_Q_Base<dim, spacedim>::has_support_on_face(
              ExcInternalError());
 
       // in 2d, the line is the face, so get the line index
-      if (dim == 2)
+      if constexpr (dim == 2)
         return (line_index == face_index);
-      else if (dim == 3)
+      else if constexpr (dim == 3)
         {
-          // silence compiler warning
-          const unsigned int lines_per_face =
-            dim == 3 ? GeometryInfo<dim>::lines_per_face : 1;
           // see whether the given line is on the given face.
-          for (unsigned int l = 0; l < lines_per_face; ++l)
+          for (unsigned int l = 0; l < GeometryInfo<3>::lines_per_face; ++l)
             if (GeometryInfo<3>::face_to_cell_lines(face_index, l) ==
                 line_index)
               return true;

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.