From 7ca419ebb90da60fefc01d8c1816846fff8638a5 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Mon, 20 May 2024 10:49:09 -0700 Subject: [PATCH] Particle InitBinaryFromFile: Use reference instead of copy (#3946) This has better performance and the change is now necessary because of #3943. --- Src/Particle/AMReX_ParticleInit.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Particle/AMReX_ParticleInit.H b/Src/Particle/AMReX_ParticleInit.H index 75316dec746..9fee3729ab6 100644 --- a/Src/Particle/AMReX_ParticleInit.H +++ b/Src/Particle/AMReX_ParticleInit.H @@ -873,7 +873,7 @@ InitFromBinaryFile (const std::string& file, auto& pmap = m_particles[lev]; auto& tmp_pmap = tmp_particles[lev]; - for (auto kv : pmap) { + for (auto& kv : pmap) { auto& aos = kv.second.GetArrayOfStructs()(); auto& tmp_aos = tmp_pmap[kv.first].GetArrayOfStructs()();