aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 3559797da..1390fdda6 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -2482,7 +2482,14 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
const auto t_do_not_gather = do_not_gather;
- amrex::ParallelFor( np, [=] AMREX_GPU_DEVICE (long ip)
+ enum exteb_flags : int { no_exteb, has_exteb };
+
+ int exteb_runtime_flag = getExternalEB.isNoOp() ? no_exteb : has_exteb;
+
+ amrex::ParallelFor(TypeList<CompileTimeOptions<no_exteb,has_exteb>>{},
+ {exteb_runtime_flag},
+ np, [=,getExternalEB=getExternalEB]
+ AMREX_GPU_DEVICE (long ip, auto exteb_control)
{
amrex::ParticleReal xp, yp, zp;
getPosition(ip, xp, yp, zp);
@@ -2498,8 +2505,11 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes,
nox, galerkin_interpolation);
}
+
// Externally applied E and B-field in Cartesian co-ordinates
- getExternalEB(ip, Exp, Eyp, Ezp, Bxp, Byp, Bzp);
+ if constexpr (exteb_control == has_exteb) {
+ getExternalEB(ip, Exp, Eyp, Ezp, Bxp, Byp, Bzp);
+ }
if (do_crr) {
amrex::Real qp = q;
@@ -2703,8 +2713,9 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
amrex::ParallelFor(TypeList<CompileTimeOptions<no_exteb,has_exteb>,
CompileTimeOptions<no_qed ,has_qed>>{},
{exteb_runtime_flag, qed_runtime_flag},
- np_to_push, [=] AMREX_GPU_DEVICE (long ip, auto exteb_control,
- [[maybe_unused]] auto qed_control)
+ np_to_push, [=,getExternalEB=getExternalEB]
+ AMREX_GPU_DEVICE (long ip, auto exteb_control,
+ [[maybe_unused]] auto qed_control)
{
amrex::ParticleReal xp, yp, zp;
getPosition(ip, xp, yp, zp);
@@ -2731,9 +2742,8 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
nox, galerkin_interpolation);
}
- auto const& externeb_fn = getExternalEB; // Have to do this for nvcc
if constexpr (exteb_control == has_exteb) {
- externeb_fn(ip, Exp, Eyp, Ezp, Bxp, Byp, Bzp);
+ getExternalEB(ip, Exp, Eyp, Ezp, Bxp, Byp, Bzp);
}
scaleFields(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp);