aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/WarpXParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2020-03-10 10:35:01 -0700
committerGravatar GitHub <noreply@github.com> 2020-03-10 10:35:01 -0700
commitdc7466911bf6f1f16db2ead6efb94da6f9b49c38 (patch)
treead4fd7d848f28dd7d49da01c7c9d138006fb9e9b /Source/Particles/WarpXParticleContainer.cpp
parent7cf6255e2ad481368dc040d0c4fe08009e1429b9 (diff)
downloadWarpX-dc7466911bf6f1f16db2ead6efb94da6f9b49c38.tar.gz
WarpX-dc7466911bf6f1f16db2ead6efb94da6f9b49c38.tar.zst
WarpX-dc7466911bf6f1f16db2ead6efb94da6f9b49c38.zip
Allowed for more general centering of charge density (#768)
* Allowed for more general centering of charge density * Used rho_nodal_flag in ApplyInverseVolumeScalingToChargeDensity * Simplify declaration of rho_nodal_flag Co-Authored-By: MaxThevenet <mthevenet@lbl.gov> * Fix documentation for doChargeDepositionShapeN Co-Authored-By: MaxThevenet <mthevenet@lbl.gov> Co-authored-by: MaxThevenet <mthevenet@lbl.gov>
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index 5aabb1919..3e1157712 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -423,23 +423,23 @@ WarpXParticleContainer::DepositCharge (WarpXParIter& pti, RealVector& wp,
}
tilebox.grow(ngRho);
+ const Box tb = amrex::convert(tilebox, WarpX::rho_nodal_flag);
const int nc = (rho->nComp() == 1 ? 1 : rho->nComp()/2);
#ifdef AMREX_USE_GPU
- // No tiling on GPU: rho_arr points to the full rho array.
+ // No tiling on GPU: rho_fab points to the full rho array.
MultiFab rhoi(*rho, amrex::make_alias, icomp*nc, nc);
- Array4<Real> const& rho_arr = rhoi.array(pti);
+ auto & rho_fab = rhoi.get(pti);
#else
- // Tiling is on: rho_arr points to local_rho[thread_num]
- const Box tb = amrex::convert(tilebox, IntVect::TheUnitVector());
+ // Tiling is on: rho_fab points to local_rho[thread_num]
local_rho[thread_num].resize(tb, nc);
// local_rho[thread_num] is set to zero
local_rho[thread_num].setVal(0.0);
- Array4<Real> const& rho_arr = local_rho[thread_num].array();
+ auto & rho_fab = local_rho[thread_num];
#endif
// GPU, no tiling: deposit directly in rho
// CPU, tiling: deposit into local_rho
@@ -469,13 +469,13 @@ WarpXParticleContainer::DepositCharge (WarpXParIter& pti, RealVector& wp,
WARPX_PROFILE_VAR_START(blp_ppc_chd);
if (WarpX::nox == 1){
doChargeDepositionShapeN<1>(GetPosition, wp.dataPtr()+offset, ion_lev,
- rho_arr, np_to_depose, dx, xyzmin, lo, q);
+ rho_fab, np_to_depose, dx, xyzmin, lo, q);
} else if (WarpX::nox == 2){
doChargeDepositionShapeN<2>(GetPosition, wp.dataPtr()+offset, ion_lev,
- rho_arr, np_to_depose, dx, xyzmin, lo, q);
+ rho_fab, np_to_depose, dx, xyzmin, lo, q);
} else if (WarpX::nox == 3){
doChargeDepositionShapeN<3>(GetPosition, wp.dataPtr()+offset, ion_lev,
- rho_arr, np_to_depose, dx, xyzmin, lo, q);
+ rho_fab, np_to_depose, dx, xyzmin, lo, q);
}
WARPX_PROFILE_VAR_STOP(blp_ppc_chd);