magnet.io.load_mesh#
- magnet.io.load_mesh(mesh_path: str, mesh_graph: Mesh | str | None = None, dim: int | None = None, get_boundary: bool = False, **kwargs) AggMesh #
Load mesh from file.
Loads mesh data from file; if the mesh graph data is not provided, it is computed on the spot.
Mesh graph can be given by a Mesh or MeshHeterogeneous object, or by a file path to a .npz file containing it.
- Parameters:
mesh_path (str) – Mesh file path.
mesh_graph (Mesh | str, optional) – Mesh object or path to an `.npz`file that contains the graph data of the mesh. If not provided, the graph data (adjacency, centroids, volumes) are computed.
dim (int, optional) – Spatial dimensions of the mesh (2 or 3). By default, inferred from the mesh vertices coordinates. Can be provided to force a lower dimensional representation (this is useful beacuse some mesh formats only allow 3D data and so a third 0 coordinate is added to 2D meshes).
**kwargs (dict[str, Any]) – Additional keywords arguments to pass to extract_boundary.
- Returns:
The loaded mesh.
- Return type: