diff options
Diffstat (limited to 'Source/Particles/Sorting/SortingUtils.H')
-rw-r--r-- | Source/Particles/Sorting/SortingUtils.H | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/Particles/Sorting/SortingUtils.H b/Source/Particles/Sorting/SortingUtils.H new file mode 100644 index 000000000..d072ebd2a --- /dev/null +++ b/Source/Particles/Sorting/SortingUtils.H @@ -0,0 +1,18 @@ +#ifndef WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ +#define WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ + +#include <AMReX_Gpu.H> +#include <AMReX_CudaContainers.H> + +// TODO: Add documentation +void fillWithConsecutiveIntegers( amrex::Gpu::ManagedDeviceVector<long>& v ) { +#ifdef AMREX_USE_GPU + // On GPU: Use thrust + thrust::sequence( v.begin(), v.end() ); +#else + // On CPU: Use std library + std::iota( v.begin(), v.end(), 0L ); +#endif +} + +#endif // WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ |