From d0d3151edbbddf1e1d8a3e86bc45997dfc28d667 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 9 Jun 2023 21:29:56 -0600 Subject: [PATCH] Minor adjustments to FETools::extrapolate(). --- include/deal.II/fe/fe_tools_extrapolate.templates.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/deal.II/fe/fe_tools_extrapolate.templates.h b/include/deal.II/fe/fe_tools_extrapolate.templates.h index 9bf3e705df..27e2813d70 100644 --- a/include/deal.II/fe/fe_tools_extrapolate.templates.h +++ b/include/deal.II/fe/fe_tools_extrapolate.templates.h @@ -1224,9 +1224,15 @@ namespace FETools const CellData & cell_data, std::vector &cells_list) { + // Find the place to insert the cell: typename std::vector::iterator bound = std::lower_bound(cells_list.begin(), cells_list.end(), cell_data); + // There are three possibilities: The cell needs to be inserted + // at the end, the cell needs to be inserted just before the place + // std::lower_bound found, or the cell already exists in the list + // and no longer needs to be inserted. In that last case, + // cell_data==*bound. if ((bound == cells_list.end()) || (cell_data < *bound)) cells_list.insert(bound, 1, cell_data); } @@ -1267,8 +1273,8 @@ namespace FETools unsigned int ready = 0; do { - for (unsigned int i = 0; i < received_needs.size(); ++i) - cell_data_insert(received_needs[i], cells_to_compute); + for (const auto &need : received_needs) + cell_data_insert(need, cells_to_compute); compute_cells(dof2, u, cells_to_compute, computed_cells, new_needs); -- 2.39.5