-
Notifications
You must be signed in to change notification settings - Fork 438
Pre/post checkpoint path truncates maxnextid from Long to int #5055
Copy link
Copy link
Closed
Description
- Type: Correctness / Data corruption risk
- Severity: High
- Component: Particle checkpoint/plotfile pre-post metadata
- Location:
Src/Particle/AMReX_ParticleIO.H:485Src/Particle/AMReX_ParticleContainer.H:1262Src/Particle/AMReX_ParticleContainer.H:1422
Problem
CheckpointPre() computes maxnextid as Long, then stores it as:
maxnextidPrePost = int(maxnextid);The container member and getter are also int. Particle IDs are 64-bit packed IDs and can exceed 32-bit range.
Impact
- ID truncation in pre/post write path.
- Header can store a wrapped/incorrect next ID.
- Restart may reset ID generator too low, risking duplicate IDs and corrupted particle identity semantics.
Suggested patch
Keep this value in Long end-to-end.
--- a/Src/Particle/AMReX_ParticleContainer.H
+++ b/Src/Particle/AMReX_ParticleContainer.H
@@
- int GetMaxNextIDPrePost () const { return maxnextidPrePost; }
+ Long GetMaxNextIDPrePost () const { return maxnextidPrePost; }
@@
- int maxnextidPrePost;
+ Long maxnextidPrePost;--- a/Src/Particle/AMReX_ParticleIO.H
+++ b/Src/Particle/AMReX_ParticleIO.H
@@
- maxnextidPrePost = int(maxnextid);
+ maxnextidPrePost = maxnextid;Prepared by Codex
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels