graphlow.read#

graphlow.read(file: str | Path, backend: Literal['torch'], dtype: dtype = torch.float32, *, dimension_collection: dict[str, dict[str, float]] | None = None, device: device | str | None = None, validate_mesh: bool = False) TensorMesh[Tensor]#
graphlow.read(file: str | Path, backend: Literal['phlower'], dtype: dtype = torch.float32, *, dimension_collection: dict[str, dict[str, float]] | None = None, device: device | str | None = None, validate_mesh: bool = False) TensorMesh[pt.PhlowerTensor]

Read a mesh file into a TensorMesh.

This is a thin wrapper around graphlow.io.pyvista.from_pyvista().

Parameters:
filestr or pathlib.Path

Path to a mesh readable by PyVista/VTK (e.g. .vtu, .vtp, .vtk).

backend{“torch”, “phlower”}, default=”torch”

Backend used for tensors in the returned mesh.

dtypetorch.dtype, default=torch.float32

Floating-point dtype used by the backend tensors.

dimension_collectiondict[str, dict[str, float]] or None, optional

Optional per-array dimension metadata (for phlower_tensor). Keys correspond to grid.point_data / grid.cell_data names.

devicetorch.device or str or None, optional

Target device. Interpretation depends on the backend.

validate_mesh: bool, default=False

If True, validate the mesh using PyVista’s validate_mesh method.

Returns:
TensorMesh[torch.Tensor] or TensorMesh[pt.PhlowerTensor]

Mesh with backend tensors for points and data arrays.

Notes

To use the phlower backend, phlower_tensor must be installed.