Skip to content
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

Custom ptsets #89

Merged
merged 7 commits into from
Aug 7, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions baseclasses/solvers/pyAero_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@
self.families = CaseInsensitiveDict()
self._updateGeomInfo = False

# Initialize kwargs for addPointSet
# Initialize kwargs for addPointSet and customPointSetFamilies
self.pointSetKwargs = None
self.customPointSetFamilies = None

Check warning on line 59 in baseclasses/solvers/pyAero_solver.py

View check run for this annotation

Codecov / codecov/patch

baseclasses/solvers/pyAero_solver.py#L59

Added line #L59 was not covered by tests

def setMesh(self, mesh):
"""
Expand All @@ -79,7 +80,7 @@
pts = self.getSurfaceCoordinates(self.meshFamilyGroup)
self.mesh.setSurfaceDefinition(pts, conn, faceSizes)

def setDVGeo(self, DVGeo, pointSetKwargs=None):
def setDVGeo(self, DVGeo, pointSetKwargs={}, customPointSetFamilies=None):
"""
Set the DVGeometry object that will manipulate 'geometry' in
this object. Note that <SOLVER> does not **strictly** need a
Expand All @@ -94,6 +95,16 @@
pointSetKwargs : dict
Keyword arguments to be passed to the DVGeo addPointSet call.
Useful for DVGeometryMulti, specifying FFD projection tolerances, etc.
These arguments are used for all point sets added by this solver.

customPointSetFamilies : dict of dicts
Keyword arguments to be passed to the DVGeo addPointSet call for each surface family,
specified by the keys. The surface families need to be all part of the designSurfaceFamily.
Useful for DVGeometryMulti, specifying FFD projection tolerances, etc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the three lines above do not emphasize the main purpose of this argument, which is to have subsets of the CFD surface as separate point sets. I would rephrase this to first talk about what the keys are and what they do, then talk about how the values are dictionaries of keyword arguments.

If this is provided together with pointSetKwargs, the regular pointSetKwargs
will be appended to each component's dictionary. If the same argument
is also provided in pointSetKwargs, the value specified in customPointSetFamilies
will be used.

Examples
--------
Expand All @@ -103,10 +114,11 @@

self.DVGeo = DVGeo

if pointSetKwargs is None:
self.pointSetKwargs = {}
else:
self.pointSetKwargs = pointSetKwargs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code avoids mutable defaults, so we should keep it like this.

# save the common kwargs dict. default is empty
self.pointSetKwargs = pointSetKwargs

Check warning on line 118 in baseclasses/solvers/pyAero_solver.py

View check run for this annotation

Codecov / codecov/patch

baseclasses/solvers/pyAero_solver.py#L118

Added line #L118 was not covered by tests

# save if we have customPointSetFamilies
self.customPointSetFamilies = customPointSetFamilies

Check warning on line 121 in baseclasses/solvers/pyAero_solver.py

View check run for this annotation

Codecov / codecov/patch

baseclasses/solvers/pyAero_solver.py#L121

Added line #L121 was not covered by tests

def getTriangulatedMeshSurface(self, groupName=None, **kwargs):
"""
Expand Down