From 0191b5e8328cf2f9d4d74c03c333e9c963494e38 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 2 May 2023 14:15:04 -0700 Subject: [PATCH] Fix: RedistributeCPU for SoA This is a first draft and needs to be generalized. --- Src/Particle/AMReX_ParticleContainerI.H | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Src/Particle/AMReX_ParticleContainerI.H b/Src/Particle/AMReX_ParticleContainerI.H index 698cb10aeaa..8099cb25af5 100644 --- a/Src/Particle/AMReX_ParticleContainerI.H +++ b/Src/Particle/AMReX_ParticleContainerI.H @@ -7,13 +7,13 @@ void ParticleContainer_impl::SetParticleSize () { num_real_comm_comps = 0; - int comm_comps_start = AMREX_SPACEDIM + NStructReal; + int comm_comps_start = 0; //AMREX_SPACEDIM + NStructReal; for (int i = comm_comps_start; i < comm_comps_start + NumRealComps(); ++i) { if (h_redistribute_real_comp[i]) {++num_real_comm_comps;} } num_int_comm_comps = 0; - comm_comps_start = 2 + NStructInt; + comm_comps_start = 0; //2 + NStructInt; for (int i = comm_comps_start; i < comm_comps_start + NumIntComps(); ++i) { if (h_redistribute_int_comp[i]) {++num_int_comm_comps;} } @@ -1676,7 +1676,7 @@ ParticleContainer_impl // We own it but must shift it to another place. auto index = std::make_pair(pld.m_grid, pld.m_tile); AMREX_ASSERT(tmp_local[pld.m_lev][index].size() == num_threads); - tmp_local[pld.m_lev][index][thread_num].push_back(p); + //tmp_local[pld.m_lev][index][thread_num].push_back(p); for (int comp = 0; comp < NumRealComps(); ++comp) { RealVector& arr = soa_local[pld.m_lev][index][thread_num].GetRealData(comp); arr.push_back(soa.GetRealData(comp)[pindex]); @@ -1696,14 +1696,14 @@ ParticleContainer_impl particles_to_send.resize(new_size); char* dst = &particles_to_send[old_size]; - int array_comp_start = AMREX_SPACEDIM + NStructReal; + int array_comp_start = 0; //AMREX_SPACEDIM + NStructReal; for (int comp = 0; comp < NumRealComps(); comp++) { if (h_redistribute_real_comp[array_comp_start + comp]) { std::memcpy(dst, &soa.GetRealData(comp)[pindex], sizeof(ParticleReal)); dst += sizeof(ParticleReal); } } - array_comp_start = 2 + NStructInt; + array_comp_start = 0; //2 + NStructInt; for (int comp = 0; comp < NumIntComps(); comp++) { if (h_redistribute_int_comp[array_comp_start + comp]) { std::memcpy(dst, &soa.GetIntData(comp)[pindex], sizeof(int));