Skip to content

Commit

Permalink
Use CA specializations in places where we don't expect an answer.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed May 25, 2022
1 parent 3d22f86 commit c77ec13
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 36 deletions.
47 changes: 15 additions & 32 deletions include/deal.II/fe/fe_tools_extrapolate.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -1151,40 +1151,23 @@ namespace FETools
return cells_for_this_destination;
};

const auto answer_request =
const auto process_request =
[&received_cells](const unsigned int other_rank,
const std::vector<CellData> &request) -> int {
// We got a message from 'other_rank', so let us decode the
// message in the same way as we have assembled it above.
// Note that the cells just received do not contain
// information where they came from, and we have to add that
// ourselves for later use.
for (CellData cell_data : request)
{
cell_data.receiver = other_rank;
received_cells.emplace_back(std::move(cell_data));
}

// Nothing left to do here, we don't actually need to provide an
// answer:
return 0;
};

const auto read_answer = [](const unsigned int /*other_rank*/,
const int &answer) {
// We don't put anything into the answers, so nothing should
// have been coming out at this end either that differs from
// the default-sent zero integer:
(void)answer;
Assert(answer == 0, ExcInternalError());
};
const std::vector<CellData> &request) {
// We got a message from 'other_rank', so let us decode the
// message in the same way as we have assembled it above.
// Note that the cells just received do not contain
// information where they came from, and we have to add that
// ourselves for later use.
for (CellData cell_data : request)
{
cell_data.receiver = other_rank;
received_cells.emplace_back(std::move(cell_data));
}
};

Utilities::MPI::ConsensusAlgorithms::selector<std::vector<CellData>, int>(
destinations,
create_request,
answer_request,
read_answer,
communicator);
Utilities::MPI::ConsensusAlgorithms::selector<std::vector<CellData>>(
destinations, create_request, process_request, communicator);
}


Expand Down
9 changes: 5 additions & 4 deletions source/grid/tria_description.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,17 @@ namespace TriangulationDescription
return description_temp[other_rank_index];
};

const auto answer_request =
const auto process_request =
[&](const unsigned int,
const DescriptionTemp<dim, spacedim> &request) {
this->merge(request, vertices_have_unique_ids);
return char{};
};

dealii::Utilities::MPI::ConsensusAlgorithms::selector<
DescriptionTemp<dim, spacedim>,
char>(relevant_processes, create_request, answer_request, {}, comm);
DescriptionTemp<dim, spacedim>>(relevant_processes,
create_request,
process_request,
comm);
}

/**
Expand Down

0 comments on commit c77ec13

Please sign in to comment.