Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use parallel::apply_to_subranges(). #15679

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions include/deal.II/lac/affine_constraints.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,13 @@ AffineConstraints<number>::close()
// appears. obviously, 0*something can be omitted.
//
// This can be done in parallel:
parallel::internal::parallel_for(
parallel::apply_to_subranges(
lines.begin(),
lines.end(),
[](const auto &range) {
for (ConstraintLine &line : range)
[](const typename std::vector<ConstraintLine>::iterator begin,
const typename std::vector<ConstraintLine>::iterator end) {
for (ConstraintLine &line : boost::iterator_range<
typename std::vector<ConstraintLine>::iterator>(begin, end))
line.entries.erase(
std::remove_if(line.entries.begin(),
line.entries.end(),
Expand Down Expand Up @@ -826,11 +828,13 @@ AffineConstraints<number>::close()
//
// This is again an operation that works on each line separately. It can be
// run in parallel:
parallel::internal::parallel_for(
parallel::apply_to_subranges(
lines.begin(),
lines.end(),
[](const auto &range) {
for (ConstraintLine &line : range)
[](const typename std::vector<ConstraintLine>::iterator &begin,
const typename std::vector<ConstraintLine>::iterator &end) {
for (ConstraintLine &line : boost::iterator_range<
typename std::vector<ConstraintLine>::iterator>(begin, end))
{
std::sort(line.entries.begin(),
line.entries.end(),
Expand Down