Skip to content

A surface with native nodal singularity strength

Preserve exact VTK panel values and attach the same-step native strength by a unique coordinate and polygon-topology match. Supply the actual recorded loads frame. Existing outputs are preserved; missing or ambiguous sources are refused.

from __future__ import annotations

import argparse
import json
from pathlib import Path

from pyflightstream import cli_entrypoint
from pyflightstream.results.surface import SurfaceFrame, translate_vtk_surface


def translate_with_native(
    vtk: Path, native: Path, output: Path, frame: dict[str, object]
) -> dict[str, object]:
    """Write a new mixed-association product with both input hashes in provenance."""
    return translate_vtk_surface(
        vtk, output, frame=SurfaceFrame.from_record(frame), native_tecplot=native
    )


@cli_entrypoint
def main() -> None:
    """Translate one pair using the supplied recorded frame."""
    parser = argparse.ArgumentParser(description=__doc__)
    for name in ("vtk", "native", "output", "frame"):
        parser.add_argument(name, type=Path)
    args = parser.parse_args()
    result = translate_with_native(
        args.vtk, args.native, args.output, json.loads(args.frame.read_text(encoding="utf-8"))
    )
    print(json.dumps(result, indent=2))


if __name__ == "__main__":
    main()