Skip to content

Use p.id().is_valid() consistently#4635

Merged
atmyers merged 5 commits intoAMReX-Codes:developmentfrom
AlexanderSinn:use_id___is_valid___consistently
Sep 16, 2025
Merged

Use p.id().is_valid() consistently#4635
atmyers merged 5 commits intoAMReX-Codes:developmentfrom
AlexanderSinn:use_id___is_valid___consistently

Conversation

@AlexanderSinn
Copy link
Copy Markdown
Member

Summary

This PR applies further cleaning to particles.

The largest change is the replacement of all numeric id comparisons with id().is_valid() and id().make_invlid(). Previously, id() > 0, id() < 0, id() < 1 and id() <= 0 with id() = - id() were used, making the treatment of id == 0 inconsistent (particle ids start at 1 because of this).

Both ptd.m_aos[i] and make_particle<ConstParticleType>{}(ptd, ip); were replaced with ptd[i] which is more concise and works with PureSoA particles.

The PureSoA specialization of numParticlesOutOfRange was removed because the other version also works with PureSoA particles.

Additional background

Checklist

The proposed changes:

  • 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

@atmyers atmyers merged commit 8014ff4 into AMReX-Codes:development Sep 16, 2025
73 of 75 checks passed
@atmyers
Copy link
Copy Markdown
Member

atmyers commented Sep 16, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants