From ca2a902db334163b08f9e9bc047ccdca08cdf8d6 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 3 Jul 2023 10:31:48 -0600 Subject: [PATCH] Micro-optimize a loop. --- include/deal.II/matrix_free/matrix_free.templates.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index b3a243bfb8..b81af3f9b9 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -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 renumbering; std::vector irregular_cells; -- 2.39.5