File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -459,6 +459,11 @@ void ParticleBoundaryBuffer::gatherParticlesFromDomainBoundaries (MultiParticleC
459459 auto dst_index = ptile_buffer.numParticles ();
460460 {
461461 WARPX_PROFILE (" ParticleBoundaryBuffer::gatherParticles::resize" );
462+ auto np_to_add = amrex::get<0 >(reduce_data.value ());
463+ amrex::Long np_cap = ptile_buffer.capacity () / species_buffer.superParticleSize ();
464+ if (dst_index + np_to_add > np_cap) {
465+ ptile_buffer.resize (2 *(dst_index + np_to_add));
466+ }
462467 ptile_buffer.resize (dst_index + amrex::get<0 >(reduce_data.value ()));
463468 }
464469 {
@@ -563,6 +568,11 @@ void ParticleBoundaryBuffer::gatherParticlesFromEmbeddedBoundaries (
563568 auto dst_index = ptile_buffer.numParticles ();
564569 {
565570 WARPX_PROFILE (" ParticleBoundaryBuffer::gatherParticles::resize_eb" );
571+ auto np_to_add = amrex::get<0 >(reduce_data.value ());
572+ amrex::Long np_cap = ptile_buffer.capacity () / species_buffer.superParticleSize ();
573+ if (dst_index + np_to_add > np_cap) {
574+ ptile_buffer.resize (2 *(dst_index + np_to_add));
575+ }
566576 ptile_buffer.resize (dst_index + amrex::get<0 >(reduce_data.value ()));
567577 }
568578 auto &warpx = WarpX::GetInstance ();
You can’t perform that action at this time.
0 commit comments