aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers@lbl.gov> 2020-07-03 17:43:23 -0700
committerGravatar GitHub <noreply@github.com> 2020-07-03 17:43:23 -0700
commit4eb57f539416e8e64d046e0040cda015a23938c0 (patch)
treecde2f6d7c976a49b6e6d1dfa0502d169bf93128c /Source
parentbb11eba7a307ef82045500728754a9147fdfb35a (diff)
downloadWarpX-4eb57f539416e8e64d046e0040cda015a23938c0.tar.gz
WarpX-4eb57f539416e8e64d046e0040cda015a23938c0.tar.zst
WarpX-4eb57f539416e8e64d046e0040cda015a23938c0.zip
assert the particles are positive to check for overflow (#1142)
Diffstat (limited to 'Source')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 112180a2b..94766d48a 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -685,6 +685,9 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox)
pid = ParticleType::NextID();
ParticleType::NextID(pid+max_new_particles);
}
+ WarpXUtilMsg::AlwaysAssert(static_cast<int>(pid + max_new_particles) > 0,
+ "ERROR: overflow on particle id numbers");
+
const int cpuid = ParallelDescriptor::MyProc();
auto& particle_tile = GetParticles(lev)[std::make_pair(grid_id,tile_id)];