Fix s_write_intf_data_file using wrong loop index for distance check#1191
Fix s_write_intf_data_file using wrong loop index for distance check#1191sbryngelson wants to merge 1 commit 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 · |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ 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
This PR fixes a critical bug in the interface data output logic where distance calculations were using stale loop indices, potentially causing incorrect spacing validation of interface contour points.
Changes:
- Moved Euclidean distance computation inside the loop over stored points to use the correct index
- Replaced
cyclewithexitto properly terminate when a candidate point is too close to existing points - Removed redundant distance calculations and simplified the conditional logic
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>
c7ffcdb to
2c3fcc9
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1191 +/- ##
=======================================
Coverage 44.05% 44.05%
=======================================
Files 70 70
Lines 20498 20496 -2
Branches 1990 1990
=======================================
Hits 9030 9030
+ Misses 10329 10327 -2
Partials 1139 1139 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Severity: HIGH — interface contour extraction uses stale loop index, produces wrong point distances.
File:
src/post_process/m_data_output.fpp, lines 1549-1563In
s_write_intf_data_file, the Euclidean distanceeuc_dbetween a candidate interface point and existing stored points is computed usingx_d1(i)andy_d1(i), whereiis stale from a previous outer loop (value =m+1after the maxalpha search loop). This references out-of-bounds or wrong data. Additionally,euc_dis computed once outside the inner loop, so the distance check is the same for all stored points.Before
After
Three fixes:
euc_dcomputation inside the loop so it checks distance to each stored pointcycletoexitfor correct early termination (reject if too close to any point)counter == 0branch (distance to self)Test plan
🤖 Generated with Claude Code
Fixes #1211