fdtdx.export_vtr

Contents

fdtdx.export_vtr#

fdtdx.export_vtr(cell_data, filename, grid, grid_slice=None, compression_level=-1)[source]#

Export cell data to a VTR (VTK RectilinearGrid) file.

VTR is the rectilinear counterpart to VTI: it stores explicit x/y/z point coordinates and can therefore represent non-uniform cell widths without resampling. Coordinates are written from RectilinearGrid edge arrays, while cell data uses the same appended compressed binary encoding as export_vti.

Parameters:
  • cell_data (dict[str, Array]) – Dictionary mapping field names to scalar (x, y, z) arrays or vector (n, x, y, z) arrays.

  • filename (Path | str) – Output .vtr path.

  • grid (RectilinearGrid) – Rectilinear grid supplying physical edge coordinates.

  • grid_slice (tuple[slice, slice, slice] | None) – Optional spatial slice that selects a subgrid from grid.

  • compression_level (int) – zlib compression level for appended cell data.

Raises:

AssertionError – If cell data shape, dimensionality, dtype, or slice extent is incompatible with the selected grid coordinates.