From 8400b4a1316bad415fb63aac2c2f29af8f467d4c Mon Sep 17 00:00:00 2001 From: Andrew Myers Date: Tue, 4 Jun 2019 12:56:12 -0700 Subject: when we add a particle, if any additional runtime components have been requested, fill them with 0 by default. --- Source/Particles/WarpXParticleContainer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Source/Particles/WarpXParticleContainer.cpp') diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 9791eee80..70291f48b 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -144,7 +144,7 @@ WarpXParticleContainer::AddOneParticle (int lev, int grid, int tile, Real x, Real y, Real z, std::array& attribs) { - auto& particle_tile = GetParticles(lev)[std::make_pair(grid,tile)]; + auto& particle_tile = DefineAndReturnParticleTile(lev, grid, tile); AddOneParticle(particle_tile, x, y, z, attribs); } @@ -171,6 +171,11 @@ WarpXParticleContainer::AddOneParticle (ParticleTileType& particle_tile, particle_tile.push_back(p); particle_tile.push_back_real(attribs); + + for (int i = PIdx::nattribs; i < NumRealComps(); ++i) + { + particle_tile.push_back_real(i, 0.0); + } } void -- cgit v1.2.3