Skip to content

Commit

Permalink
Add argument for NeighborParticleContainer::Redistribute (#4294)
Browse files Browse the repository at this point in the history
## Summary
This PR allows the user to specify the argument `remove_negatives` for
the `NeighborParticleContainer::Redistribute` method.

## Additional background
The argument `remove_negatives` is then passed to the call to the
`ParticleContainerImpl::Redistribute` method, which allows us to avoid
removing particles with negative IDs.

## Checklist

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
  • Loading branch information
rporcu authored Jan 16, 2025
1 parent e761abf commit a74c72e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Src/Particle/AMReX_NeighborParticles.H
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,22 @@ public:
calcCommSize();
}

void Redistribute (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0)
void Redistribute (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0,
bool remove_negative=true)
{
clearNeighbors();
ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>
::Redistribute(lev_min, lev_max, nGrow, local);
::Redistribute(lev_min, lev_max, nGrow, local, remove_negative);
}

void RedistributeLocal ()
void RedistributeLocal (bool remove_negative=true)
{
const int lev_min = 0;
const int lev_max = 0;
const int nGrow = 0;
const int local = 1;
clearNeighbors();
this->Redistribute(lev_min, lev_max, nGrow, local);
this->Redistribute(lev_min, lev_max, nGrow, local, remove_negative);
}

#ifdef AMREX_USE_GPU
Expand Down

0 comments on commit a74c72e

Please sign in to comment.