From 0704d868aba3df2a5c68b12a02f92771a890b27b Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sun, 6 Jan 2019 17:04:14 +0100 Subject: [PATCH] Use ranged-based for loop in include/multigrid --- .../deal.II/multigrid/mg_transfer.templates.h | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index 882b6c5745..c793215599 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -209,14 +209,10 @@ namespace internal const T &src, V & dst) { - // we should have i->second == i->first, therefore we can use the same - // function for both copying to mg as well as copying from mg - for (std::vector>::const_iterator i = - copy_indices.begin(); - i != copy_indices.end(); - ++i) - dst(i->first) = src(i->first); + // we should have copy_index.second == copy_index.first, therefore we can + // use the same function for both copying to mg as well as copying from mg + for (const auto ©_index : copy_indices) + dst(copy_index.first) = src(copy_index.first); dst.compress(VectorOperation::insert); } @@ -500,19 +496,15 @@ MGLevelGlobalTransfer>::copy_to_mg( LinearAlgebra::distributed::Vector &dst_level = dst[level]; // first copy local unknowns - for (dof_pair_iterator i = this_copy_indices[level].begin(); - i != this_copy_indices[level].end(); - ++i) - dst_level.local_element(i->second) = - this_ghosted_global_vector.local_element(i->first); + for (const auto &indices : this_copy_indices[level]) + dst_level.local_element(indices.second) = + this_ghosted_global_vector.local_element(indices.first); // Do the same for the indices where the level index is local, but the // global index is not - for (dof_pair_iterator i = this_copy_indices_level_mine[level].begin(); - i != this_copy_indices_level_mine[level].end(); - ++i) - dst_level.local_element(i->second) = - this_ghosted_global_vector.local_element(i->first); + for (const auto &indices : this_copy_indices_level_mine[level]) + dst_level.local_element(indices.second) = + this_ghosted_global_vector.local_element(indices.first); dst_level.compress(VectorOperation::insert); } -- 2.39.5