diff options
author | 2021-06-11 16:27:24 -0700 | |
---|---|---|
committer | 2021-06-11 16:27:24 -0700 | |
commit | 1f1cd934e82e4cffa9c68ab35c802e6298ac6501 (patch) | |
tree | e9f9ed14176094845e3ecfd50a19ffb041448cf4 /Source/Particles/RigidInjectedParticleContainer.cpp | |
parent | 4974f07209ebc5e0578fc383057b4be383cdf318 (diff) | |
download | WarpX-1f1cd934e82e4cffa9c68ab35c802e6298ac6501.tar.gz WarpX-1f1cd934e82e4cffa9c68ab35c802e6298ac6501.tar.zst WarpX-1f1cd934e82e4cffa9c68ab35c802e6298ac6501.zip |
Fix Offset: PushPX -> evolve_opt (#2011)
* Fix Offset: PushPX -> evolve_opt
Comparing to the `doParticlePush()` above, the `ux`/`uy`/`uz` SoA
attributes seem to lack the particle offset in `PushPX`.
Also simplifies the offset calculation to reside off-kernel, which
saves 8 bytes cmem and some index indirection logic for the compiler.
* RigidInjected Particle: Fix Offset
Looks like this is missing here, too?
Diffstat (limited to '')
-rw-r--r-- | Source/Particles/RigidInjectedParticleContainer.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp index 5cb49f69c..15d11d0e0 100644 --- a/Source/Particles/RigidInjectedParticleContainer.cpp +++ b/Source/Particles/RigidInjectedParticleContainer.cpp @@ -254,9 +254,9 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti, const auto GetPosition = GetParticlePosition(pti); auto SetPosition = SetParticlePosition(pti); - ParticleReal* const AMREX_RESTRICT ux = uxp.dataPtr(); - ParticleReal* const AMREX_RESTRICT uy = uyp.dataPtr(); - ParticleReal* const AMREX_RESTRICT uz = uzp.dataPtr(); + ParticleReal* const AMREX_RESTRICT ux = uxp.dataPtr() + offset; + ParticleReal* const AMREX_RESTRICT uy = uyp.dataPtr() + offset; + ParticleReal* const AMREX_RESTRICT uz = uzp.dataPtr() + offset; if (!done_injecting_lev) { @@ -271,13 +271,13 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti, uyp_save.resize(np); uzp_save.resize(np); - amrex::Real* const AMREX_RESTRICT xp_save_ptr = xp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT yp_save_ptr = yp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT zp_save_ptr = zp_save.dataPtr(); + amrex::Real* const AMREX_RESTRICT xp_save_ptr = xp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT yp_save_ptr = yp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT zp_save_ptr = zp_save.dataPtr() + offset; - amrex::Real* const AMREX_RESTRICT uxp_save_ptr = uxp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT uyp_save_ptr = uyp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT uzp_save_ptr = uzp_save.dataPtr(); + amrex::Real* const AMREX_RESTRICT uxp_save_ptr = uxp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT uyp_save_ptr = uyp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT uzp_save_ptr = uzp_save.dataPtr() + offset; amrex::ParallelFor( np, [=] AMREX_GPU_DEVICE (long i) { @@ -302,12 +302,12 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti, if (!done_injecting_lev) { - ParticleReal* AMREX_RESTRICT x_save = xp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT y_save = yp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT z_save = zp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT ux_save = uxp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT uy_save = uyp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT uz_save = uzp_save.dataPtr(); + ParticleReal* AMREX_RESTRICT x_save = xp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT y_save = yp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT z_save = zp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT ux_save = uxp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT uy_save = uyp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT uz_save = uzp_save.dataPtr() + offset; // Undo the push for particles not injected yet. // The zp are advanced a fixed amount. |