Skip to content

Commit

Permalink
Another terrain fix for MPI (AMReX-Codes#3557)
Browse files Browse the repository at this point in the history
The proposed changes:
- [x] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
  • Loading branch information
atmyers authored Sep 19, 2023
1 parent cbf064a commit b2052f2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Src/Particle/AMReX_ParticleContainerI.H
Original file line number Diff line number Diff line change
Expand Up @@ -2043,16 +2043,17 @@ RedistributeMPI (std::map<int, Vector<char> >& not_ours,
{
char* pbuf = ((char*) &recvdata[offset]) + i*superparticle_size;

Particle<0, 0> p;
ParticleReal pos[AMREX_SPACEDIM];
std::memcpy(&pos[0], pbuf, AMREX_SPACEDIM*sizeof(ParticleReal));
AMREX_D_TERM(p.pos(0) = pos[0];,
p.pos(1) = pos[1];,
p.pos(2) = pos[2]);
Particle<NStructReal, NStructInt> p;

if constexpr (!ParticleType::is_soa_particle) {
std::memcpy(&(p.m_idcpu), pbuf + NumRealComps()*sizeof(ParticleReal), sizeof(uint64_t));
std::memcpy(&p, pbuf, sizeof(ParticleType));
} else {
ParticleReal pos[AMREX_SPACEDIM];
std::memcpy(&pos[0], pbuf, AMREX_SPACEDIM*sizeof(ParticleReal));
AMREX_D_TERM(p.pos(0) = pos[0];,
p.pos(1) = pos[1];,
p.pos(2) = pos[2]);

int idcpu[2];
std::memcpy(&idcpu[0], pbuf + NumRealComps()*sizeof(ParticleReal), 2*sizeof(int));

Expand Down

0 comments on commit b2052f2

Please sign in to comment.