aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Sorting/Partition.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-09-25 14:53:21 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-10-01 16:32:38 -0700
commitfeac8d56e5cc84f63f6e7be7e1668113558c9e47 (patch)
tree22535973a3daf9df09ccbc68adc17f3e7504d979 /Source/Particles/Sorting/Partition.cpp
parenta7d4ebb9cb2b7528b7b1891eccb794fb6b70cf09 (diff)
downloadWarpX-feac8d56e5cc84f63f6e7be7e1668113558c9e47.tar.gz
WarpX-feac8d56e5cc84f63f6e7be7e1668113558c9e47.tar.zst
WarpX-feac8d56e5cc84f63f6e7be7e1668113558c9e47.zip
Implement `iota` on GPU
Diffstat (limited to 'Source/Particles/Sorting/Partition.cpp')
-rw-r--r--Source/Particles/Sorting/Partition.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Particles/Sorting/Partition.cpp b/Source/Particles/Sorting/Partition.cpp
index 29e187821..49d4d25a6 100644
--- a/Source/Particles/Sorting/Partition.cpp
+++ b/Source/Particles/Sorting/Partition.cpp
@@ -1,5 +1,6 @@
-#include <WarpX.H>
+#include <SortingUtils.H>
#include <PhysicalParticleContainer.H>
+#include <WarpX.H>
#include <AMReX_Particles.H>
using namespace amrex;
@@ -43,7 +44,7 @@ PhysicalParticleContainer::PartitionParticlesInBuffers(
Gpu::ManagedDeviceVector<int> inexflag;
inexflag.resize(np);
- // We need to partition the large buffer first
+ // Select the largest buffer first
iMultiFab const* bmasks =
(WarpX::n_field_gather_buffer >= WarpX::n_current_deposition_buffer) ?
gather_masks : current_masks;
@@ -60,9 +61,10 @@ PhysicalParticleContainer::PartitionParticlesInBuffers(
}
);
- Vector<long> pid;
+ // Partition the particles according whether they are in the large buffer or not
+ Gpu::ManagedDeviceVector<long> pid;
pid.resize(np);
- std::iota(pid.begin(), pid.end(), 0L);
+ fillWithConsecutiveIntegers( pid );
auto sep = std::stable_partition(pid.begin(), pid.end(),
[&inexflag](long id) { return inexflag[id]; });