From: Wolfgang Bangerth Date: Mon, 3 Jul 2023 16:31:48 +0000 (-0600) Subject: Micro-optimize a loop. X-Git-Tag: relicensing~761^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca2a902db334163b08f9e9bc047ccdca08cdf8d6;p=dealii.git Micro-optimize a loop. --- 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;