From: Wolfgang Bangerth Date: Wed, 29 Dec 2021 19:21:14 +0000 (-0700) Subject: Simplify more code in parallel.h via lambda functions. X-Git-Tag: v9.4.0-rc1~684^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13153%2Fhead;p=dealii.git Simplify more code in parallel.h via lambda functions. --- 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 }