diff --git a/Src/Particle/AMReX_ParticleTransformation.H b/Src/Particle/AMReX_ParticleTransformation.H index 6473082baf7..b55f5211eee 100644 --- a/Src/Particle/AMReX_ParticleTransformation.H +++ b/Src/Particle/AMReX_ParticleTransformation.H @@ -81,10 +81,10 @@ void copyParticle (const ParticleTileData& dst, AMREX_ASSERT(dst.m_num_runtime_real == src.m_num_runtime_real); AMREX_ASSERT(dst.m_num_runtime_int == src.m_num_runtime_int ); - if constexpr(!T_ParticleType::is_soa_particle) { - dst.m_aos[dst_i] = src.m_aos[src_i]; - } else { + if constexpr(T_ParticleType::is_soa_particle) { dst.m_idcpu[dst_i] = src.m_idcpu[src_i]; + } else { + dst.m_aos[dst_i] = src.m_aos[src_i]; } for (int j = 0; j < NAR; ++j) { dst.m_rdata[j][dst_i] = src.m_rdata[j][src_i]; @@ -123,10 +123,10 @@ void swapParticle (const ParticleTileData& dst, AMREX_ASSERT(dst.m_num_runtime_real == src.m_num_runtime_real); AMREX_ASSERT(dst.m_num_runtime_int == src.m_num_runtime_int ); - if constexpr(!T_ParticleType::is_soa_particle) { - amrex::Swap(src.m_aos[src_i], dst.m_aos[dst_i]); - } else { + if constexpr(T_ParticleType::is_soa_particle) { amrex::Swap(src.m_idcpu[src_i], dst.m_idcpu[dst_i]); + } else { + amrex::Swap(src.m_aos[src_i], dst.m_aos[dst_i]); } for (int j = 0; j < NAR; ++j) { amrex::Swap(dst.m_rdata[j][dst_i], src.m_rdata[j][src_i]);