]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use ranged-based for loop in include/multigrid 7598/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 6 Jan 2019 16:04:14 +0000 (17:04 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 14 Jan 2019 23:43:42 +0000 (00:43 +0100)
include/deal.II/multigrid/mg_transfer.templates.h

index 882b6c5745941539106c4d181922146841617182..c7932155997f6fadcf835c881ab1ed64446e1030 100644 (file)
@@ -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<std::pair<types::global_dof_index,
-                               types::global_dof_index>>::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 &copy_index : copy_indices)
+      dst(copy_index.first) = src(copy_index.first);
     dst.compress(VectorOperation::insert);
   }
 
@@ -500,19 +496,15 @@ MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<Number>>::copy_to_mg(
       LinearAlgebra::distributed::Vector<Number> &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);
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.