aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/.DS_Storebin0 -> 6148 bytes
-rw-r--r--Source/FortranInterface/WarpX_f.F9033
-rw-r--r--Source/FortranInterface/WarpX_f.H6
-rw-r--r--Source/Particles/PhysicalParticleContainer.H3
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp56
-rw-r--r--Source/Particles/RigidInjectedParticleContainer.cpp20
6 files changed, 47 insertions, 71 deletions
diff --git a/Source/.DS_Store b/Source/.DS_Store
new file mode 100644
index 000000000..01640e062
--- /dev/null
+++ b/Source/.DS_Store
Binary files differ
diff --git a/Source/FortranInterface/WarpX_f.F90 b/Source/FortranInterface/WarpX_f.F90
index 0560a9981..542cc95a1 100644
--- a/Source/FortranInterface/WarpX_f.F90
+++ b/Source/FortranInterface/WarpX_f.F90
@@ -8,39 +8,6 @@ module warpx_module
contains
- subroutine warpx_copy_attribs(np, xp, yp, zp, uxp, uyp, uzp, &
- xpold, ypold, zpold, uxpold, uypold, uzpold) &
- bind(c,name='warpx_copy_attribs')
- integer(c_long), intent(in) :: np
- real(amrex_real), intent(in) :: xp(np)
- real(amrex_real), intent(in) :: yp(np)
- real(amrex_real), intent(in) :: zp(np)
- real(amrex_real), intent(in) :: uxp(np)
- real(amrex_real), intent(in) :: uyp(np)
- real(amrex_real), intent(in) :: uzp(np)
- real(amrex_real), intent(inout) :: xpold(np)
- real(amrex_real), intent(inout) :: ypold(np)
- real(amrex_real), intent(inout) :: zpold(np)
- real(amrex_real), intent(inout) :: uxpold(np)
- real(amrex_real), intent(inout) :: uypold(np)
- real(amrex_real), intent(inout) :: uzpold(np)
-
- integer n
-
- do n = 1, np
-
- xpold(n) = xp(n)
- ypold(n) = yp(n)
- zpold(n) = zp(n)
-
- uxpold(n) = uxp(n)
- uypold(n) = uyp(n)
- uzpold(n) = uzp(n)
-
- end do
-
- end subroutine warpx_copy_attribs
-
subroutine warpx_compute_E (lo, hi, &
phi, phlo, phhi, &
Ex, Exlo, Exhi, &
diff --git a/Source/FortranInterface/WarpX_f.H b/Source/FortranInterface/WarpX_f.H
index 98dd8685d..0440148eb 100644
--- a/Source/FortranInterface/WarpX_f.H
+++ b/Source/FortranInterface/WarpX_f.H
@@ -75,12 +75,6 @@ extern "C"
{
#endif
- void warpx_copy_attribs(const long* np,
- const amrex_real* xp, const amrex_real* yp, const amrex_real* zp,
- const amrex_real* uxp, const amrex_real* uyp, const amrex_real* uzp,
- amrex_real* xpold, amrex_real* ypold, amrex_real* zpold,
- amrex_real* uxpold, amrex_real* uypold, amrex_real* uzpold);
-
// Charge deposition
void warpx_charge_deposition(amrex::Real* rho,
const long* np, const amrex::Real* xp, const amrex::Real* yp, const amrex::Real* zp, const amrex::Real* w,
diff --git a/Source/Particles/PhysicalParticleContainer.H b/Source/Particles/PhysicalParticleContainer.H
index bd8cfb47e..99fc0f8da 100644
--- a/Source/Particles/PhysicalParticleContainer.H
+++ b/Source/Particles/PhysicalParticleContainer.H
@@ -77,6 +77,9 @@ public:
const amrex::MultiFab& Bx,
const amrex::MultiFab& By,
const amrex::MultiFab& Bz) override;
+
+ void warpx_copy_attribs(WarpXParIter& pti,const amrex::Real* xp,
+ const amrex::Real* yp, const amrex::Real* zp);
virtual void PostRestart () final {}
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,
diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp
index 2a3e8dd0d..ca02d1458 100644
--- a/Source/Particles/RigidInjectedParticleContainer.cpp
+++ b/Source/Particles/RigidInjectedParticleContainer.cpp
@@ -211,6 +211,11 @@ RigidInjectedParticleContainer::PushPX(WarpXParIter& pti,
Real dt)
{
+ if (WarpX::do_boosted_frame_diagnostic && do_boosted_frame_diags)
+ {
+ warpx_copy_attribs(pti, xp.dataPtr(), yp.dataPtr(), zp.dataPtr());
+ }
+
// This wraps the call to warpx_particle_pusher so that inheritors can modify the call.
auto& attribs = pti.GetAttribs();
auto& uxp = attribs[PIdx::ux];
@@ -224,21 +229,6 @@ RigidInjectedParticleContainer::PushPX(WarpXParIter& pti,
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());
- }
-
// Save the position and momenta, making copies
Cuda::ManagedDeviceVector<Real> xp_save, yp_save, zp_save;
RealVector uxp_save, uyp_save, uzp_save;