mdolab / pygeo

pyGeo provides geometric design variables and constraints suitable for gradient-based optimization.
https://mdolab-pygeo.readthedocs-hosted.com/en/latest/?badge=latest
Apache License 2.0
131 stars 55 forks source link

Fix `evalFunctionsSens` for projected area constraint #253

Closed A-CGray closed 2 weeks ago

A-CGray commented 1 month ago

Purpose

The evalFunctionsSens method of the projected area constraint currently fails if it is called when there are no geometric design variables because only the creation of the dAp0/1/2 arrays are skipped, but the rest of the function, that uses those arrays, is not. This is fixed by simply skipping everything if nDV ==0.

Also:

Expected time until merged

Type of change

Testing

Checklist

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.

Project coverage is 65.41%. Comparing base (3070c1a) to head (8d199ad). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pygeo/constraints/DVCon.py 73.33% 4 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #253 +/- ## ========================================== - Coverage 65.42% 65.41% -0.02% ========================================== Files 47 47 Lines 12307 12315 +8 ========================================== + Hits 8052 8056 +4 - Misses 4255 4259 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

marcomangano commented 1 month ago

The changes make sense, but I wonder if it is more elegant to have something like:

if nDV == 0:
      pass
A-CGray commented 1 month ago

The changes make sense, but I wonder if it is more elegant to have something like:

if nDV == 0:
      pass

I don't think it matters, this solution would be 1 line longer than what's currently there.

A-CGray commented 3 weeks ago

@eytanadler so glad we figured this out so now you and @hajdik can get the mphys tests working :)