diff options
author | 2020-05-25 11:47:03 -0700 | |
---|---|---|
committer | 2020-05-25 11:47:03 -0700 | |
commit | d9d9721d80ff2f6ceda3c1a6e32e9ab31b7f81c6 (patch) | |
tree | e9ad07be8e464344930ab0bdef5e8cb45c89ea4e /Source/Particles/PhotonParticleContainer.cpp | |
parent | 0b411e8768bd7704d1d22bccf24a853e1918b581 (diff) | |
download | WarpX-d9d9721d80ff2f6ceda3c1a6e32e9ab31b7f81c6.tar.gz WarpX-d9d9721d80ff2f6ceda3c1a6e32e9ab31b7f81c6.tar.zst WarpX-d9d9721d80ff2f6ceda3c1a6e32e9ab31b7f81c6.zip |
Merge particle push (#1036)
* add functor for doing the tmp particles copy for the back-transformed diagnosti
* merge the particle push options into one kernel
* EOL
* fix assertion
* allow this functor to be constructed even it we aren't doing the back transformed diagnostics
* EOL
* init this val to 0.0
* put the push type selection in a device function so it can be reused
* EOL
* add docstring for the pusher selector function
* EOL
Diffstat (limited to 'Source/Particles/PhotonParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhotonParticleContainer.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 90c8a5259..bd80b8e43 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -12,6 +12,7 @@ // Import low-level single-particle kernels #include "Particles/Pusher/UpdatePositionPhoton.H" #include "Particles/Pusher/GetAndSetPosition.H" +#include "Particles/Pusher/CopyParticleAttribs.H" #ifdef _OPENMP # include <omp.h> @@ -73,10 +74,9 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, Real dt, DtType a_dt_type) ParticleReal* const AMREX_RESTRICT uy = attribs[PIdx::uy].dataPtr(); ParticleReal* const AMREX_RESTRICT uz = attribs[PIdx::uz].dataPtr(); - if (WarpX::do_back_transformed_diagnostics && do_back_transformed_diagnostics && (a_dt_type!=DtType::SecondHalf)) - { - copy_attribs(pti); - } + auto copyAttribs = CopyParticleAttribs(pti, tmp_particle_data); + int do_copy = (WarpX::do_back_transformed_diagnostics && + do_back_transformed_diagnostics && a_dt_type!=DtType::SecondHalf); const auto GetPosition = GetParticlePosition(pti); auto SetPosition = SetParticlePosition(pti); @@ -84,6 +84,7 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, Real dt, DtType a_dt_type) amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { + if (do_copy) copyAttribs(i); ParticleReal x, y, z; GetPosition(i, x, y, z); UpdatePositionPhoton( x, y, z, ux[i], uy[i], uz[i], dt ); |