Fix 6 safe pre/post-process bugs (batch)#1240
Fix 6 safe pre/post-process bugs (batch)#1240sbryngelson wants to merge 7 commits intoMFlowCode:masterfrom
Conversation
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
📝 WalkthroughWalkthroughThis PR fixes five critical bugs across multiple modules: OBJ reader vertex indexing collision, Lagrangian bubble output time value initialization, interface contour point spacing computation, simplex noise index wrapping range, directory cleanup semantics, and integral z-bounds copy-paste error. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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 |
Nitpicks 🔍
|
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Pull request overview
Batches several small correctness fixes across MFC utilities and I/O paths, targeting directory handling, initialization bugs, indexing errors, and post-process output correctness.
Changes:
- Fixes directory cleanup logic in serial pre-process so it deletes the intended rank directory instead of using a non-expanding wildcard.
- Corrects initialization/indexing issues (integral z-bounds init, OBJ face parsing index handling).
- Fixes post-process outputs (initialize
time_realfrom restart metadata; correct interface point distance checking) and simplex-noise index wrapping.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/simulation/m_global_parameters.fpp |
Initializes volume-integral zmin/zmax correctly (instead of mistakenly repeating y-bounds). |
src/pre_process/m_start_up.fpp |
Replaces wildcard-based directory “cleanup” with deletion of the actual per-rank directory, then recreates /0. |
src/pre_process/m_simplex_noise.fpp |
Uses iand(…,255) for correct 0–255 permutation indexing in 2D simplex noise. |
src/post_process/m_data_output.fpp |
Initializes time_real from file_time and fixes the interface-point distance check loop to use the correct index and early-exit logic. |
src/common/m_model.fpp |
Fixes OBJ face parsing so the third vertex index doesn’t overwrite the triangle counter (j). |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/post_process/m_data_output.fpp`:
- Line 1271: The assignment time_real = file_time in the Silo output function is
dead code because time_real is never used; either remove that assignment from
the Silo branch or add the simulation time metadata to the DBPUTPM call so Silo
stores time. Locate the Silo variant of the output routine (the code path that
calls DBPUTPM) and either delete the time_real variable and its assignment, or
build an options list containing the time (e.g., set "time" or "cycle" entries
using file_time/time_real) and pass it into DBPUTPM so the point-mesh metadata
includes the simulation time.
In `@src/pre_process/m_start_up.fpp`:
- Around line 358-361: The Windows implementation of s_create_directory does not
create parent directories recursively, causing failures when code calls
s_delete_directory(...) then s_create_directory(trim(proc_rank_dir)//'/0') (and
similar calls elsewhere); update the Windows branch in the s_create_directory
implementation (in m_compile_specific) to invoke mkdir with the /s flag (e.g.,
use "mkdir /s <path>" or the equivalent command string) so parent directories
are created recursively, and ensure any other uses of s_create_directory (the
second occurrence noted) benefit from the same change.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1240 +/- ##
==========================================
+ Coverage 44.05% 44.06% +0.01%
==========================================
Files 70 70
Lines 20496 20497 +1
Branches 1989 1989
==========================================
+ Hits 9030 9033 +3
+ Misses 10328 10326 -2
Partials 1138 1138 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…a_files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The z-bounds initialization for volume integrals repeats ymin/ymax instead of zmin/zmax. 3D volume integrals use uninitialized z-bounds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When reading face lines, j is overwritten by the third vertex index from the file, then used as the triangle index for model%trs(j). Introduces a separate iv3 variable for the third vertex index. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
time_real is declared but never assigned from file_time after the MPI broadcast. The time column in output contains garbage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
euc_d was computed outside the inner loop using the outer variable i (stale from a previous loop) instead of the current stored-point index. Moved distance computation inside the do-loop over stored points and changed cycle to exit for correct early termination when a candidate point is too close to any existing point. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0dabbbc to
08a7f25
Compare
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI Incremental review completed. |
User description
Summary
Batches 6 low-risk bug fixes that only touch pre-process or post-process CPU code paths. These have no GPU kernel, MPI hot-path, or simulation numerics impact, making them safe to merge with GitHub CI alone.
Included fixes
s_create_directorywildcard (Fix s_create_directory called with /* wildcard creating junk directory #1214):mkdirwas called with/*glob, creating a literal*directoryzmin/zmaxnever initialized (copy-paste ofymin/ymax)jused as both triangle counter and vertex indextime_realinit (Fix time_real used uninitialized in Lagrangian bubble output #1189): Used uninitialized in Lagrangian bubble post-process outputs_write_intf_data_fileloop index (Fix s_write_intf_data_file using wrong loop index for distance check #1191): Wrong loop index for distance check in post-processmod(i,255)skips index 255; fixed toiand(i,255)Supersedes
Closes #1214, closes #1177, closes #1178, closes #1189, closes #1191, closes #1218
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Refactor
CodeAnt-AI Description
Fix multiple pre/post-process bugs that previously produced incorrect files, geometry, and outputs
What Changed
Impact
✅ No junk rank directories created during pre-process✅ Correct triangle geometry on OBJ import✅ Correct time values in Lagrangian bubble output💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.