Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def read(filename):
"""Reads an unstructured mesh into meshplex format.
:param filenames: The files to read from.
:type filenames: str
:returns mesh{2,3}d: The mesh data.
"""
mesh = meshio.read(filename)
# make sure to include the used nodes only
tetra = mesh.get_cells_type("tetra")
if len(tetra) > 0:
points, cells = _sanitize(mesh.points, tetra)
return MeshTetra(points, cells)
tri = mesh.get_cells_type("triangle")
assert len(tri) > 0
points, cells = _sanitize(mesh.points, tri)
return MeshTri(points, cells)