File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -462,6 +462,8 @@ void ParticleBoundaryBuffer::gatherParticlesFromDomainBoundaries (MultiParticleC
462462 auto np_to_add = amrex::get<0 >(reduce_data.value ());
463463 auto new_np = dst_index + np_to_add;
464464 amrex::Long capacity = ptile_buffer.capacity () / species_buffer.superParticleSize ();
465+ // reserve space to avoid many small resize operations for performance reasons
466+ // the resize below will not shrink the capacity
465467 if (new_np > capacity) { ptile_buffer.reserve (2 *new_np); }
466468 ptile_buffer.resize (new_np);
467469 }
@@ -570,6 +572,8 @@ void ParticleBoundaryBuffer::gatherParticlesFromEmbeddedBoundaries (
570572 auto np_to_add = amrex::get<0 >(reduce_data.value ());
571573 auto new_np = dst_index + np_to_add;
572574 amrex::Long capacity = ptile_buffer.capacity () / species_buffer.superParticleSize ();
575+ // reserve space to avoid many small resize operations for performance reasons
576+ // the resize below will not shrink the capacity
573577 if (new_np > capacity) { ptile_buffer.reserve (2 *new_np); }
574578 ptile_buffer.resize (new_np);
575579 }
You can’t perform that action at this time.
0 commit comments