diff options
author | 2019-07-22 16:08:51 -0700 | |
---|---|---|
committer | 2019-07-22 16:08:51 -0700 | |
commit | 2b2d1c40ac995951661acfe03c8f13993ece741e (patch) | |
tree | 84cd29e39afa1aaef4c83fec2bff88d7cae663d1 /Source/Particles/PhysicalParticleContainer.cpp | |
parent | 712c170a7a5e285d02ca323217bc39571dde9f34 (diff) | |
download | WarpX-2b2d1c40ac995951661acfe03c8f13993ece741e.tar.gz WarpX-2b2d1c40ac995951661acfe03c8f13993ece741e.tar.zst WarpX-2b2d1c40ac995951661acfe03c8f13993ece741e.zip |
Momentum push conversion clean up for clarity and optimization
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 132224db2..5ee2ef5b6 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1751,19 +1751,19 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti, // This wraps the momentum and position advance so that inheritors can modify the call. auto& attribs = pti.GetAttribs(); // Extract pointers to the different particle quantities - Real* AMREX_RESTRICT x = xp.dataPtr(); - Real* AMREX_RESTRICT y = yp.dataPtr(); - Real* AMREX_RESTRICT z = zp.dataPtr(); - Real* AMREX_RESTRICT gi = giv.dataPtr(); - Real* AMREX_RESTRICT ux = attribs[PIdx::ux].dataPtr(); - Real* AMREX_RESTRICT uy = attribs[PIdx::uy].dataPtr(); - Real* AMREX_RESTRICT uz = attribs[PIdx::uz].dataPtr(); - Real* AMREX_RESTRICT Ex = attribs[PIdx::Ex].dataPtr(); - Real* AMREX_RESTRICT Ey = attribs[PIdx::Ey].dataPtr(); - Real* AMREX_RESTRICT Ez = attribs[PIdx::Ez].dataPtr(); - Real* AMREX_RESTRICT Bx = attribs[PIdx::Bx].dataPtr(); - Real* AMREX_RESTRICT By = attribs[PIdx::By].dataPtr(); - Real* AMREX_RESTRICT Bz = attribs[PIdx::Bz].dataPtr(); + Real* const AMREX_RESTRICT x = xp.dataPtr(); + Real* const AMREX_RESTRICT y = yp.dataPtr(); + Real* const AMREX_RESTRICT z = zp.dataPtr(); + Real* const AMREX_RESTRICT gi = giv.dataPtr(); + Real* const AMREX_RESTRICT ux = attribs[PIdx::ux].dataPtr(); + Real* const AMREX_RESTRICT uy = attribs[PIdx::uy].dataPtr(); + Real* const AMREX_RESTRICT uz = attribs[PIdx::uz].dataPtr(); + const Real* AMREX_RESTRICT Ex = attribs[PIdx::Ex].dataPtr(); + const Real* AMREX_RESTRICT Ey = attribs[PIdx::Ey].dataPtr(); + const Real* AMREX_RESTRICT Ez = attribs[PIdx::Ez].dataPtr(); + const Real* AMREX_RESTRICT Bx = attribs[PIdx::Bx].dataPtr(); + const Real* AMREX_RESTRICT By = attribs[PIdx::By].dataPtr(); + const Real* AMREX_RESTRICT Bz = attribs[PIdx::Bz].dataPtr(); if (WarpX::do_boosted_frame_diagnostic && do_boosted_frame_diags) { @@ -1794,7 +1794,6 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti, } else { amrex::Abort("Unknown particle pusher"); }; - } void @@ -1823,9 +1822,6 @@ PhysicalParticleContainer::PushP (int lev, Real dt, auto& attribs = pti.GetAttribs(); - auto& uxp = attribs[PIdx::ux]; - auto& uyp = attribs[PIdx::uy]; - auto& uzp = attribs[PIdx::uz]; auto& Exp = attribs[PIdx::Ex]; auto& Eyp = attribs[PIdx::Ey]; auto& Ezp = attribs[PIdx::Ez]; @@ -1885,16 +1881,16 @@ PhysicalParticleContainer::PushP (int lev, Real dt, // This wraps the momentum advance so that inheritors can modify the call. // Extract pointers to the different particle quantities - Real* AMREX_RESTRICT gi = m_giv[thread_num].dataPtr(); - Real* AMREX_RESTRICT uxpp = uxp.dataPtr(); - Real* AMREX_RESTRICT uypp = uyp.dataPtr(); - Real* AMREX_RESTRICT uzpp = uzp.dataPtr(); - Real* AMREX_RESTRICT Expp = Exp.dataPtr(); - Real* AMREX_RESTRICT Eypp = Eyp.dataPtr(); - Real* AMREX_RESTRICT Ezpp = Ezp.dataPtr(); - Real* AMREX_RESTRICT Bxpp = Bxp.dataPtr(); - Real* AMREX_RESTRICT Bypp = Byp.dataPtr(); - Real* AMREX_RESTRICT Bzpp = Bzp.dataPtr(); + Real* const AMREX_RESTRICT gi = m_giv[thread_num].dataPtr(); + Real* const AMREX_RESTRICT ux = attribs[PIdx::ux].dataPtr(); + Real* const AMREX_RESTRICT uy = attribs[PIdx::uy].dataPtr(); + Real* const AMREX_RESTRICT uz = attribs[PIdx::uz].dataPtr(); + const Real* AMREX_RESTRICT Expp = Exp.dataPtr(); + const Real* AMREX_RESTRICT Eypp = Eyp.dataPtr(); + const Real* AMREX_RESTRICT Ezpp = Ezp.dataPtr(); + const Real* AMREX_RESTRICT Bxpp = Bxp.dataPtr(); + const Real* AMREX_RESTRICT Bypp = Byp.dataPtr(); + const Real* AMREX_RESTRICT Bzpp = Bzp.dataPtr(); // Loop over the particles and update their momentum const Real q = this->charge; @@ -1902,14 +1898,14 @@ PhysicalParticleContainer::PushP (int lev, Real dt, if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Boris){ amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { - UpdateMomentumBoris( uxpp[i], uypp[i], uzpp[i], gi[i], + UpdateMomentumBoris( ux[i], uy[i], uz[i], gi[i], Expp[i], Eypp[i], Ezpp[i], Bxpp[i], Bypp[i], Bzpp[i], q, m, dt); } ); } else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Vay) { amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { - UpdateMomentumVay( uxpp[i], uypp[i], uzpp[i], gi[i], + UpdateMomentumVay( ux[i], uy[i], uz[i], gi[i], Expp[i], Eypp[i], Ezpp[i], Bxpp[i], Bypp[i], Bzpp[i], q, m, dt); } ); |