]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Try making clang-tidy happy
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 9 Mar 2023 22:52:29 +0000 (17:52 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 9 Mar 2023 22:52:39 +0000 (17:52 -0500)
source/base/mpi.cc

index 0e0454697cb7ae1e529499f522e9f4873e7aafbd..f4642bc077c576e08cdba035a9dca9ae6ca53d23 100644 (file)
@@ -777,18 +777,18 @@ namespace Utilities
 
       // Initialize Kokkos
       {
-        std::vector<char *> argv_new;
+        std::vector<char *> argv_new(argc + 2);
         for (int i = 0; i < argc; ++i)
-          argv_new.push_back(argv[i]);
+          argv_new[i] = argv[i];
         std::stringstream threads_flag;
 #if KOKKOS_VERSION >= 30700
         threads_flag << "--kokkos-num-threads=" << MultithreadInfo::n_threads();
 #else
         threads_flag << "--kokkos-threads=" << MultithreadInfo::n_threads();
 #endif
-        argv_new.push_back(const_cast<char *>(threads_flag.str().c_str()));
-        argv_new.push_back(nullptr);
-        int argc_new = argc + 1;
+        argv_new[argc]     = const_cast<char *>(threads_flag.str().c_str());
+        argv_new[argc + 1] = nullptr;
+        int argc_new       = argc + 1;
         Kokkos::initialize(argc_new, argv_new.data());
       }
 

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.