Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def write(*args, **kwargs):
return meshio.xdmf.write(*args, data_format="HDF", compression="gzip", **kwargs)
lambda f, m: meshio.xdmf.write(f, m, data_format="HDF", compression="gzip"),
meshio.xdmf.read,
def write(*args, **kwargs):
return meshio.xdmf.write(*args, data_format=data_format, **kwargs)
elif fmt == "med":
med.write(
args.infile, mesh, compression="gzip", compression_opts=9 if args.max else 4
)
elif fmt == "ply":
ply.write(args.infile, mesh, binary=True)
elif fmt == "stl":
stl.write(args.infile, mesh, binary=True)
elif fmt == "vtk":
vtk.write(args.infile, mesh, binary=True)
elif fmt == "vtu":
vtu.write(
args.infile, mesh, binary=True, compression="lzma" if args.max else "zlib"
)
elif fmt == "xdmf":
xdmf.write(
args.infile,
mesh,
data_format="HDF",
compression="gzip",
compression_opts=9 if args.max else 4,
)
else:
print("Don't know how to compress {}.".format(args.infile))
exit(1)
size = os.stat(args.infile).st_size
print("File size after: {:.2f} MB".format(size / 1024 ** 2))
elif fmt == "flac3d":
flac3d.write(args.infile, mesh, binary=False)
elif fmt == "gmsh":
gmsh.write(args.infile, mesh, binary=False)
elif fmt == "mdpa":
mdpa.write(args.infile, mesh, binary=False)
elif fmt == "ply":
ply.write(args.infile, mesh, binary=False)
elif fmt == "stl":
stl.write(args.infile, mesh, binary=False)
elif fmt == "vtk":
vtk.write(args.infile, mesh, binary=False)
elif fmt == "vtu":
vtu.write(args.infile, mesh, binary=False)
elif fmt == "xdmf":
xdmf.write(args.infile, mesh, data_format="XML")
else:
print("Don't know how to convert {} to ASCII format.".format(args.infile))
exit(1)
size = os.stat(args.infile).st_size
print("File size after: {:.2f} MB".format(size / 1024 ** 2))