def get_times(reader, readPath):
"""Read the time values associated with the precursor database."""
# Grab the existing times and sort them
if reader == "foamFile":
dataDir = os.path.join(readPath, "postProcessing", "sampledSurface")
times = os.listdir(dataDir)
times = np.sort(times)
elif reader == "hdf5":
# Set the readPath to the file itself
readPath = h5py.File(readPath, 'r', driver='mpio', comm=MPI.COMM_WORLD)
times = readPath["velocity"]["times"][:]
readPath.close()
else:
raise ValueError("Unknown reader: "+reader)
return times
评论列表
文章目录