#include "fesa/assembly/parallel_for.h" #include namespace fesa { void SerialParallelFor::Execute( std::size_t count, const std::function& body) const { for (std::size_t index = 0; index < count; ++index) { body(index); } } void TbbParallelFor::Execute( std::size_t count, const std::function& body) const { if (count == 0U) { return; } // Use oneTBB's caller-scoped scheduler policy. This adapter does not set // process-wide concurrency or override the later MKL/TBB oversubscription // policy. A body exception cancels sibling tasks and is rethrown; work // already running during cancellation may still finish its indexed slot. oneapi::tbb::parallel_for(std::size_t{0}, count, [&body](std::size_t index) { body(index); }); } } // namespace fesa