aboutsummaryrefslogtreecommitdiff
path: root/Source/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers2@gmail.com> 2018-11-28 16:30:02 -0800
committerGravatar Andrew Myers <atmyers2@gmail.com> 2018-11-28 16:30:02 -0800
commitc36189948b57b8f39ee6e86e42102baa7f234915 (patch)
tree5aae695876a6d9917b2a412cf784bd9ce51ad50f /Source/PhysicalParticleContainer.cpp
parentcfe96495e5aff13291ecf92a0a57c9623cd9ba1b (diff)
downloadWarpX-c36189948b57b8f39ee6e86e42102baa7f234915.tar.gz
WarpX-c36189948b57b8f39ee6e86e42102baa7f234915.tar.zst
WarpX-c36189948b57b8f39ee6e86e42102baa7f234915.zip
fix AddPlasmaGPU for the case when there are already some particles on the tile
Diffstat (limited to 'Source/PhysicalParticleContainer.cpp')
-rw-r--r--Source/PhysicalParticleContainer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/PhysicalParticleContainer.cpp b/Source/PhysicalParticleContainer.cpp
index ccb269343..43ac0a59f 100644
--- a/Source/PhysicalParticleContainer.cpp
+++ b/Source/PhysicalParticleContainer.cpp
@@ -657,17 +657,22 @@ PhysicalParticleContainer::AddPlasmaGPU (int lev, RealBox part_realbox)
}
}
+
+ amrex::Print() << "got " << host_particles.size() << " particles to add \n";
+
auto& particle_tile = GetParticles(lev)[std::make_pair(grid_id,tile_id)];
- particle_tile.resize(host_particles.size());
+ auto old_size = particle_tile.GetArrayOfStructs().size();
+ auto new_size = old_size + host_particles.size();
+ particle_tile.resize(new_size);
thrust::copy(host_particles.begin(),
host_particles.end(),
- particle_tile.GetArrayOfStructs().begin());
+ particle_tile.GetArrayOfStructs().begin() + old_size);
for (int kk = 0; kk < PIdx::nattribs; ++kk) {
thrust::copy(host_attribs[kk].begin(),
host_attribs[kk].end(),
- particle_tile.GetStructOfArrays().GetRealData(kk).begin());
+ particle_tile.GetStructOfArrays().GetRealData(kk).begin() + old_size);
}
if (cost) {