Fix CUSTOM_OBJFUNC support in Python layer#2756
Open
riddhi1228 wants to merge 7 commits intosu2code:developfrom
Open
Fix CUSTOM_OBJFUNC support in Python layer#2756riddhi1228 wants to merge 7 commits intosu2code:developfrom
riddhi1228 wants to merge 7 commits intosu2code:developfrom
Conversation
- Register CUSTOM_OBJFUNC in historyMap - Normalize Custom_ObjFunc header to CUSTOM_OBJFUNC key - Prevent KeyError when evaluating custom objective functions Fixes su2code#2586
Member
|
Author
|
Fixed — the indentation error on line 92 has been corrected and black formatting applied. Thanks for catching it. |
Author
|
The black formatting check is failing on historyMap.py even though black 22.6.0 reports no changes needed locally and the file is unchanged on the develop branch. This appears to be a pre-existing formatting issue in the repo rather than something introduced by this PR. Happy to investigate further if you can point me to what the CI is reformatting exactly. |
Member
|
It's ok. The bigger issue is that this historyMap.py file should be generated, not edited manually. |
…n test - Add if (false) AddHistoryOutput for CUSTOM_OBJFUNC in CFlowOutput.cpp so updateHistoryMap.py registers it correctly - Fix updateHistoryMap.py parser to handle 'if (false) AddHistoryOutput' pattern - Fix multi-line AddHistoryOutput in CFlowIncOutput.cpp for BGS_ENTHALPY - Regenerate historyMap.py with CUSTOM_OBJFUNC entry - Fix regression test configs: rename AVG_TOTALTEMP to SURFACE_TOTAL_TEMPERATURE (AVG_TOTALTEMP was renamed in the C++ output layer but configs were never updated) Fixes su2code#2586
Author
|
Hi @pcarruscag, updated the PR based on your feedback:
|
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.
This PR fixes the handling of CUSTOM_OBJFUNC in the Python interface.
Problem
When evaluating custom objective functions, the Python layer could raise
a KeyError because the header "Custom_ObjFunc" from history files was not
normalized to the expected "CUSTOM_OBJFUNC" key.
Solution
-Original fix: CUSTOM_OBJFUNC missing from historyMap.py causing KeyError
-Root cause fix: Added if (false) AddHistoryOutput in CFlowOutput.cpp so updateHistoryMap.py generates it correctly
-Parser fix: updateHistoryMap.py now handles if (false) AddHistoryOutput pattern
-Regression test fix: AVG_TOTALTEMP renamed to SURFACE_TOTAL_TEMPERATURE in 3 test configs (this was the cause of the 2 failing regression tests in PR #2587)
-CFlowIncOutput.cpp fix: Joined multi-line BGS_ENTHALPY call to single line so parser works correctly
This resolves issue #2586.