vti#
Structured-grid (VTK ImageData / .vti) source for mesh pipelines.
VTK ImageData describes a uniform rectilinear grid that is fully determined
by origin, spacing, and dimensions — there is no explicit point
list or connectivity. Forcing such data through the unstructured
physicsnemo.mesh.Mesh model would materialise redundant coordinates
and discard the regular lattice that grid models (CNN/U-Net/FNO) rely on.
Instead, this source reads each .vti file into a
tensordict.TensorDict of dense N-D field tensors:
point_data— a sub-TensorDict withbatch_size = [Nz, Ny, Nx]; each scalar field has shape(Nz, Ny, Nx)and each vector field(Nz, Ny, Nx, C)(VTK x-fastest ordering).cell_data— a sub-TensorDict withbatch_size = [Cz, Cy, Cx]whereCi = max(dim_i - 1, 1).grid— a non-batched sub-TensorDict carryingorigin(3,),spacing(3,),dimensions(3,, point counts), anddirection(3, 3).
The result is written as a tensordict memmap sidecar beside the mesh
outputs via
GridSidecarSink.
Classes#
Read local VTK ImageData ( |
Functions#
|
Convert a PyVista ImageData object to a structured-grid TensorDict. |
Module Contents#
- class physicsnemo_curator.domains.mesh.sources.vti.VTISource( )#
Bases:
physicsnemo_curator.core.base.Source[tensordict.TensorDict]Read local VTK ImageData (
.vti) files as structured-grid TensorDicts.Each discovered
.vtifile is converted (viaimagedata_to_griddict()) into atensordict.TensorDictof dense N-D field tensors plus grid metadata, suitable for memmap storage as a sidecar alongside mesh outputs.- Parameters:
Examples
>>> source = VTISource("./grids/") >>> grid = next(source[0]) >>> grid["point_data"].batch_size torch.Size([64, 64, 64])
- classmethod params() list[physicsnemo_curator.core.base.Param]#
Return parameter descriptors for the VTI source.
- property root: pathlib.Path#
Return the root directory of this source.
- physicsnemo_curator.domains.mesh.sources.vti.imagedata_to_griddict(
- image: Any,
- *,
- fp32: bool = False,
Convert a PyVista ImageData object to a structured-grid TensorDict.
- Parameters:
image (pyvista.ImageData) – The loaded ImageData (uniform grid).
fp32 (bool) – If
True, downcast float64 field/geometry arrays to float32.
- Returns:
A scalar-batch TensorDict with
gridmetadata and (when present)point_data/cell_datasub-TensorDicts of dense field tensors.- Return type:
TensorDict