grid_sidecar#

Structured-grid sidecar sink.

Persists structured-grid tensordict.TensorDict objects (produced by VTISource) to disk as tensordict memmap directories. Output is written as a sidecar: by default the source’s directory layout is mirrored under output_dir using the {relpath}/{stem} naming, so each grid lands next to the mesh (.pmsh / .pdmsh) outputs for the same sample.

Reload with tensordict.TensorDict.load_memmap().

Attributes#

Classes#

GridSidecarSink

Write structured-grid TensorDicts as tensordict memmap sidecars.

Module Contents#

class physicsnemo_curator.domains.mesh.sinks.grid_sidecar.GridSidecarSink(
output_dir: str,
naming_template: str | None = None,
group_readable: bool = False,
)#

Bases: physicsnemo_curator.core.base.Sink[tensordict.TensorDict]

Write structured-grid TensorDicts as tensordict memmap sidecars.

Each grid is written to a <name>.grid directory under output_dir. When the pipeline source exposes relative_path(index) (e.g. VTISource), the default {relpath}/{stem} template mirrors the input layout so the grid sits beside the corresponding mesh outputs.

Parameters:
  • output_dir (str) – Directory where grid sidecars will be written.

  • naming_template (str or None) – Format string for output names. Placeholders: {index}, {seq}, {relpath}, {stem}. Default "{relpath}/{stem}" when the source supports it, else "grid_{index:04d}_{seq}".

  • group_readable (bool) – If True, chmod g+r the written output.

Examples

>>> pipeline = VTISource("./grids/").write(GridSidecarSink(output_dir="./out/"))
classmethod params() list[physicsnemo_curator.core.base.Param]#

Return parameter descriptors for the grid sidecar sink.

Returns:

The output_dir, naming_template, and group_readable parameters.

Return type:

list[Param]

set_source(
source: physicsnemo_curator.core.base.Source[tensordict.TensorDict],
) None#

Inject the pipeline source for placeholder resolution.

Parameters:

source (Source[TensorDict]) – The pipeline source. relative_path(index) is used when available to resolve {relpath} / {stem}.

description: ClassVar[str] = 'Write structured-grid TensorDicts as tensordict memmap sidecars'#

Short description shown in the interactive CLI.

name: ClassVar[str] = 'Grid Sidecar Writer'#

Human-readable display name for the interactive CLI.

property output_dir: pathlib.Path#

Return the output directory path.

physicsnemo_curator.domains.mesh.sinks.grid_sidecar.logger#