From: Wolfgang Bangerth Date: Sat, 10 Jun 2023 03:29:56 +0000 (-0600) Subject: Minor adjustments to FETools::extrapolate(). X-Git-Tag: v9.5.0-rc1~130^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0d3151edbbddf1e1d8a3e86bc45997dfc28d667;p=dealii.git Minor adjustments to FETools::extrapolate(). --- 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);