Skip to content

Commit

Permalink
Need another overload of the operator= for ParticleIDWrapper and Part…
Browse files Browse the repository at this point in the history
…icleCPUWrapper. (AMReX-Codes#1317)

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
- [ ] are described in the proposed changes to the AMReX documentation, if appropriate
  • Loading branch information
atmyers authored and dwillcox committed Oct 3, 2020
1 parent baa4aab commit 0ca8506
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Src/Particle/AMReX_Particle.H
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ struct ParticleIDWrapper
: m_idata(idata)
{}

AMREX_GPU_HOST_DEVICE
ParticleIDWrapper& operator= (const ParticleIDWrapper& pidw) noexcept
{
return this->operator=(Long(pidw));
}

AMREX_GPU_HOST_DEVICE
ParticleIDWrapper& operator= (const Long id) noexcept
{
Expand Down Expand Up @@ -80,6 +86,12 @@ struct ParticleCPUWrapper
: m_idata(idata)
{}

AMREX_GPU_HOST_DEVICE
ParticleCPUWrapper& operator= (const ParticleCPUWrapper& pcpuw) noexcept
{
return this->operator=(int(pcpuw));
}

AMREX_GPU_HOST_DEVICE
ParticleCPUWrapper& operator= (const int cpu) noexcept
{
Expand All @@ -94,7 +106,7 @@ struct ParticleCPUWrapper
}

AMREX_GPU_HOST_DEVICE
operator int () noexcept
operator int () const noexcept
{
return (m_idata & 0x00FFFFFF);
}
Expand Down Expand Up @@ -133,7 +145,7 @@ struct ConstParticleCPUWrapper
{}

AMREX_GPU_HOST_DEVICE
operator int () noexcept { return (m_idata & 0x00FFFFFF); }
operator int () const noexcept { return (m_idata & 0x00FFFFFF); }
};

/** \brief The struct used to store particles.
Expand Down

0 comments on commit 0ca8506

Please sign in to comment.