]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement n_active_entries_per_quadrature_batch
authorMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Mon, 15 Apr 2024 14:51:06 +0000 (16:51 +0200)
committerMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Tue, 16 Apr 2024 14:32:17 +0000 (16:32 +0200)
include/deal.II/matrix_free/fe_point_evaluation.h

index eef4c60f9f2c22ed2ffad6362b4cd94ed32d64ed..d66926e8897aa7f764ba76173d087f5f6b54c7dd 100644 (file)
@@ -816,6 +816,12 @@ public:
   inline std_cxx20::ranges::iota_view<unsigned int, unsigned int>
   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<Number>::width();
@@ -2444,6 +2450,29 @@ inline typename FEPointEvaluationBase<n_components_, dim, spacedim, Number>::
 
 
 
+template <int n_components_, int dim, int spacedim, typename Number>
+unsigned int
+FEPointEvaluationBase<n_components_, dim, spacedim, Number>::
+  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 <int n_components_, int dim, int spacedim, typename Number>
 template <std::size_t stride_view>
 void

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.