import type { CompareResult } from "@plate-lab/core"; import { LinePlot } from "../plots/LinePlot"; import { useSharedAxis } from "../plots/useSharedAxis"; export interface CompareViewProps { cmp: CompareResult; labelA?: string; labelB?: string; } /** Side-by-side metrics and overlaid probe series for two solutions of one problem. */ export function CompareView({ cmp, labelA = "modal", labelB = "finite differences" }: CompareViewProps) { const pct = (x: number) => `${(100 * x).toFixed(2)} %`; const axis = useSharedAxis(); return (
| Quantity | {labelA} | {labelB} | relative L2 difference |
|---|---|---|---|
| Peak displacement at probe | {(cmp.w_peak_a * 1e6).toPrecision(4)} µm | {(cmp.w_peak_b * 1e6).toPrecision(4)} µm | {pct(cmp.w_rel_l2)} |
| Peak von Mises stress at probe | {(cmp.vm_peak_a * 1e-6).toPrecision(4)} MPa | {(cmp.vm_peak_b * 1e-6).toPrecision(4)} MPa | {pct(cmp.vm_rel_l2)} |
| Strongest spectral peak | {cmp.f_peak_a.toFixed(0)} Hz | {cmp.f_peak_b.toFixed(0)} Hz | – |