- Type: Correctness / Copy-paste index bug
- Severity: High
- Component:
BaseFab GPU search path
- Location:
Src/Base/AMReX_BaseFab.H:2188
Problem
In the GPU branch of BaseFab<T>::indexFromValue, the returned IntVect is built as:
return IntVect(AMREX_D_DECL(ha[1],ha[2],ha[2]));
The third component should be ha[3], not ha[2]. This is a classic x/y/z copy-paste index error.
Impact
- In 3D GPU execution, the returned z-index can be wrong (it duplicates y).
- Can misidentify the located cell and propagate incorrect downstream logic.
Suggested patch
--- a/Src/Base/AMReX_BaseFab.H
+++ b/Src/Base/AMReX_BaseFab.H
@@
- return IntVect(AMREX_D_DECL(ha[1],ha[2],ha[2]));
+ return IntVect(AMREX_D_DECL(ha[1],ha[2],ha[3]));
Prepared by Codex