fix: use DBADDIAOPT for array SILO options (lo_offset, hi_offset) - #1344
Conversation
DBADDIOPT expects a scalar integer, but lo_offset and hi_offset are arrays (size 1-3 depending on dimensionality). This passes an array where SILO expects a scalar pointer, so only the first element is read. Use DBADDIAOPT (integer array option) instead, which takes the array length and pointer. This fixes gfortran rank mismatch warnings and ensures all dimension offsets are correctly written to SILO files.
Review Summary by QodoFix SILO ghost zone offset array handling with DBADDIAOPT
WalkthroughsDescription• Replace DBADDIOPT with DBADDIAOPT for array SILO options • Fix silent data loss of ghost zone offsets in 2D/3D cases • Pass array length and pointer to SILO's integer array function • Resolve gfortran rank mismatch warnings in SILO output Diagramflowchart LR
A["DBADDIOPT<br/>scalar int"] -->|incorrect| B["Only first element<br/>read from array"]
C["DBADDIAOPT<br/>array int"] -->|correct| D["All dimensions<br/>written to SILO"]
B --> E["Data loss in 2D/3D"]
D --> F["Complete ghost zone info"]
File Changes1. src/post_process/m_data_output.fpp
|
Code Review by Qodo
1. Proxy missing DBADDIAOPT
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe changes update how low and high offset arrays are passed to the Silo-HDF5 mesh writing function. Specifically, two function calls were replaced: 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1344 +/- ##
=======================================
Coverage 64.67% 64.67%
=======================================
Files 70 70
Lines 18249 18249
Branches 1504 1504
=======================================
Hits 11803 11803
Misses 5491 5491
Partials 955 955 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
lo_offsetandhi_offsetare integer arrays (size 1-3 depending on dimensionality), but they were being passed toDBADDIOPTwhich expects a scalar integer. SILO's Fortran wrapper forDBADDIOPTstores a pointer to a singleint, so only the first element was read — meaning 2D and 3D ghost zone offsets beyond the first dimension were silently lost in SILO output files.Fix: use
DBADDIAOPT(optlist, option, nval, array)which is the correct SILO function for integer array options.Verified by reading the SILO Fortran wrapper source (
silo_f.c):DBADDIOPT_FC(optlist_id, option, ivalue)— scalar, stores pointer to single intDBADDIAOPT_FC(optlist_id, option, nval, ivalues)— array, stores pointer to int array with lengthTest plan
./mfc.sh precheck -j 8./mfc.sh build -j 4(all targets)format = 2(SILO output), 4 MPI ranks — post_process completes successfully and produces correct SILO files