Skip to content

Commit

Permalink
Remove simpleOCart and update imports (#54)
Browse files Browse the repository at this point in the history
* update black format

* removed simpleOCart

* updated imports

* numpy to np

* require scipy

* cleaned up block comments

* version bump

* minor docstring fix

* clarify readme
  • Loading branch information
sseraj authored May 12, 2022
1 parent 89b97fe commit 2bde4dd
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 277 deletions.
2 changes: 1 addition & 1 deletion cgnsutilities/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.6.0"
__version__ = "2.7.0"
32 changes: 9 additions & 23 deletions cgnsutilities/cgns_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import tempfile
import argparse
import pickle
import numpy
import numpy as np

from cgnsutilities.cgnsutilities import (
Block,
Expand Down Expand Up @@ -517,16 +517,6 @@ def get_parser():
p_sub.add_argument("mgcycle", help="Minimum MG cycle to enforce", type=int)
p_sub.add_argument("outFile", help="Name of output CGNS file")

# ------------ Options for 'simpleOCart' mode --------------------
p_sub = subparsers.add_parser("simpleOCart", help="Generates a background cartesian mesh surrounding by an OMesh")
p_sub.add_argument("gridFile", help="Name of input CGNS file")
p_sub.add_argument("dh", help="Uniform cartesian spacing size", type=float)
p_sub.add_argument("hExtra", help='Extension in "O" dimension', type=float)
p_sub.add_argument("nExtra", help="Number of nodes to use for extension", type=int)
p_sub.add_argument("sym", help="Normal for possible sym plane", type=str)
p_sub.add_argument("mgcycle", help="Minimum MG cycle to enforce", type=int)
p_sub.add_argument("outFile", help="Name of output CGNS file")

# ------------ Options for 'translate' mode --------------------
p_t = subparsers.add_parser("translate", help="Translate a grid.")
p_t.add_argument("gridFile", help="Name of input CGNS file")
Expand Down Expand Up @@ -742,7 +732,7 @@ def main():

# Now we make a character array of the file names, and hand if off to
# fortran for all the actual reading/writing.
fileNames = numpy.zeros((len(files), 256), "c")
fileNames = np.zeros((len(files), 256), "c")
for i in range(len(files)):
fileNames[i, 0 : len(files[i])] = files[i]

Expand All @@ -753,12 +743,12 @@ def main():
nx = args.nx
ny = args.ny
nz = args.nz
X = numpy.zeros((nx, ny, nz, 3))
X = np.zeros((nx, ny, nz, 3))
Xcart = []
Xcart.append(numpy.linspace(0, 1, nx))
Xcart.append(numpy.linspace(0, 1, ny))
Xcart.append(numpy.linspace(0, 1, nz))
Xx, Xy, Xz = numpy.meshgrid(Xcart[0], Xcart[1], Xcart[2], indexing="ij")
Xcart.append(np.linspace(0, 1, nx))
Xcart.append(np.linspace(0, 1, ny))
Xcart.append(np.linspace(0, 1, nz))
Xx, Xy, Xz = np.meshgrid(Xcart[0], Xcart[1], Xcart[2], indexing="ij")
X[:, :, :, 0] = Xx
X[:, :, :, 1] = Xy
X[:, :, :, 2] = Xz
Expand Down Expand Up @@ -934,10 +924,6 @@ def main():
curGrid.simpleCart(args.dh, args.hExtra, args.nExtra, args.sym, args.mgcycle, args.outFile)
sys.exit(0)

elif args.mode == "simpleOCart":
curGrid.simpleOCart(args.dh, args.hExtra, args.nExtra, args.sym, args.mgcycle, args.outFile)
sys.exit(0)

elif args.mode == "translate":
curGrid.translate(args.dx, args.dy, args.dz)

Expand Down Expand Up @@ -968,7 +954,7 @@ def main():
end = int(spec)
for i in range(start, end + 1):
toWrite.append(i)
toWrite = numpy.unique(toWrite)
toWrite = np.unique(toWrite)
toWrite.sort()
curGrid.writeToCGNSSelected(args.outFile, toWrite)
sys.exit(0)
Expand Down Expand Up @@ -1087,7 +1073,7 @@ def main():
data.append(curGrid.convArray[entry])

# Convert data to array
data = numpy.array(data).T
data = np.array(data).T

# Write tecplot results
write_tecplot_file(outFile, "Convergence", ["Iteration"] + curGrid.convArray.keys(), data)
Expand Down
Loading

0 comments on commit 2bde4dd

Please sign in to comment.