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

Add a function to get nCells/nNodes #31

Merged
merged 2 commits into from
Apr 14, 2021
Merged
Changes from 1 commit
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
13 changes: 10 additions & 3 deletions cgnsutilities/cgnsutilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,22 @@ def __init__(self):
self.name = "domain"
self.cellDim = 3

def printInfo(self):
"""Print some information on the mesh to screen. Specifically
information needed by the drag prediction workshop"""
def getCellsNodes(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use a more descriptive function name like getTotalCellsAndNodes?

""" Returns the total number of Cells and Nodes in the grid. """
totalCells = 0
totalNodes = 0
for blk in self.blocks:
totalCells += (blk.dims[0] - 1) * (blk.dims[1] - 1) * (blk.dims[2] - 1)
totalNodes += blk.dims[0] * blk.dims[1] * blk.dims[2]

return totalCells, totalNodes


def printInfo(self):
"""Print some information on the mesh to screen. Specifically
information needed by the drag prediction workshop"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is being updated, please update the docstring with more relevant text.

totalCells, totalNodes = self.getCellsNodes()

print("Total Zones:", len(self.blocks))
print("Total Cells:", totalCells)
print("Total Nodes:", totalNodes)
Expand Down