feat(cpp-object-oriented-modular-refactoring): step 5 - solver-workflow-google-style

This commit is contained in:
KOKO\Mimi
2026-08-16 06:20:08 +09:00
parent e1c0e357dd
commit 24f006fe4a
52 changed files with 5817 additions and 6369 deletions
+18 -20
View File
@@ -1,30 +1,28 @@
#include "fesa/assembly/parallel_for.hpp"
#include "fesa/assembly/parallel_for.h"
#include <oneapi/tbb/parallel_for.h>
namespace fesa {
void SerialParallelFor::execute(
std::size_t count,
const std::function<void(std::size_t)>& body) const {
for (std::size_t index = 0; index < count; ++index) {
body(index);
}
void SerialParallelFor::Execute(
std::size_t count, const std::function<void(std::size_t)>& body) const {
for (std::size_t index = 0; index < count; ++index) {
body(index);
}
}
void TbbParallelFor::execute(
std::size_t count,
const std::function<void(std::size_t)>& body) const {
if (count == 0U) {
return;
}
void TbbParallelFor::Execute(
std::size_t count, const std::function<void(std::size_t)>& 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); });
// 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
} // namespace fesa