Skip to content

Commit

Permalink
Revert to MFiter loop
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgrote committed Dec 22, 2023
1 parent 23bee8a commit b41f519
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,15 +1613,15 @@ PhysicalParticleContainer::AddPlasmaFlux (PlasmaInjector const& plasma_injector,
info.SetDynamic(true);
#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
#endif
for (WarpXParIter pti(*this, level_zero); pti.isValid(); ++pti)
for (MFIter mfi = MakeMFIter(0, info); mfi.isValid(); ++mfi)
{
if (cost && WarpX::load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Timers)
{
amrex::Gpu::synchronize();
}
auto wt = static_cast<amrex::Real>(amrex::second());

const Box& tile_box = pti.tilebox();
const Box& tile_box = mfi.tilebox();
const RealBox tile_realbox = WarpX::getRealBox(tile_box, 0);

// Find the cells of part_realbox that overlap with tile_realbox
Expand Down Expand Up @@ -1694,8 +1694,8 @@ PhysicalParticleContainer::AddPlasmaFlux (PlasmaInjector const& plasma_injector,
continue; // Go to the next tile
}

const int grid_id = pti.index();
const int tile_id = pti.LocalTileIndex();
const int grid_id = mfi.index();
const int tile_id = mfi.LocalTileIndex();

const GpuArray<Real,AMREX_SPACEDIM> overlap_corner
{AMREX_D_DECL(overlap_realbox.lo(0),
Expand All @@ -1714,6 +1714,7 @@ PhysicalParticleContainer::AddPlasmaFlux (PlasmaInjector const& plasma_injector,

if (fixed_ppc_is_specified) {
// count the current number of particles in the cells
auto& pti = ParticlesAt(0, mfi);
const auto np = pti.numParticles();
const auto GetPosition = GetParticlePosition(pti);
#if defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ) || defined(WARPX_DIM_3D)
Expand Down Expand Up @@ -2079,7 +2080,7 @@ PhysicalParticleContainer::AddPlasmaFlux (PlasmaInjector const& plasma_injector,
if (cost && WarpX::load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Timers)
{
wt = static_cast<amrex::Real>(amrex::second()) - wt;
amrex::HostDevice::Atomic::Add( &(*cost)[pti.index()], wt);
amrex::HostDevice::Atomic::Add( &(*cost)[mfi.index()], wt);
}
}

Expand Down

0 comments on commit b41f519

Please sign in to comment.