-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix shape handling in nom_addGlobalDV
#194
Conversation
Codecov Report
@@ Coverage Diff @@
## main #194 +/- ##
==========================================
- Coverage 64.88% 64.87% -0.02%
==========================================
Files 47 47
Lines 11939 11941 +2
==========================================
Hits 7747 7747
- Misses 4192 4194 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
pygeo/mphys/mphys_dvgeo.py
Outdated
"""Add a global design variable to the DVGeo object. This is a wrapper for the DVGeo.addGlobalDV method. | ||
|
||
Parameters | ||
---------- | ||
dvName : str | ||
A unique name to be given to this design variable group | ||
|
||
value : float, or iterable list of floats | ||
The starting value(s) for the design variable. This | ||
parameter may be a single variable or a numpy array | ||
(or list) if the function requires more than one | ||
variable. The number of variables is determined by the | ||
rank (and if rank ==1, the length) of this parameter. | ||
|
||
func : python function | ||
The python function handle that will be used to apply the | ||
design variable | ||
|
||
childIdx : int, optional | ||
The zero-based index of the child FFD, if this DV is for a child FFD. | ||
The index is defined by the order in which you add the child FFD to the parent. | ||
For example, the first child FFD has an index of 0, the second an index of 1, and so on. | ||
|
||
isComposite : bool, optional | ||
Whether this DV is to be included in the composite DVs, by default False | ||
|
||
Raises | ||
------ | ||
RuntimeError | ||
Raised if the underlying DVGeo object is not an FFD | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to start putting docstrings in the MPhys wrapper? We'd have to maintain the common attributes in two places then and that could get messy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the very very least there should be a docstring that explains the MPhys-specific arguments to the function, for the remainder of the arguments it might be fine to point to the docstring for the original DVGeo function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! I agree that we should start adding doc strings for anything that is MPhys-specific, but leave the rest for the pyGeo core.
I have no idea what is going on with the docs build
|
Seems to be missing the Line 33 in 0e6b356
|
Hmm, actually, reading this again I think its |
Oh nice, thanks for fixing that. This is ready to go now @bernardopacini @hajdik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @A-CGray
doc/requirements.txt
Outdated
@@ -1,2 +1,4 @@ | |||
numpydoc | |||
sphinx_mdolab_theme | |||
openmdao | |||
mphys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these necessary or is the mock import enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @sseraj. Looks good to me again.
Purpose
This PR fixes the
nom_addGlobalDV
method in the MPhys wrapper so that it accepts scalar arguments to thevalue
argument, just like the actualaddGlobalDV
method does. Previously this would fail becausenom_addGlobalDV
would try and evaluatelen(value)
. The shape of the DV is now automatically extracted from the DV after it is added to the DVGeo object.Also, I added a docstring because docs are nice.
Expected time until merged
1 week
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable