Skip to content

Commit ee51424

Browse files
authored
Remove redundant setVal(0) in ParticleReductionFunctor (#4926)
ParticleReductionFunctor uses the routine ParticleToMesh, which by default will zero out the MultiFab passed in. This PR removes the unneeded explicit calls to setVal(0.).
1 parent 2a3fbda commit ee51424

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

Source/Diagnostics/ComputeDiagFunctors/ParticleReductionFunctor.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ ParticleReductionFunctor::operator() (amrex::MultiFab& mf_dst, const int dcomp,
5252
constexpr int ng = 1;
5353
// Temporary cell-centered, multi-component MultiFab for storing particles per cell.
5454
amrex::MultiFab red_mf(warpx.boxArray(m_lev), warpx.DistributionMap(m_lev), 1, ng);
55-
// Set value to 0, and increment the value in each cell with ppc.
56-
red_mf.setVal(0._rt);
5755
auto& pc = warpx.GetPartContainer().GetParticleContainer(m_ispec);
5856
// Copy over member variables so they can be captured in the lambda
5957
auto map_fn = m_map_fn;
@@ -99,7 +97,6 @@ ParticleReductionFunctor::operator() (amrex::MultiFab& mf_dst, const int dcomp,
9997
});
10098
if (m_do_average) {
10199
amrex::MultiFab ppc_mf(warpx.boxArray(m_lev), warpx.DistributionMap(m_lev), 1, ng);
102-
ppc_mf.setVal(0._rt);
103100
// Add the weight for each particle -- total number of particles of this species
104101
ParticleToMesh(pc, ppc_mf, m_lev,
105102
[=] AMREX_GPU_DEVICE (const WarpXParticleContainer::SuperParticleType& p,

0 commit comments

Comments
 (0)