aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers2@gmail.com> 2019-08-26 10:26:06 -0700
committerGravatar Andrew Myers <atmyers2@gmail.com> 2019-08-26 10:26:06 -0700
commit11d362d949107d9c51a6a9771b05d62bc8e1cd8e (patch)
treeb532793f241d88f281446edbb26480018c449ecb /Source/Particles/PhysicalParticleContainer.cpp
parent9eec7ac1a042b28cfad1eebf13c2047674e8505f (diff)
downloadWarpX-11d362d949107d9c51a6a9771b05d62bc8e1cd8e.tar.gz
WarpX-11d362d949107d9c51a6a9771b05d62bc8e1cd8e.tar.zst
WarpX-11d362d949107d9c51a6a9771b05d62bc8e1cd8e.zip
fix race condition
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 79a6f88f1..df8dcf836 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -949,6 +949,19 @@ PhysicalParticleContainer::Evolve (int lev,
bool has_buffer = cEx || cjx;
+ if (WarpX::do_boosted_frame_diagnostic && do_boosted_frame_diags)
+ {
+ for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti)
+ {
+ const auto np = pti.numParticles();
+ const auto lev = pti.GetLevel();
+ const auto index = pti.GetPairIndex();
+ tmp_particle_data.resize(finestLevel()+1);
+ for (int i = 0; i < TmpIdx::nattribs; ++i)
+ tmp_particle_data[lev][index][i].resize(np);
+ }
+ }
+
#ifdef _OPENMP
#pragma omp parallel
#endif
@@ -1680,8 +1693,6 @@ void PhysicalParticleContainer::copy_attribs(WarpXParIter& pti,const Real* xp,
const auto np = pti.numParticles();
const auto lev = pti.GetLevel();
const auto index = pti.GetPairIndex();
- tmp_particle_data.resize(finestLevel()+1);
- for (int i = 0; i < TmpIdx::nattribs; ++i) tmp_particle_data[lev][index][i].resize(np);
Real* AMREX_RESTRICT xpold = tmp_particle_data[lev][index][TmpIdx::xold ].dataPtr();
Real* AMREX_RESTRICT ypold = tmp_particle_data[lev][index][TmpIdx::yold ].dataPtr();
Real* AMREX_RESTRICT zpold = tmp_particle_data[lev][index][TmpIdx::zold ].dataPtr();