From: Maximilian Bergbauer Date: Mon, 15 Apr 2024 14:51:06 +0000 (+0200) Subject: Implement n_active_entries_per_quadrature_batch X-Git-Tag: v9.6.0-rc1~357^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5848835bab5e29ed6b55468951314e8963cc41dd;p=dealii.git Implement n_active_entries_per_quadrature_batch --- 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