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.cpp56
1 files changed, 39 insertions, 17 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 43b46ec49..69c27cd21 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -1729,7 +1729,13 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
Real dt)
{
- // This wraps the call to warpx_particle_pusher so that inheritors can modify the call.
+ if (WarpX::do_boosted_frame_diagnostic && do_boosted_frame_diags)
+ {
+ warpx_copy_attribs(pti, xp.dataPtr(), yp.dataPtr(), zp.dataPtr());
+ }
+
+ // The following attributes should be included in CPP version of warpx_particle_pusher
+ // This wraps the call to warpx_particle_pusher so that inheritors can modify the call.
auto& attribs = pti.GetAttribs();
auto& uxp = attribs[PIdx::ux];
auto& uyp = attribs[PIdx::uy];
@@ -1741,22 +1747,7 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
auto& Byp = attribs[PIdx::By];
auto& Bzp = attribs[PIdx::Bz];
const long np = pti.numParticles();
-
- if (WarpX::do_boosted_frame_diagnostic && do_boosted_frame_diags)
- {
- auto& xpold = pti.GetAttribs(particle_comps["xold"]);
- auto& ypold = pti.GetAttribs(particle_comps["yold"]);
- auto& zpold = pti.GetAttribs(particle_comps["zold"]);
- auto& uxpold = pti.GetAttribs(particle_comps["uxold"]);
- auto& uypold = pti.GetAttribs(particle_comps["uyold"]);
- auto& uzpold = pti.GetAttribs(particle_comps["uzold"]);
-
- warpx_copy_attribs(&np, xp.dataPtr(), yp.dataPtr(), zp.dataPtr(),
- uxp.dataPtr(), uyp.dataPtr(), uzp.dataPtr(),
- xpold.dataPtr(), ypold.dataPtr(), zpold.dataPtr(),
- uxpold.dataPtr(), uypold.dataPtr(), uzpold.dataPtr());
- }
-
+
warpx_particle_pusher(&np,
xp.dataPtr(),
yp.dataPtr(),
@@ -1870,6 +1861,37 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
}
}
+void PhysicalParticleContainer::warpx_copy_attribs(WarpXParIter& pti,const amrex::Real* xp,
+ const amrex::Real* yp, const amrex::Real* zp)
+{
+ auto& attribs = pti.GetAttribs();
+
+ Real* AMREX_RESTRICT uxp = attribs[PIdx::ux].dataPtr();
+ Real* AMREX_RESTRICT uyp = attribs[PIdx::uy].dataPtr();
+ Real* AMREX_RESTRICT uzp = attribs[PIdx::uz].dataPtr();
+
+ Real* AMREX_RESTRICT xpold = attribs[PIdx::nattribs].dataPtr();
+ Real* AMREX_RESTRICT ypold = attribs[PIdx::nattribs+1].dataPtr();
+ Real* AMREX_RESTRICT zpold = attribs[PIdx::nattribs+2].dataPtr();
+ Real* AMREX_RESTRICT uxpold = attribs[PIdx::nattribs+3].dataPtr();
+ Real* AMREX_RESTRICT uypold = attribs[PIdx::nattribs+4].dataPtr();
+ Real* AMREX_RESTRICT uzpold = attribs[PIdx::nattribs+5].dataPtr();
+
+ const long np = pti.numParticles();
+
+ ParallelFor( np,
+ [=] AMREX_GPU_DEVICE (long i) {
+ xpold[i]=xp[i];
+ ypold[i]=yp[i];
+ zpold[i]=zp[i];
+
+ uxpold[i]=uxp[i];
+ uypold[i]=uyp[i];
+ uzpold[i]=uzp[i];
+ }
+ );
+}
+
void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real z_old,
const Real z_new, const Real t_boost,
const Real t_lab, const Real dt,