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

Name input #60

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
11 changes: 9 additions & 2 deletions cgnsutilities/cgnsutilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3330,7 +3330,7 @@ def faceID(ptRange, blk):
return grid


def combineGrids(grids, useOldNames=False):
def combineGrids(grids, useOldNames=False, nameInput="domain"):

"""Method that takes in a list of grids and returns a new grid object
containing all zones from each grid. The blocks are renamed as
Expand All @@ -3340,6 +3340,9 @@ def combineGrids(grids, useOldNames=False):

If useOldNames=True we will preserve the domain names after merging
the blocks, otherwise, we will replace all names by the filenames.

nameInput : if the useOldNames is true, then you can add a specific name to your grids which has the name of "domain". if you don't provide a name, then it ll be set to "domain" as usual

"""

# Create a dictionary to contain grid objects with their names
Expand Down Expand Up @@ -3375,7 +3378,11 @@ def combineGrids(grids, useOldNames=False):
if not useOldNames:
blockName = name
else:
blockName = blk.name.split(".")[0]
if blk.name.split(".")[0] == "domain":
blockName = nameInput
else:
blockName = blk.name.split(".")[0]

newName = blockName + f".{nBlock:05}"
zoneMap[blk.name] = newName
blk.name = newName
Expand Down