From 50e5b42fd7046c28b4a8603d7dbee944bc68d4e3 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 17 Jan 2025 17:29:41 -0800 Subject: [PATCH] PC Names: Same Type, Multiple Vars/Instances If the same particle container type is used to create multiple particle species, then the compile-time defined names were only added for the first particle species (instance) of the type and then skipped for any later species (another instance of the same type). This is due to the global variable (so many globals...) used in the type init. This fixes the problem by moving the instance related name logic out of the once-per-type logic `if` branch. --- Src/Particle/AMReX_ParticleContainerI.H | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Src/Particle/AMReX_ParticleContainerI.H b/Src/Particle/AMReX_ParticleContainerI.H index 9d749bb3b8f..adcf68427de 100644 --- a/Src/Particle/AMReX_ParticleContainerI.H +++ b/Src/Particle/AMReX_ParticleContainerI.H @@ -42,6 +42,18 @@ ParticleContainer_impl(i)); + } + m_soa_idata_names.clear(); + for (int i=0; i(i)); + } + static bool initialized = false; if ( ! initialized) { @@ -65,16 +77,6 @@ ParticleContainer_impl(i)); - } - for (int i=0; i(i)); - } - initialized = true; } }