]> https://gitweb.dealii.org/ - dealii.git/commitdiff
examples/stpe-69: use std::copy_n instead of std::copy 11919/head
authorMatthias Maier <tamiko@43-1.org>
Mon, 15 Mar 2021 22:30:37 +0000 (17:30 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 15 Mar 2021 22:30:37 +0000 (17:30 -0500)
A std::copy_n is more more elegant than the std::copy variant that need
to take the address of an element past the momentum.

Thanks to @guermond and @ejtovar for pointing this out.

examples/step-69/step-69.cc

index db5cb11c42331bf36b5a4992550a283636537d4b..4c079630eee8312a10154987d6a9cedfb3a98605 100644 (file)
@@ -1329,7 +1329,7 @@ namespace Step69
   ProblemDescription<dim>::momentum(const state_type &U)
   {
     Tensor<1, dim> result;
-    std::copy(&U[1], &U[1 + dim], &result[0]);
+    std::copy_n(&U[1], dim, &result[0]);
     return result;
   }
 

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.