Skip to content

Commit b14aae7

Browse files
authored
More readable code in PushPX, PushXPSingleStep (BLAST-WarpX#6113)
1 parent 50c3bc1 commit b14aae7

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

Source/Particles/PhysicalParticleContainer.cpp

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,47 +1382,38 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
13821382

13831383
scaleFields(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp);
13841384

1385-
#ifdef WARPX_QED
1386-
if (!do_sync)
1387-
#endif
1388-
{
1389-
if (do_copy) {
1390-
// Copy the old x and u for the BTD
1391-
copyAttribs(ip);
1392-
}
1385+
if (do_copy) {
1386+
// Copy the old x and u for the BTD
1387+
copyAttribs(ip);
1388+
}
13931389

1390+
#ifdef WARPX_QED
1391+
if (!do_sync) {
13941392
doParticleMomentumPush<0>(ux[ip], uy[ip], uz[ip],
13951393
Exp, Eyp, Ezp, Bxp, Byp, Bzp,
13961394
ion_lev ? ion_lev[ip] : 1,
13971395
m, q, pusher_algo, do_crr,
1398-
#ifdef WARPX_QED
13991396
t_chi_max,
1400-
#endif
14011397
dt);
1402-
1403-
UpdatePosition(xp, yp, zp, ux[ip], uy[ip], uz[ip], dt);
1404-
setPosition(ip, xp, yp, zp);
1405-
}
1406-
#ifdef WARPX_QED
1407-
else {
1398+
} else {
14081399
if constexpr (qed_control == has_qed) {
1409-
if (do_copy) {
1410-
// Copy the old x and u for the BTD
1411-
copyAttribs(ip);
1412-
}
1413-
14141400
doParticleMomentumPush<1>(ux[ip], uy[ip], uz[ip],
14151401
Exp, Eyp, Ezp, Bxp, Byp, Bzp,
14161402
ion_lev ? ion_lev[ip] : 1,
14171403
m, q, pusher_algo, do_crr,
14181404
t_chi_max,
14191405
dt);
1420-
1421-
UpdatePosition(xp, yp, zp, ux[ip], uy[ip], uz[ip], dt);
1422-
setPosition(ip, xp, yp, zp);
14231406
}
14241407
}
1408+
#else
1409+
doParticleMomentumPush<0>(ux[ip], uy[ip], uz[ip],
1410+
Exp, Eyp, Ezp, Bxp, Byp, Bzp,
1411+
ion_lev ? ion_lev[ip] : 1,
1412+
m, q, pusher_algo, do_crr,
1413+
dt);
14251414
#endif
1415+
UpdatePosition(xp, yp, zp, ux[ip], uy[ip], uz[ip], dt);
1416+
setPosition(ip, xp, yp, zp);
14261417

14271418
#ifdef WARPX_QED
14281419
[[maybe_unused]] auto foo_local_has_quantum_sync = local_has_quantum_sync;

Source/Particles/Pusher/ImplicitPushPX.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,14 @@ namespace {
183183
uz[ip] = uzp_n;
184184

185185
#ifdef WARPX_QED
186-
if (!do_sync)
187-
#endif
188-
{
186+
if (!do_sync) {
189187
doParticleMomentumPush<0>(ux[ip], uy[ip], uz[ip],
190188
Exp, Eyp, Ezp, Bxp, Byp, Bzp,
191189
ion_lev ? ion_lev[ip] : 1,
192190
m, q, pusher_algo, do_crr,
193-
#ifdef WARPX_QED
194191
t_chi_max,
195-
#endif
196192
dt);
197-
}
198-
#ifdef WARPX_QED
199-
else {
193+
} else {
200194
if constexpr (qed_control == has_qed) {
201195
doParticleMomentumPush<1>(ux[ip], uy[ip], uz[ip],
202196
Exp, Eyp, Ezp, Bxp, Byp, Bzp,
@@ -206,6 +200,12 @@ namespace {
206200
dt);
207201
}
208202
}
203+
#else
204+
doParticleMomentumPush<0>(ux[ip], uy[ip], uz[ip],
205+
Exp, Eyp, Ezp, Bxp, Byp, Bzp,
206+
ion_lev ? ion_lev[ip] : 1,
207+
m, q, pusher_algo, do_crr,
208+
dt);
209209
#endif
210210

211211
#ifdef WARPX_QED

0 commit comments

Comments
 (0)