aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Sorting/SortingUtils.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2023-09-14 08:38:12 +0900
committerGravatar GitHub <noreply@github.com> 2023-09-13 16:38:12 -0700
commit6c4436e1f9ec0a2fcd40cdf2692beea14074e459 (patch)
tree720d1a912407136aea61edc1d4365ba728ea34a2 /Source/Particles/Sorting/SortingUtils.cpp
parent5f40a2b5304d2a01c3c5676faca8dc5b9714ed4f (diff)
downloadWarpX-6c4436e1f9ec0a2fcd40cdf2692beea14074e459.tar.gz
WarpX-6c4436e1f9ec0a2fcd40cdf2692beea14074e459.tar.zst
WarpX-6c4436e1f9ec0a2fcd40cdf2692beea14074e459.zip
Clang tidy CI test: add misc-definitions-in-headers check (#4253)
* Clang-tidy: add misc-definitions-in-headers check * address issues found with clang-tidy * remove std::cout added for debug purposes * add back newline
Diffstat (limited to 'Source/Particles/Sorting/SortingUtils.cpp')
-rw-r--r--Source/Particles/Sorting/SortingUtils.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Particles/Sorting/SortingUtils.cpp b/Source/Particles/Sorting/SortingUtils.cpp
new file mode 100644
index 000000000..699119e8e
--- /dev/null
+++ b/Source/Particles/Sorting/SortingUtils.cpp
@@ -0,0 +1,22 @@
+/* Copyright 2019-2020 Andrew Myers, Maxence Thevenet, Remi Lehe
+ * Weiqun Zhang
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+
+#include "SortingUtils.H"
+
+void fillWithConsecutiveIntegers( amrex::Gpu::DeviceVector<long>& v )
+{
+#ifdef AMREX_USE_GPU
+ // On GPU: Use amrex
+ auto data = v.data();
+ auto N = v.size();
+ AMREX_FOR_1D( N, i, {data[i] = i;});
+#else
+ // On CPU: Use std library
+ std::iota( v.begin(), v.end(), 0L );
+#endif
+}