Skip to content

Commit

Permalink
Fix: RedistributeCPU for SoA
Browse files Browse the repository at this point in the history
This is a first draft and needs to be generalized.
  • Loading branch information
ax3l committed May 2, 2023
1 parent 85a247b commit 0191b5e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Src/Particle/AMReX_ParticleContainerI.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ void
ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator>::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;}
}
Expand Down Expand Up @@ -1676,7 +1676,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator>
// 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]);
Expand All @@ -1696,14 +1696,14 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator>
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));
Expand Down

0 comments on commit 0191b5e

Please sign in to comment.