Skip to content

Commit

Permalink
Add special named flag for invalid particles (AMReX-Codes#3688)
Browse files Browse the repository at this point in the history
This lets you do 

`p.m_idcpu = LongParticleIDs::InvalidParticleID;` 

instead of 

`amrex::ParticleIDWrapper{p.m_idcpu} = -1;`

The proposed changes:
- [ ] fix a bug or incorrect behavior in AMReX
- [x] 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

---------

Co-authored-by: Axel Huebl <[email protected]>
  • Loading branch information
atmyers and ax3l authored Jan 12, 2024
1 parent e780f33 commit 8692f60
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Src/Particle/AMReX_Particle.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace amrex {

namespace
{
/** Used for 64bit Long particle Ids as in AoS layout */
/** Special flags used for 64-bit Long particle Ids */
namespace LongParticleIds {
constexpr Long GhostParticleID = 549755813887L; // 2**39-1
constexpr Long VirtualParticleID = GhostParticleID - 1;
Expand All @@ -25,6 +25,15 @@ namespace
}

using namespace LongParticleIds;

/** Flags used to set the entire uint64_t idcpu
to special values at once.
*/
namespace ParticleIdCpus {
constexpr std::uint64_t Invalid = 16777216; // corresponds to id = -1, cpu = 0
}

using namespace ParticleIdCpus;
}

struct ParticleIDWrapper
Expand Down

0 comments on commit 8692f60

Please sign in to comment.