decltype(*std::declval<OutputIterator>()),
std::invoke_result_t<Function,
decltype(*std::declval<InputIterator>())>>))
- void transform(const InputIterator &begin_in,
- const InputIterator &end_in,
- OutputIterator out,
- const Function &function,
- const unsigned int grainsize)
+ DEAL_II_DEPRECATED_EARLY void transform(const InputIterator &begin_in,
+ const InputIterator &end_in,
+ OutputIterator out,
+ const Function &function,
+ const unsigned int grainsize)
{
- #ifndef DEAL_II_WITH_TBB
- // make sure we don't get compiler
- // warnings about unused arguments
- (void)grainsize;
+ #ifdef DEAL_II_WITH_TASKFLOW
+ using Iterators = std::tuple<InputIterator, OutputIterator>;
+ using SyncIterators = SynchronousIterators<Iterators>;
+ Iterators x_begin(begin_in, out);
+ Iterators x_end(end_in, OutputIterator());
- for (InputIterator in = begin_in; in != end_in;)
- *out++ = function(*in++);
- #else
+ internal::taskflow_parallel_for(
+ SyncIterators(x_begin),
+ SyncIterators(x_end),
+ [function](const auto &it) {
+ *std::get<1>(it) = function(*std::get<0>(it));
+ },
+ grainsize);
+
+ #elif defined(DEAL_II_WITH_TBB)
using Iterators = std::tuple<InputIterator, OutputIterator>;
using SyncIterators = SynchronousIterators<Iterators>;
Iterators x_begin(begin_in, out);
std::invoke_result_t<Function,
decltype(*std::declval<InputIterator1>()),
decltype(*std::declval<InputIterator2>())>>))
- void transform(const InputIterator1 &begin_in1,
- const InputIterator1 &end_in1,
- InputIterator2 in2,
- OutputIterator out,
- const Function &function,
- const unsigned int grainsize)
+ DEAL_II_DEPRECATED_EARLY void transform(const InputIterator1 &begin_in1,
+ const InputIterator1 &end_in1,
+ InputIterator2 in2,
+ OutputIterator out,
+ const Function &function,
+ const unsigned int grainsize)
{
- #ifndef DEAL_II_WITH_TBB
- // make sure we don't get compiler
- // warnings about unused arguments
- (void)grainsize;
+ #ifdef DEAL_II_WITH_TASKFLOW
+ using Iterators =
+ std::tuple<InputIterator1, InputIterator2, OutputIterator>;
+ using SyncIterators = SynchronousIterators<Iterators>;
+ Iterators x_begin(begin_in1, in2, out);
+ Iterators x_end(end_in1, InputIterator2(), OutputIterator());
- for (InputIterator1 in1 = begin_in1; in1 != end_in1;)
- *out++ = function(*in1++, *in2++);
- #else
+ internal::taskflow_parallel_for(
+ SyncIterators(x_begin),
+ SyncIterators(x_end),
+ [function](const auto &it) {
+ *std::get<2>(it) = function(*std::get<0>(it), *std::get<1>(it));
+ },
+ grainsize);
+
+ #elif defined(DEAL_II_WITH_TBB)
using Iterators =
std::tuple<InputIterator1, InputIterator2, OutputIterator>;
using SyncIterators = SynchronousIterators<Iterators>;
decltype(*std::declval<InputIterator1>()),
decltype(*std::declval<InputIterator2>()),
decltype(*std::declval<InputIterator3>())>>))
- void transform(const InputIterator1 &begin_in1,
- const InputIterator1 &end_in1,
- InputIterator2 in2,
- InputIterator3 in3,
- OutputIterator out,
- const Function &function,
- const unsigned int grainsize)
+ DEAL_II_DEPRECATED_EARLY void transform(const InputIterator1 &begin_in1,
+ const InputIterator1 &end_in1,
+ InputIterator2 in2,
+ InputIterator3 in3,
+ OutputIterator out,
+ const Function &function,
+ const unsigned int grainsize)
{
- #ifndef DEAL_II_WITH_TBB
- // make sure we don't get compiler
- // warnings about unused arguments
- (void)grainsize;
+ #ifdef DEAL_II_WITH_TASKFLOW
+ using Iterators = std::
+ tuple<InputIterator1, InputIterator2, InputIterator3, OutputIterator>;
+ using SyncIterators = SynchronousIterators<Iterators>;
+ Iterators x_begin(begin_in1, in2, in3, out);
+ Iterators x_end(end_in1,
+ InputIterator2(),
+ InputIterator3(),
+ OutputIterator());
- for (InputIterator1 in1 = begin_in1; in1 != end_in1;)
- *out++ = function(*in1++, *in2++, *in3++);
- #else
+ internal::taskflow_parallel_for(
+ SyncIterators(x_begin),
+ SyncIterators(x_end),
+ [function](const auto &it) {
+ *std::get<3>(it) =
+ function(*std::get<0>(it), *std::get<1>(it), *std::get<2>(it));
+ },
+ grainsize);
+
+ #elif defined(DEAL_II_WITH_TBB)
using Iterators = std::
tuple<InputIterator1, InputIterator2, InputIterator3, OutputIterator>;
using SyncIterators = SynchronousIterators<Iterators>;