Skip to content

Commit

Permalink
Black format update and RST fixes (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
sseraj authored Mar 20, 2023
1 parent 2c9a572 commit f423d0d
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 325 deletions.
2 changes: 1 addition & 1 deletion pysurf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "1.3.1"
__version__ = "1.3.2"

from .tsurf_component import TSurfGeometry, TSurfCurve
18 changes: 0 additions & 18 deletions pysurf/baseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ def accumulate_reverseADSeeds(self, coorb=None, curveCoorb=None):
# MANIPULATOR INTERFACE METHODS

def assign_manipulator(self, GMObj):

"""
This function assign a geometry manipulation object (such ad DVGeo) to the
current Geometry object.
Expand All @@ -241,7 +240,6 @@ def assign_manipulator(self, GMObj):

# Only the root proc will embed the pySurf nodes into the manipulator
if self.myID == 0:

print("")
print("Assigning ", self.name, " to manipulator object")

Expand All @@ -262,7 +260,6 @@ def assign_manipulator(self, GMObj):

# Now we need to assign every curve to the manipulator as well
for curveName in self.curves:

# Generate name for the curve point set
ptSetName = self.name + ":curveNodes:" + curveName

Expand All @@ -279,12 +276,10 @@ def assign_manipulator(self, GMObj):
print("")

else:

# The other processors will just save the reference to the manipulator
self.manipulator = GMObj

def manipulator_addPointSet(self, coor, ptSetName):

"""
This method adds an extra point set to the manipulator object.
Expand All @@ -302,7 +297,6 @@ def manipulator_addPointSet(self, coor, ptSetName):
self.manipulator.addPointSet(coor, ptSetName)

def manipulator_update(self, ptSetName=None):

"""
This method will call the update functions from the manipulator object accordingly
to update the geometry based on the new set of design variables.
Expand All @@ -320,7 +314,6 @@ def manipulator_update(self, ptSetName=None):

# Only the root proc should update the triangulated surfaces and curves
if self.myID == 0:

# Update surface nodes
print("Updating triangulated surface nodes from ", self.name)
coor = self.manipulator.update(self.ptSetName)
Expand All @@ -329,7 +322,6 @@ def manipulator_update(self, ptSetName=None):

# Now we need to update every curve as well
for curveName in self.curves:

# Update curve nodes
print("Updating nodes from curve ", curveName)
coor = self.manipulator.update(self.curves[curveName].ptSetName)
Expand All @@ -338,7 +330,6 @@ def manipulator_update(self, ptSetName=None):

# Finally, all procs update the embeded nodes, if they have one
if ptSetName is not None:

if self.myID == 0:
print("Updating embedded nodes from ", self.name, " under ptSet ", ptSetName)

Expand All @@ -349,7 +340,6 @@ def manipulator_update(self, ptSetName=None):
print("Done")

def manipulator_forwardAD(self, xDVd, ptSetName=None):

"""
This method uses forward AD to propagate derivative seeds from the design
variables to the surface mesh coordinates.
Expand All @@ -372,7 +362,6 @@ def manipulator_forwardAD(self, xDVd, ptSetName=None):

# Now we need to update every curve as well
for curveName in self.curves:

# Update curve nodes
print("Updating nodes from curve ", curveName)
coord = self.manipulator.totalSensitivityProd(xDVd, self.curves[curveName].ptSetName)
Expand All @@ -382,7 +371,6 @@ def manipulator_forwardAD(self, xDVd, ptSetName=None):

# Finally, all procs update the embeded nodes, if they have one
if ptSetName is not None:

if self.myID == 0:
print("Updating embedded nodes from ", self.name, " under ptSet ", ptSetName)

Expand All @@ -393,7 +381,6 @@ def manipulator_forwardAD(self, xDVd, ptSetName=None):
print("Done")

def manipulator_reverseAD(self, xDVb, ptSetName=None, comm=None, clean=True):

"""
This method uses reverse AD to propagate derivative seeds from the surface mesh
coordinates to the design variables.
Expand All @@ -404,7 +391,6 @@ def manipulator_reverseAD(self, xDVb, ptSetName=None, comm=None, clean=True):
"""

if self.myID == 0:

# Print log
print("")
print("Reverse AD call to manipulator of ", self.name, " object")
Expand All @@ -420,7 +406,6 @@ def manipulator_reverseAD(self, xDVb, ptSetName=None, comm=None, clean=True):

# Now we need to update every curve as well
for curveName in self.curves:

# Update curve nodes
print("Updating nodes from curve ", curveName)
xDVb_curr = self.manipulator.totalSensitivity(curveCoorb[curveName], self.curves[curveName].ptSetName)
Expand All @@ -429,7 +414,6 @@ def manipulator_reverseAD(self, xDVb, ptSetName=None, comm=None, clean=True):

# Finally, all procs update the embeded nodes, if they have one
if ptSetName is not None:

if self.myID == 0:
print("Updating embedded nodes from ", self.name, " under ptSet ", ptSetName)

Expand All @@ -440,7 +424,6 @@ def manipulator_reverseAD(self, xDVb, ptSetName=None, comm=None, clean=True):
print("Done")

def manipulator_getDVs(self):

"""
This returns the design variables of the current manipulator.
"""
Expand Down Expand Up @@ -543,7 +526,6 @@ def project(self, xyz):


def accumulate_dict(majorDict, minorDict):

"""
This function will loop over all keys of minorDict. If majorDict
shares the same key, then we will accumulate (add) the values into
Expand Down
15 changes: 0 additions & 15 deletions pysurf/tecplot_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


def write_tecplot_scatter(filename, title, variable_names, data_points):

# Open the data file
fid = open(filename, "w")

Expand Down Expand Up @@ -34,7 +33,6 @@ def write_tecplot_scatter(filename, title, variable_names, data_points):


def readTecplotFEdata(fileName):

# Written by Ney Secco
# This script will read sections from a Tecplot FE file
# FOR NOW THIS JUST READS BAR FE FILES FOR THE CURVE FUNCTIONS
Expand All @@ -53,7 +51,6 @@ def readTecplotFEdata(fileName):

# Loop over the lines to gather data
for line in lines:

# Split data
data = line.split()

Expand All @@ -64,7 +61,6 @@ def readTecplotFEdata(fileName):

# Detect if we reached a new section definition
if data[0].lower() == "zone":

# Gather name of the new zone
zoneName = line.split('"')[1]

Expand All @@ -85,7 +81,6 @@ def readTecplotFEdata(fileName):

# Check if we have a data line
if len(data) == 3:

# Try to convert the elements of this line to numbers.
# If this doesn't work, it means we do not have a data line.
try:
Expand All @@ -95,7 +90,6 @@ def readTecplotFEdata(fileName):

# Check if we have a connectivity line
if len(data) == 2:

# Try to convert the elements of this line to numbers.
# If this doesn't work, it means we do not have a connectivity line.
try:
Expand All @@ -112,7 +106,6 @@ def readTecplotFEdata(fileName):


def readTecplotCurves(fileName):

"""
This function will read a curve definition from a Tecplot FE data file
and assign coor and barsConn.
Expand All @@ -126,7 +119,6 @@ def readTecplotCurves(fileName):
# Create curves for every section
curves = []
for secID in range(len(sectionName)):

# Gather data
# The -1 is to adjust connectivities to Python indexing, which starts at zero.
coor = np.array(sectionData[secID])
Expand All @@ -150,7 +142,6 @@ def __init__(self, coor, barsConn, curveName):
self.name = curveName

def export_tecplot(self, fileName="curve"):

writeTecplotFEdata(self.coor, self.barsConn, self.name, fileName)


Expand All @@ -159,7 +150,6 @@ def export_tecplot(self, fileName="curve"):


def readTecplotFEdataSurf(fileName):

# Written by Ney Secco
# This script will read sections from a Tecplot FE file with quads written by pysurf.
# The Tecplot file should have a single zone
Expand All @@ -175,7 +165,6 @@ def readTecplotFEdataSurf(fileName):

# Loop over the lines to gather data
for line in lines:

# Split data
data = line.split()

Expand All @@ -186,7 +175,6 @@ def readTecplotFEdataSurf(fileName):

# Check if we have a coordinate line
if len(data) == 3:

# Try to convert the elements of this line to numbers.
# If this doesn't work, it means we do not have a data line.
try:
Expand All @@ -196,7 +184,6 @@ def readTecplotFEdataSurf(fileName):

# Check if we have a quad connectivity line
if len(data) == 4:

# Try to convert the elements of this line to numbers.
# If this doesn't work, it means we do not have a connectivity line.
try:
Expand Down Expand Up @@ -226,7 +213,6 @@ def readTecplotFEdataSurf(fileName):


def writeTecplotFEdata(coor, barsConn, curveName, fileName):

# This script will write sections from a Tecplot FE file
# Written by John Hwang. Adapted by Ney Secco.

Expand Down Expand Up @@ -273,7 +259,6 @@ def writeTecplotFEdata(coor, barsConn, curveName, fileName):


def writeTecplotSurfaceFEData(coor, triaConn, quadsConn, surfName, fileName):

"""
This method will export the triangulated surface data into a tecplot format.
The will write all elements as quad data. The triangle elements will be exported
Expand Down
Loading

0 comments on commit f423d0d

Please sign in to comment.