aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Sorting
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/Sorting')
-rw-r--r--Source/Particles/Sorting/CMakeLists.txt1
-rw-r--r--Source/Particles/Sorting/Make.package2
-rw-r--r--Source/Particles/Sorting/SortingUtils.H13
-rw-r--r--Source/Particles/Sorting/SortingUtils.cpp22
4 files changed, 26 insertions, 12 deletions
diff --git a/Source/Particles/Sorting/CMakeLists.txt b/Source/Particles/Sorting/CMakeLists.txt
index d3c378e43..60a156f46 100644
--- a/Source/Particles/Sorting/CMakeLists.txt
+++ b/Source/Particles/Sorting/CMakeLists.txt
@@ -3,5 +3,6 @@ foreach(D IN LISTS WarpX_DIMS)
target_sources(lib_${SD}
PRIVATE
Partition.cpp
+ SortingUtils.cpp
)
endforeach()
diff --git a/Source/Particles/Sorting/Make.package b/Source/Particles/Sorting/Make.package
index 16efc02b8..e6ad1604d 100644
--- a/Source/Particles/Sorting/Make.package
+++ b/Source/Particles/Sorting/Make.package
@@ -1,2 +1,4 @@
CEXE_sources += Partition.cpp
+CEXE_sources += SortingUtils.cpp
+
VPATH_LOCATIONS += $(WARPX_HOME)/Source/Particles/Sorting
diff --git a/Source/Particles/Sorting/SortingUtils.H b/Source/Particles/Sorting/SortingUtils.H
index 0bec92d6e..dd53ad6f6 100644
--- a/Source/Particles/Sorting/SortingUtils.H
+++ b/Source/Particles/Sorting/SortingUtils.H
@@ -19,18 +19,7 @@
*
* \param[inout] v Vector of integers, to be filled by this routine
*/
-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
-}
+void fillWithConsecutiveIntegers( amrex::Gpu::DeviceVector<long>& v );
/** \brief Find the indices that would reorder the elements of `predicate`
* so that the elements with non-zero value precede the other elements
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
+}