Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a ValueError during liftingSurface initialization by making knot-existence checks tolerance-based (consistent with how the global knot union is built), preventing erroneous extra knot insertions when knot values differ only at floating-point noise levels.
Changes:
- Replaced exact-membership (
not in) knot checks with a tolerance-based search using a sharedKNOT_TOL. - Added a regression test case that exercises the near-identical-knot “clash” scenario alongside the original case.
- Updated the regression reference file to include both test outputs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pygeo/pyGeo.py |
Uses a consistent knot tolerance when checking whether to insert knots, preventing precision-triggered mismatches. |
tests/reg_tests/test_pyGeo.py |
Splits the regression test into “original” and “clash” cases and trains/validates both. |
tests/reg_tests/ref/test_pyGeo.ref |
Updates reference values to match the new two-case regression test output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Fixes a
ValueErrorinpyGeothat occurs during the initialization of aliftingSurfacewhen using airfoil sections with near-identical, but not bitwise-identical, knot distributions.The core problem was a logical inconsistency in
pygeo/pygeo/pyGeo.pybetween how unique knots were identified for the global knot vector and how they were checked for existence in individual cross-section curves.pyGeobuilds anewKnotsunion by comparing knots with a tolerance of1e-12. If a knot in Curve B is within1e-12of a knot in Curve A, it is considered "already present" and is not added to the global union.newKnotsand checks if each knot exists in every curve using Python'snot inoperator:not inrequires bitwise equality, a knot that was "close enough" (not incheck if the difference is, for example,pyGeolater forces all curves to sharecurves[0].t, the "corrupted" curve triggers aValueErrorin the underlyingpysplineFortran library.The Fix
The
not incheck has been replaced with a tolerance-based search consistent with the rest of the knot-processing logic inpyGeo:Expected time until merged
2 weeks
Type of change
Testing
Added a test using the files I originally encountered this issue using.
Checklist
ruff checkandruff formatto make sure the Python code adheres to PEP-8 and is consistently formattedfprettifyor C/C++ code withclang-formatas applicable