How to use the meshplex.mesh_tetra.MeshTetra function in meshplex

To help you get started, we’ve selected a few meshplex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / meshplex / meshplex / reader.py View on Github external
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)