Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/scifem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,26 @@ std::tuple<std::vector<T>, std::vector<T>> closest_point_projection(
}
else
{
#ifdef __cpp_lib_jthread
std::vector<std::jthread> threads;
#else
std::vector<std::thread> threads;
#endif
threads.reserve(num_threads);
for (size_t i = 0; i < num_threads; ++i)
{
auto [c0, c1] = dolfinx::MPI::local_range(i, total_cells, num_threads);
threads.emplace_back(compute_chunk, c0, c1);
}
#ifndef __cpp_lib_jthread
for (auto& t : threads)
{
if (t.joinable())
{
t.join();
}
}
#endif
}
return {std::move(closest_points), std::move(reference_points)};
}
Expand Down
Loading