From 8b28144222864f00a68768333719683a9c5c1883 Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@43-1.org>
Date: Thu, 6 Jan 2022 07:13:41 -0600
Subject: [PATCH] port workstream.h to oneAPI

---
 include/deal.II/base/work_stream.h | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/deal.II/base/work_stream.h b/include/deal.II/base/work_stream.h
index 210cffd85a..30f09e6bfe 100644
--- a/include/deal.II/base/work_stream.h
+++ b/include/deal.II/base/work_stream.h
@@ -499,7 +499,12 @@ namespace WorkStream
                                         sample_scratch_data,
                                         sample_copy_data);
         auto tbb_item_stream_filter = tbb::make_filter<void, ItemType *>(
-          tbb::filter::serial, [&](tbb::flow_control &fc) -> ItemType * {
+#    ifdef DEAL_II_TBB_WITH_ONEAPI
+          tbb::filter_mode::serial_in_order,
+#    else
+          tbb::filter::serial,
+#    endif
+          [&](tbb::flow_control &fc) -> ItemType * {
             if (const auto item = iterator_range_to_item_stream.get_item())
               return item;
             else
@@ -515,7 +520,11 @@ namespace WorkStream
         // The second stage is the one that does the actual work. This is the
         // stage that runs in parallel
         auto tbb_worker_filter = tbb::make_filter<ItemType *, ItemType *>(
+#    ifdef DEAL_II_TBB_WITH_ONEAPI
+          tbb::filter_mode::parallel,
+#    else
           tbb::filter::parallel,
+#    endif
           [worker =
              std::function<void(const Iterator &, ScratchData &, CopyData &)>(
                worker),
@@ -608,7 +617,11 @@ namespace WorkStream
         // The last stage is the one that copies data from the CopyData objects
         // to the final destination. This stage runs sequentially again.
         auto tbb_copier_filter = tbb::make_filter<ItemType *, void>(
+#    ifdef DEAL_II_TBB_WITH_ONEAPI
+          tbb::filter_mode::serial_in_order,
+#    else
           tbb::filter::serial,
+#    endif
           [copier = std::function<void(const CopyData &)>(copier)](
             ItemType *current_item) {
             if (copier)
-- 
2.39.5