aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/WarpXParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-09-12 15:05:19 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-09-12 15:05:19 -0700
commite11be485cd66e20db2935611ba476d3fcbd4f3f3 (patch)
tree98ec7b38e243c198433dba42d364e7fb2f8a052c /Source/Particles/WarpXParticleContainer.cpp
parent7f5d4fe11e649167eaeda26bd7bc8289af500895 (diff)
parent8dc592025c1ced978887d6b84c4bdffb8606502b (diff)
downloadWarpX-e11be485cd66e20db2935611ba476d3fcbd4f3f3.tar.gz
WarpX-e11be485cd66e20db2935611ba476d3fcbd4f3f3.tar.zst
WarpX-e11be485cd66e20db2935611ba476d3fcbd4f3f3.zip
Merge branch 'dev' into PortingFortranPML_To_CPP_CUDA
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index 6de7a6011..ee606aadb 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -136,7 +136,7 @@ WarpXParticleContainer::AddOneParticle (int lev, int grid, int tile,
Real x, Real y, Real z,
std::array<Real,PIdx::nattribs>& 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);
}
@@ -163,6 +163,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
@@ -195,7 +200,7 @@ WarpXParticleContainer::AddNParticles (int lev,
// Add to grid 0 and tile 0
// Redistribute() will move them to proper places.
std::pair<int,int> key {0,0};
- auto& particle_tile = GetParticles(lev)[key];
+ auto& particle_tile = DefineAndReturnParticleTile(0, 0, 0);
std::size_t np = iend-ibegin;
@@ -258,6 +263,11 @@ WarpXParticleContainer::AddNParticles (int lev,
particle_tile.push_back_real(comp, np, 0.0);
#endif
}
+
+ for (int i = PIdx::nattribs; i < NumRealComps(); ++i)
+ {
+ particle_tile.push_back_real(i, 0.0);
+ }
}
Redistribute();