From 80a589693e9362be14077dc7f9153411471d3898 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 29 Dec 2021 12:21:14 -0700 Subject: [PATCH] Simplify more code in parallel.h via lambda functions. --- include/deal.II/base/parallel.h | 36 +++++++-------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/include/deal.II/base/parallel.h b/include/deal.II/base/parallel.h index bef3174dd1..b86fda95d1 100644 --- a/include/deal.II/base/parallel.h +++ b/include/deal.II/base/parallel.h @@ -808,33 +808,6 @@ namespace internal namespace parallel { -#ifdef DEAL_II_WITH_TBB - - namespace internal - { - /** - * This is the function actually called by TBB for the ParallelForInteger - * class. - */ - struct ParallelForWrapper - { - ParallelForWrapper(const parallel::ParallelForInteger &worker) - : worker_(worker) - {} - - void - operator()(const tbb::blocked_range &range) const - { - worker_.apply_to_subrange(range.begin(), range.end()); - } - - const parallel::ParallelForInteger &worker_; - }; - } // namespace internal - -#endif - - inline void ParallelForInteger::apply_parallel( const std::size_t begin, @@ -848,8 +821,13 @@ namespace parallel apply_to_subrange(begin, end); #else - internal::ParallelForWrapper worker(*this); - internal::parallel_for(begin, end, worker, minimum_parallel_grain_size); + internal::parallel_for( + begin, + end, + [this](const tbb::blocked_range &range) { + apply_to_subrange(range.begin(), range.end()); + }, + minimum_parallel_grain_size); #endif } -- 2.39.5