From dc68e022f7615db2b6de24483849b8ac0cf5297b Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 3 Feb 2025 17:28:25 -0800 Subject: [PATCH] Fix: Names in `PC::make_alike` The ParticleContainer's `make_alike` function forgot the names of the SoA components. --- Src/Particle/AMReX_ParticleContainer.H | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Src/Particle/AMReX_ParticleContainer.H b/Src/Particle/AMReX_ParticleContainer.H index 2543f0d381..6d299de8ec 100644 --- a/Src/Particle/AMReX_ParticleContainer.H +++ b/Src/Particle/AMReX_ParticleContainer.H @@ -1375,10 +1375,16 @@ public: ContainerLike tmp(m_gdb); // add runtime real comps to tmp - for (int ic = 0; ic < this->NumRuntimeRealComps(); ++ic) { tmp.AddRealComp(false); } + auto const real_names = this->GetRealSoANames(); + for (int ic = 0; ic < this->NumRuntimeRealComps(); ++ic) { + tmp.AddRealComp(real_names.at(ic + NArrayReal), false); + } // add runtime int comps to tmp - for (int ic = 0; ic < this->NumRuntimeIntComps(); ++ic) { tmp.AddIntComp(false); } + auto const int_names = this->GetIntSoANames(); + for (int ic = 0; ic < this->NumRuntimeIntComps(); ++ic) { + tmp.AddIntComp(int_names.at(ic + NArrayInt), false); + } return tmp; }