]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Micro-optimize a loop.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 3 Jul 2023 16:31:48 +0000 (10:31 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 3 Jul 2023 16:37:15 +0000 (10:37 -0600)
include/deal.II/matrix_free/matrix_free.templates.h

index b3a243bfb86758ab219e751852bdea8a063ef3cd..b81af3f9b9ee1983ee70ecf23eb65e5f9cdbdad3 100644 (file)
@@ -1486,10 +1486,11 @@ namespace internal
         }
     }
 
-    bool hp_functionality_enabled = false;
-    for (const auto &dh : dof_handler)
-      if (dh->get_fe_collection().size() > 1)
-        hp_functionality_enabled = true;
+    const bool hp_functionality_enabled =
+      std::any_of(dof_handler.begin(), dof_handler.end(), [](const auto &dh) {
+        return (dh->get_fe_collection().size() > 1);
+      });
+
     const unsigned int         n_lanes = task_info.vectorization_length;
     std::vector<unsigned int>  renumbering;
     std::vector<unsigned char> irregular_cells;

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.