From: Daniel Arndt Date: Sun, 6 Jan 2019 16:04:14 +0000 (+0100) Subject: Use ranged-based for loop in include/multigrid X-Git-Tag: v9.1.0-rc1~436^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0704d868aba3df2a5c68b12a02f92771a890b27b;p=dealii.git Use ranged-based for loop in include/multigrid --- 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); }