]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify some code. 10781/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 31 Jul 2020 23:44:50 +0000 (17:44 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 18 Aug 2020 13:26:16 +0000 (07:26 -0600)
include/deal.II/dofs/dof_accessor.templates.h

index c7c9cc567f480ce54e67be27ab716f91a6b1f34c..bd0e040f73c48a9e61847b064a8b63e8f0215da4 100644 (file)
@@ -825,37 +825,25 @@ namespace internal
               dofs_per_quad   = fe.n_dofs_per_quad(),   //
               dofs_per_hex    = fe.n_dofs_per_hex();    //
 
-            const unsigned int inner_dofs =
-              structdim == 1 ? dofs_per_line :
-                               (structdim == 2 ? dofs_per_quad : dofs_per_hex);
-
             unsigned int index = 0;
 
             // 1) VERTEX dofs
-            for (const auto vertex : accessor.vertex_indices())
-              {
-                (void)vertex;
-                index += dofs_per_vertex;
-              }
+            index += dofs_per_vertex * accessor.n_vertices();
 
             // 2) LINE dofs
             if (structdim == 2 || structdim == 3)
-              for (const auto line : accessor.line_indices())
-                {
-                  (void)line;
-                  index += dofs_per_line;
-                }
+              index += dofs_per_line * accessor.n_lines();
 
             // 3) FACE dofs
             if (structdim == 3)
-              for (const auto face : accessor.face_indices())
-                {
-                  (void)face;
-                  index += dofs_per_quad;
-                }
+              index += dofs_per_quad * accessor.n_faces();
 
             // 4) INNER dofs
-            index += inner_dofs;
+            const unsigned int interior_dofs =
+              structdim == 1 ? dofs_per_line :
+                               (structdim == 2 ? dofs_per_quad : dofs_per_hex);
+
+            index += interior_dofs;
 
             return index;
           }

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.