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

Fix matplotlib import in DVGeoCST #182

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 0 additions & 4 deletions pygeo/constraints/DVCon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,6 @@ def addProjectedLocationConstraints1D(
DVGeoName="default",
compNames=None,
):

"""This is similar to addLocationConstraints1D except that the actual
poly line is determined by first projecting points on to the
surface in a similar manner as addConstraints1D, and then
Expand Down Expand Up @@ -2181,7 +2180,6 @@ def addGearPostConstraint(
DVGeoName="default",
compNames=None,
):

"""Code for doing landing gear post constraints on the fly in an
optimization. As it turns out, this is a critical constraint
for wing-mounted landing gear and high-aspect ratio swept
Expand Down Expand Up @@ -3204,7 +3202,6 @@ def addMonotonicConstraints(
)

def _checkDVGeo(self, name="default"):

"""check if DVGeo exists"""
if name not in self.DVGeometries.keys():
raise Error(
Expand Down Expand Up @@ -3262,7 +3259,6 @@ def _generateIntersections(self, leList, teList, nSpan, nChord, surfaceName):
te_span_s = np.array([])

for i in range(numSegments):

# Only include the endpoint if this is the last segment to avoid double counting points
if i == numSegments - 1:
endpoint = True
Expand Down
3 changes: 0 additions & 3 deletions pygeo/constraints/baseConstraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def _finalize(self):
# Local Shape Variables
for key in self.DVGeo.DV_listLocal:
if self.config is None or self.config in self.DVGeo.DV_listLocal[key].config:

# end for (indSet loop)
cons = self.DVGeo.DV_listLocal[key].mapIndexSets(self.indSetA, self.indSetB)
ncon = len(cons)
Expand All @@ -206,7 +205,6 @@ def _finalize(self):
# Section local shape variables
for key in self.DVGeo.DV_listSectionLocal:
if self.config is None or self.config in self.DVGeo.DV_listSectionLocal[key].config:

# end for (indSet loop)
cons = self.DVGeo.DV_listSectionLocal[key].mapIndexSets(self.indSetA, self.indSetB)
ncon = len(cons)
Expand All @@ -227,7 +225,6 @@ def _finalize(self):
# Section local shape variables
for key in self.DVGeo.DV_listSpanwiseLocal:
if self.config is None or self.config in self.DVGeo.DV_listSpanwiseLocal[key].config:

# end for (indSet loop)
cons = self.DVGeo.DV_listSpanwiseLocal[key].mapIndexSets(self.indSetA, self.indSetB)
ncon = len(cons)
Expand Down
2 changes: 0 additions & 2 deletions pygeo/constraints/gearPostConstraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def __init__(
self.D0 = np.linalg.norm(self.coords[0] - self.coords[1])

def evalFunctions(self, funcs, config):

# Update the gear post locations
self.coords = self.DVGeo.update(self.name, config=config)

Expand Down Expand Up @@ -79,7 +78,6 @@ def evalFunctionsSens(self, funcsSens, config):
"""
nDV = self.DVGeo.getNDV()
if nDV > 0:

wfuncs = {}
self.wimpress.evalFunctions(wfuncs)

Expand Down
7 changes: 0 additions & 7 deletions pygeo/geo_utils/dcel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def __init__(self, v1, v2, X, PID, uv, tag):
self.con = [v1, v2]

def __repr__(self):

str1 = f"v1: {self.v1[0]:f} {self.v1[1]:f}\nv2: {self.v2[0]:f} {self.v2[1]:f}"
return str1

Expand Down Expand Up @@ -128,7 +127,6 @@ def calcCentroid(self):
self.centroid = center / counter

def calcSpatialCentroid(self):

h = self.wedge
center = np.zeros(3)
center += h.origin.X
Expand Down Expand Up @@ -223,7 +221,6 @@ def buildDcel(self):
multCheck = mult < 2

if np.any(multCheck):

# We need to do a couple of things:
# 1. The bad vertices need to be removed from the vertex list
# 2. Remaning vertices must be renamed
Expand Down Expand Up @@ -270,7 +267,6 @@ def buildDcel(self):
appendCount = 0

for e in self.el:

h1 = DCELHedge(self.vertices[e.con[0]], self.vertices[e.con[1]], e.PID, e.uv, e.tag)
h2 = DCELHedge(self.vertices[e.con[1]], self.vertices[e.con[0]], e.PID, e.uv, e.tag)

Expand Down Expand Up @@ -326,7 +322,6 @@ def buildDcel(self):
self.faces[i].tag = self.faceInfo[i]

def writeTecplot(self, fileName):

f = open(fileName, "w")
f.write('VARIABLES = "X","Y"\n')
for i in range(len(self.el)):
Expand Down Expand Up @@ -395,7 +390,6 @@ def nedges(self):
return len(self.hedges) // 2

def saveDCEL(self, fileName):

f = open(fileName, "w")
f.write("%d %d %d\n" % (self.nvertices(), self.nedges(), self.nfaces()))
for i in range(self.nvertices()):
Expand Down Expand Up @@ -448,7 +442,6 @@ def saveDCEL(self, fileName):
f.close()

def loadDCEL(self, fileName):

f = open(fileName)
# Read sizes
tmp = f.readline().split()
Expand Down
1 change: 0 additions & 1 deletion pygeo/geo_utils/ffd_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def getDistribution(distIn, N):


def createFittedWingFFD(surf, surfFormat, outFile, leList, teList, nSpan, nChord, absMargins, relMargins, liftIndex):

"""
Generates a wing FFD with chordwise points that follow the airfoil geometry.

Expand Down
5 changes: 0 additions & 5 deletions pygeo/geo_utils/node_edge_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def setNodeValue(arr, value, nodeIndex):


def setEdgeValue(arr, values, edgeDir, edgeIndex):

if edgeDir == -1: # Reverse values
values = values[::-1]

Expand Down Expand Up @@ -162,7 +161,6 @@ def setEdgeValue(arr, values, edgeDir, edgeIndex):


def setFaceValue(arr, values, faceDir, faceIndex):

# Orient the array first according to the dir:

values = orientArray(faceDir, values)
Expand All @@ -184,7 +182,6 @@ def setFaceValue(arr, values, faceDir, faceIndex):


def setFaceValue2(arr, values, faceDir, faceIndex):

# Orient the array first according to the dir:

values = orientArray(faceDir, values)
Expand Down Expand Up @@ -264,7 +261,6 @@ def __repr__(self):
return "Node1: %d Node2: %d MidPt: %f %f %f" % (self.n1, self.n2, self.midPt[0], self.midPt[1], self.midPt[2])

def __lt__(self, other):

if self.n1 != other.n1:
return self.n1 < other.n1

Expand Down Expand Up @@ -316,7 +312,6 @@ def __repr__(self):
)

def __lt__(self, other):

if self.n1 != other.n1:
return self.n1 < other.n1

Expand Down
5 changes: 0 additions & 5 deletions pygeo/geo_utils/pointselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

class PointSelect:
def __init__(self, psType, *args, **kwargs):

"""Initialize a control point selection class. There are several ways
to initialize this class depending on the 'type' qualifier:

Expand Down Expand Up @@ -121,12 +120,10 @@ def __init__(self, psType, *args, **kwargs):
raise ValueError("The indices provided to pointSelect are not unique.")

elif psType == "ijkBounds":

self.ijkBounds = kwargs["ijkBounds"] # Store the ijk bounds dictionary
self.type = "ijkBounds"

def getPoints(self, points):

"""Take in a list of points and return the ones that statify
the point select class."""
ptList = []
Expand All @@ -152,7 +149,6 @@ def getPoints(self, points):
return ptList, indList

def getPoints_ijk(self, DVGeo):

"""Receives a DVGeo object (with an embedded FFD) and uses the ijk bounds specified in the initialization to extract
the corresponding indices.

Expand All @@ -165,7 +161,6 @@ def getPoints_ijk(self, DVGeo):

# Loop over every dictionary entry to get cooresponding indices
for iVol in self.ijkBounds:

# Get current bounds
ilow = self.ijkBounds[iVol][0][0]
ihigh = self.ijkBounds[iVol][0][1]
Expand Down
2 changes: 0 additions & 2 deletions pygeo/geo_utils/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def projectNodePID(pt, upVec, p0, v1, v2, uv0, uv1, uv2, PID):
secondS = ss[1]

if np.dot(first - pt, upVec) >= np.dot(second - pt, upVec):

return (
[first, firstPatchID, firstU, firstV, firstS],
[second, secondPatchID, secondU, secondV, secondS],
Expand All @@ -126,7 +125,6 @@ def projectNodePID(pt, upVec, p0, v1, v2, uv0, uv1, uv2, PID):


def projectNodePIDPosOnly(pt, upVec, p0, v1, v2, uv0, uv1, uv2, PID):

# Get the bounds of the geo object so we know what to scale by

fail = 0
Expand Down
1 change: 0 additions & 1 deletion pygeo/geo_utils/split_quad.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def tfi_2d(e0, e1, e2, e3):
try:
X = tfi2d(e0.T, e1.T, e2.T, e3.T).T
except Exception:

Nu = len(e0)
Nv = len(e2)
if Nu != len(e1):
Expand Down
3 changes: 0 additions & 3 deletions pygeo/mphys/mphys_dvgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# class that actually calls the dvgeometry methods
class OM_DVGEOCOMP(om.ExplicitComponent):
def initialize(self):

self.options.declare("file", default=None)
self.options.declare("type", default=None)
self.options.declare("options", default=None)
Expand Down Expand Up @@ -294,7 +293,6 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode):
ni = len(list(d_inputs.keys()))

if mode == "rev" and ni > 0:

# this flag will be set to True after every compute call.
# if it is true, we assume the design has changed so we re-run the sensitivity update
# there can be hundreds of calls to this routine due to thickness constraints,
Expand Down Expand Up @@ -331,7 +329,6 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode):

# global_all_zeros is a numpy array of size 1
if not global_all_zeros[0]:

# TODO totalSensitivityTransProd is broken. does not work with zero surface nodes on a proc
# xdot = self.DVGeo.totalSensitivityTransProd(dout, ptSetName)
xdot = self.DVGeo.totalSensitivity(dout, ptSetName)
Expand Down
Loading