diff --git a/Src/Particle/AMReX_ParticleContainer.H b/Src/Particle/AMReX_ParticleContainer.H index 2543f0d381..ab1157c286 100644 --- a/Src/Particle/AMReX_ParticleContainer.H +++ b/Src/Particle/AMReX_ParticleContainer.H @@ -1374,11 +1374,25 @@ public: { ContainerLike tmp(m_gdb); + std::vector const real_names = this->GetRealSoANames(); + std::vector real_ct_names(NArrayReal); + for (int ic = 0; ic < NArrayReal; ++ic) { real_ct_names.at(ic) = real_names[ic]; } + + std::vector const int_names = this->GetIntSoANames(); + std::vector int_ct_names(NArrayInt); + for (int ic = 0; ic < NArrayInt; ++ic) { int_ct_names.at(ic) = int_names[ic]; } + + tmp.SetSoACompileTimeNames(real_ct_names, int_ct_names); + // add runtime real comps to tmp - for (int ic = 0; ic < this->NumRuntimeRealComps(); ++ic) { tmp.AddRealComp(false); } + 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); } + for (int ic = 0; ic < this->NumRuntimeIntComps(); ++ic) { + tmp.AddIntComp(int_names.at(ic + NArrayInt), false); + } return tmp; }