Skip to content

Commit

Permalink
Fix undefined behavior in meanParticleVelocity (ECP-WarpX#4614)
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe authored Jan 16, 2024
1 parent a3e04a7 commit 11e2a17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Particles/WarpXParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ std::array<ParticleReal, 3> WarpXParticleContainer::meanParticleVelocity(bool lo
ParallelDescriptor::ReduceLongSum(np_total);
}

std::array<amrex::ParticleReal, 3> mean_v;
std::array<amrex::ParticleReal, 3> mean_v = {0,0,0};
if (np_total > 0) {
mean_v[0] = vx_total / np_total;
mean_v[1] = vy_total / np_total;
Expand Down

0 comments on commit 11e2a17

Please sign in to comment.