]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add sequential parallel_for.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sun, 2 Jul 2023 21:17:06 +0000 (15:17 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 3 Jul 2023 19:02:15 +0000 (13:02 -0600)
include/deal.II/base/parallel.h

index ee85ca2ed05483af2e734e798fda240c47f1666e..bbf6eeb354f9b0e41864492b272e124e1772b906 100644 (file)
@@ -34,6 +34,8 @@
 #  include <tbb/parallel_for.h>
 #  include <tbb/parallel_reduce.h>
 #  include <tbb/partitioner.h>
+#else
+#  include <boost/range/iterator_range.hpp>
 #endif
 
 #ifdef DEAL_II_HAVE_CXX20
@@ -106,6 +108,22 @@ namespace parallel
                         functor,
                         *partitioner);
     }
+
+#else
+
+    /**
+     * Just execute things sequentially.
+     */
+    template <typename Iterator, typename Functor>
+    void
+    parallel_for(Iterator       x_begin,
+                 Iterator       x_end,
+                 const Functor &functor,
+                 const unsigned int)
+    {
+      functor(boost::iterator_range<Iterator>(x_begin, x_end));
+    }
+
 #endif
   } // namespace internal
 

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.