From be7ccae324cb3c6dbfa266fad975b4077f563c3e Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Wed, 29 Jul 2020 06:23:57 +0200 Subject: [tiny] Avoid particles with do_not_gather=1 be pushed in the last half step (#1210) * species with do_not_gather=1 are not anymore pushed in the last halft step * now do_not_gather is used just to avoid doing doGatherShapeN * Minor fix * fix involuntary capture of *this in lambda --- Source/Particles/PhotonParticleContainer.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index ff1107eea..dd1120118 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -155,6 +155,8 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti, amrex::IndexType const by_type = byfab->box().ixType(); amrex::IndexType const bz_type = bzfab->box().ixType(); + const auto t_do_not_gather = do_not_gather; + amrex::ParallelFor( np_to_push, [=] AMREX_GPU_DEVICE (long i) { @@ -168,12 +170,14 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti, amrex::ParticleReal Bxp, Byp, Bzp; getExternalB(i, Bxp, Byp, Bzp); - // first gather E and B to the particle positions - doGatherShapeN(x, y, z, Exp, Eyp, Ezp, Bxp, Byp, Bzp, - ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr, - ex_type, ey_type, ez_type, bx_type, by_type, bz_type, - dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes, - nox, l_lower_order_in_v); + if(!t_do_not_gather){ + // first gather E and B to the particle positions + doGatherShapeN(x, y, z, Exp, Eyp, Ezp, Bxp, Byp, Bzp, + ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr, + ex_type, ey_type, ez_type, bx_type, by_type, bz_type, + dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes, + nox, l_lower_order_in_v); + } #ifdef WARPX_QED if (local_has_breit_wheeler) { -- cgit v1.2.3