From d9d9721d80ff2f6ceda3c1a6e32e9ab31b7f81c6 Mon Sep 17 00:00:00 2001 From: Andrew Myers Date: Mon, 25 May 2020 11:47:03 -0700 Subject: 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 --- Source/Particles/PhotonParticleContainer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') 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 @@ -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 ); -- cgit v1.2.3