Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use amrex::getParticleCell More #5557

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ ParticleReductionFunctor::operator() (amrex::MultiFab& mf_dst, const int dcomp,
get_particle_position(p, xw, yw, zw);

// Get position in AMReX convention to calculate corresponding index.
// Ideally this will be replaced with the AMReX NGP interpolator
// Always do x direction. No RZ case because it's not implemented, and code
// will have aborted
const auto [ii, jj, kk] = amrex::getParticleCell(p, plo, dxi).dim3();

// Fix dimensions since parser assumes u = gamma * v / c
Expand Down Expand Up @@ -97,20 +100,8 @@ ParticleReductionFunctor::operator() (amrex::MultiFab& mf_dst, const int dcomp,
// Ideally this will be replaced with the AMReX NGP interpolator
// Always do x direction. No RZ case because it's not implemented, and code
// will have aborted
int ii = 0, jj = 0, kk = 0;
const amrex::ParticleReal x = p.pos(0);
const amrex::Real lx = (x - plo[0]) * dxi[0];
ii = static_cast<int>(amrex::Math::floor(lx));
#if defined(WARPX_DIM_XZ) || defined(WARPX_DIM_3D)
const amrex::ParticleReal y = p.pos(1);
const amrex::Real ly = (y - plo[1]) * dxi[1];
jj = static_cast<int>(amrex::Math::floor(ly));
#endif
#if defined(WARPX_DIM_3D)
const amrex::ParticleReal z = p.pos(2);
const amrex::Real lz = (z - plo[2]) * dxi[2];
kk = static_cast<int>(amrex::Math::floor(lz));
#endif
const auto [ii, jj, kk] = amrex::getParticleCell(p, plo, dxi).dim3();

// Fix dimensions since parser assumes u = gamma * v / c
const amrex::ParticleReal ux = p.rdata(PIdx::ux) / PhysConst::c;
const amrex::ParticleReal uy = p.rdata(PIdx::uy) / PhysConst::c;
Expand Down
Loading