"""Option 2 helper - fetch the CarCrashNet crash-trajectory dataset. CarCrashNet (Elrefaie et al., CC BY-NC) releases mesh-resolved field TRAJECTORIES in VTKHDF: per-node displacement, velocity, von Mises stress, plastic strain, internal energy and erosion flags at every saved timestep, for a bumper-beam / crash-box pole-impact dataset plus three full-vehicle datasets. crash_solver.py trains a temporal surrogate on these to predict the deformation trajectory of a new design without re-running LS-DYNA / OpenRadioss. Sources (see the repo README for the exact DOIs): GitHub : https://github.com/Mohamedelrefaie/CarCrashNet Data : Harvard Dataverse / Hugging Face (VTKHDF trajectory files) This module only LOCATES / verifies the dataset; it does not scrape gated hosts. Point --dir at the folder where you downloaded the VTKHDF files. """ from __future__ import annotations import argparse import glob import os from pathlib import Path HERE = Path(__file__).parent DEST = HERE / "DrivAerNet" / "CrashTrajectories" def status(src_dir: str | None = None) -> dict: """Report how many VTKHDF trajectory files are present (in src_dir or DEST).""" root = Path(src_dir) if src_dir else DEST files = [] for ext in ("*.vtkhdf", "*.hdf", "*.h5", "*.vtu", "*.pvd"): files += glob.glob(str(root / "**" / ext), recursive=True) return {"root": str(root), "n_files": len(files), "sample": [os.path.basename(f) for f in files[:5]], "ready": len(files) > 0} if __name__ == "__main__": ap = argparse.ArgumentParser() ap.add_argument("--dir", default=None, help="folder with downloaded VTKHDF files") a = ap.parse_args() s = status(a.dir) print(f"CarCrashNet trajectories under {s['root']}: {s['n_files']} files") if s["ready"]: print(" sample:", s["sample"]) print(" -> ready: train with python -m crash_solver train --data", s["root"]) else: print(" NONE found. Download the VTKHDF trajectories from:") print(" https://github.com/Mohamedelrefaie/CarCrashNet (README -> Dataset)") print(f" then put them under {DEST} (or pass --dir).")