Skip to content

Commit

Permalink
format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
anilyil committed Mar 21, 2022
1 parent fdc1618 commit 84de2ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions pygeo/mphys/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from .mphys_dvgeo import OM_DVGEOCOMP

__all__ = [
"OM_DVGEOCOMP"
]
__all__ = ["OM_DVGEOCOMP"]
20 changes: 10 additions & 10 deletions pygeo/mphys/mphys_dvgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

try:
from pygeo import DVGeometryVSP
except:
except ModuleNotFoundError:
# not everyone might have openvsp installed, and thats okay
pass
from mpi4py import MPI
import numpy as np
from openmdao.utils.array_utils import evenly_distrib_idxs
import time

# class that actually calls the dvgeometry methods
class OM_DVGEOCOMP(om.ExplicitComponent):
Expand Down Expand Up @@ -41,8 +39,8 @@ def compute(self, inputs, outputs):
for var in inputs.keys():
# check that the input name matches the convention for points
if var[:2] == "x_":
# trim the _in and add a "0" to signify that these are initial conditions initial
var_out = var[:-3] + '0'
# trim the _in and add a "0" to signify that these are initial conditions initial
var_out = var[:-3] + "0"
if var_out not in self.omPtSetList:
self.nom_addPointSet(inputs[var], var_out, add_output=False)

Expand Down Expand Up @@ -156,25 +154,27 @@ def nom_add_LETEConstraint(self, name, volID, faceID):
else:
self.add_output(name, distributed=True, shape=0)
return nCon

def nom_addLERadiusConstraints(self, name, leList, nSpan, axis, chordDir):
self.DVCon.addLERadiusConstraints(leList=leList, nSpan=nSpan, axis=axis, chordDir=chordDir, name=name)
comm = self.comm
if comm.rank == 0:
self.add_output(name, distributed=True, val=np.ones(nSpan), shape=nSpan)
else:
self.add_output(name, distributed=True, shape=0)

def nom_addCurvatureConstraint1D(self, name, start, end, nPts, axis, **kwargs):
self.DVCon.addCurvatureConstraint1D(start=start, end=end, nPts=nPts, axis=axis, name=name, **kwargs)
comm = self.comm
if comm.rank == 0:
self.add_output(name, distributed=True, val=1.0)
else:
self.add_output(name, distributed=True, shape=0)

def nom_addLinearConstraintsShape(self, name, indSetA, indSetB, factorA, factorB):
self.DVCon.addLinearConstraintsShape(indSetA=indSetA, indSetB=indSetB, factorA=factorA, factorB=factorB, name=name)
self.DVCon.addLinearConstraintsShape(
indSetA=indSetA, indSetB=indSetB, factorA=factorA, factorB=factorB, name=name
)
lSize = len(indSetA)
comm = self.comm
if comm.rank == 0:
Expand All @@ -193,7 +193,7 @@ def nom_setConstraintSurface(self, surface):
def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode):
# only do the computations when we have more than zero entries in d_inputs in the reverse mode
ni = len(list(d_inputs.keys()))

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

# this flag will be set to True after every compute call.
Expand Down

0 comments on commit 84de2ac

Please sign in to comment.