From 5848835bab5e29ed6b55468951314e8963cc41dd Mon Sep 17 00:00:00 2001 From: Maximilian Bergbauer Date: Mon, 15 Apr 2024 16:51:06 +0200 Subject: [PATCH] Implement n_active_entries_per_quadrature_batch --- .../deal.II/matrix_free/fe_point_evaluation.h | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/deal.II/matrix_free/fe_point_evaluation.h b/include/deal.II/matrix_free/fe_point_evaluation.h index eef4c60f9f..d66926e889 100644 --- a/include/deal.II/matrix_free/fe_point_evaluation.h +++ b/include/deal.II/matrix_free/fe_point_evaluation.h @@ -816,6 +816,12 @@ public: inline std_cxx20::ranges::iota_view quadrature_point_indices() const; + /** + * Returns how many lanes of a quadrature batch are active. + */ + unsigned int + n_active_entries_per_quadrature_batch(unsigned int q); + protected: static constexpr std::size_t n_lanes_user_interface = internal::VectorizedArrayTrait::width(); @@ -2444,6 +2450,29 @@ inline typename FEPointEvaluationBase:: +template +unsigned int +FEPointEvaluationBase:: + n_active_entries_per_quadrature_batch(unsigned int q) +{ + Assert(stride == 1, + ExcMessage( + "Calling this function only makes sense in fully vectorized mode.")); + if (q == n_q_batches - 1) + { + const unsigned int n_filled_lanes = + n_q_points_scalar & (n_lanes_user_interface - 1); + if (n_filled_lanes == 0) + return n_lanes_user_interface; + else + return n_filled_lanes; + } + else + return n_lanes_user_interface; +} + + + template template void -- 2.39.5