Skip to content
Snippets Groups Projects
Commit 9f0a0034 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[AL] Add SerialExecutor::execute for two container.

This is used in initialization of LocalAssemblerData for every mesh element.
parent 698a0a3f
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,32 @@ struct SerialExecutor ...@@ -40,6 +40,32 @@ struct SerialExecutor
f(i, c[i], std::forward<Args_>(args)...); f(i, c[i], std::forward<Args_>(args)...);
} }
/// Same as execute(f, c), but with two containers, where the second one is
/// modified.
///
/// \tparam F \c f type.
/// \tparam C input container type.
/// \tparam Data input/output container type.
///
/// \param f a function that accepts a pointer to container's elements,
/// an index, and a second container element as arguments, which
/// is modified.
/// \param c a container supporting const access over operator[] and size().
/// \param data a container supporting non-const access over operator[] and size().
template <typename F, typename C, typename Data, typename ...Args_>
static
void
#if defined(_MSC_VER) && (_MSC_VER >= 1700)
execute(F& f, C const& c, Data& data, Args_&&... args)
#else
execute(F const& f, C const& c, Data& data, Args_&&... args)
#endif
{
assert(c.size() == data.size());
for (std::size_t i = 0; i < c.size(); i++)
f(i, c[i], data[i], std::forward<Args_>(args)...);
}
}; };
} // namespace AssemblerLib } // namespace AssemblerLib
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment