# -*- coding: utf-8 -*-## This file is subject to the terms and conditions defined in# file 'LICENSE.txt', which is part of this source code package.#"""Universal file reader"""
[docs]defReadMesh(filename,out=None,timeToRead=-1):importpathlibfilename=pathlib.Path(filename)fromMuscat.IO.IOFactoryimportCreateReaderreader=CreateReader(filename.suffix)reader.SetFileName(filename)ifreader.canHandleTemporal:reader.ReadMetaData()reader.SetTimeToRead(timeToRead)iftimeToRead==-1:print("Reading last available time step")else:print("Reading Time")print(timeToRead)returnreader.Read()
[docs]defCheckIntegrity():importosfromMuscat.TestDataimportGetTestDataPathInitAllReaders()ReadMesh(os.path.join(GetTestDataPath(),"UtExample","cube.ut"),timeToRead=0)ReadMesh(os.path.join(GetTestDataPath(),"UtExample","cube.ut"))## Check working with pathlibimportpathlibpath=pathlib.Path(GetTestDataPath())/"UtExample"/"cube.ut"ReadMesh(path,timeToRead=0)ReadMesh(path)return"ok"
if__name__=="__main__":print(CheckIntegrity())# pragma: no cover