diff options
author | 2020-01-27 13:42:39 -0800 | |
---|---|---|
committer | 2020-01-27 13:42:39 -0800 | |
commit | 4b4f13857bd4fd623096a367b784e30fe15a8810 (patch) | |
tree | 7889b9ca59ed8e6eb43ec50261d6b76f3bcb0080 /Source/Particles/PhotonParticleContainer.cpp | |
parent | 1080fc43778ac92174a2ed94750a3b14673b14a3 (diff) | |
download | WarpX-4b4f13857bd4fd623096a367b784e30fe15a8810.tar.gz WarpX-4b4f13857bd4fd623096a367b784e30fe15a8810.tar.zst WarpX-4b4f13857bd4fd623096a367b784e30fe15a8810.zip |
remove the copies between soa and aos for the particle positions
Diffstat (limited to 'Source/Particles/PhotonParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhotonParticleContainer.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index c03ed00c2..bf4ed7055 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -50,19 +50,16 @@ void PhotonParticleContainer::InitData() } void -PhotonParticleContainer::PushPX(WarpXParIter& pti, - Gpu::ManagedDeviceVector<ParticleReal>& xp, - Gpu::ManagedDeviceVector<ParticleReal>& yp, - Gpu::ManagedDeviceVector<ParticleReal>& zp, - Real dt, DtType a_dt_type) +PhotonParticleContainer::PushPX(WarpXParIter& pti, Real dt, DtType a_dt_type) { // This wraps the momentum and position advance so that inheritors can modify the call. auto& attribs = pti.GetAttribs(); + // Extract pointers to the different particle quantities - ParticleReal* const AMREX_RESTRICT x = xp.dataPtr(); - ParticleReal* const AMREX_RESTRICT y = yp.dataPtr(); - ParticleReal* const AMREX_RESTRICT z = zp.dataPtr(); + auto& aos = pti.GetArrayOfStructs(); + ParticleType* AMREX_RESTRICT const pstruct = aos().dataPtr(); + ParticleReal* const AMREX_RESTRICT ux = attribs[PIdx::ux].dataPtr(); ParticleReal* const AMREX_RESTRICT uy = attribs[PIdx::uy].dataPtr(); ParticleReal* const AMREX_RESTRICT uz = attribs[PIdx::uz].dataPtr(); @@ -75,15 +72,14 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, if (WarpX::do_back_transformed_diagnostics && do_back_transformed_diagnostics) { - copy_attribs(pti, x, y, z); + copy_attribs(pti, pstruct); } amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { - UpdatePositionPhoton( x[i], y[i], z[i], - ux[i], uy[i], uz[i], dt ); + UpdatePositionPhoton( pstruct[i], ux[i], uy[i], uz[i], dt ); } ); } |