Skip to content

Conversation

Copy link

Copilot AI commented Jan 23, 2026

Description of the feature or the bug

The th_to_csv converter (converts OpenRadioss T01 binary time-history files to CSV) existed only as a C implementation in an external repository. Need a Rust version in this repo for memory safety guarantees, simplified cross-platform builds, and improved maintainability.

Description of the changes

Created complete Rust port with feature parity to C version. 846 lines of code (48% reduction from C's 1643 lines).

Core Implementation:

  • Binary T01 parser handling Fortran record format (4-byte EOR markers, little-endian IEEE floats/ints)
  • T01 format support for all versions (3041, 3050, 4021+) with variable-length titles
  • CSV writer with impulse-to-force conversion using finite differences:
    • Central difference for interior timesteps
    • Forward/backward difference for endpoints
  • _TITLES file parser to identify impulse variables requiring force calculation
  • Variable type mapping (IE, KE, XMOM, XVEL, XF, MASS, etc.)

Project Structure:

tools/th_to_csv/
├── Cargo.toml              # Package manifest with release optimizations (LTO, codegen-units=1)
├── build.sh                # Build helper script
├── src/
│   ├── main.rs            # CLI entry point (87 LOC)
│   ├── reader.rs          # T01 binary parser with FortranReader (499 LOC)
│   ├── writer.rs          # CSV output with force conversion (164 LOC)
│   └── types.rs           # Type definitions and VarType enum (96 LOC)
├── README.md              # Build instructions
├── USAGE.md               # Comprehensive usage guide
└── TRANSLATION_SUMMARY.md # Technical comparison with C version

Key Characteristics:

  • Zero external dependencies (pure stdlib)
  • Memory safe (Rust ownership prevents buffer overflows, use-after-free, null pointer bugs)
  • Cross-platform via Cargo (Linux x86_64/ARM64, Windows, macOS)
  • 459 KB optimized binary
  • CodeQL scan: 0 security alerts

Usage:

# Build
cargo build --release

# Convert T01 to CSV
./target/release/th_to_csv simulation.T01
# Creates: simulation.T01.csv

# With custom output name
./target/release/th_to_csv simulation.T01 output_name
# Creates: output_name.csv

Updated .gitignore for Rust artifacts (target/, Cargo.lock, *.rs.bk).

Original prompt

In would like to translate the converter th_to_csv into Rust


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 23, 2026 17:10
Co-authored-by: laurent-altr <99423513+laurent-altr@users.noreply.github.com>
Co-authored-by: laurent-altr <99423513+laurent-altr@users.noreply.github.com>
Co-authored-by: laurent-altr <99423513+laurent-altr@users.noreply.github.com>
Co-authored-by: laurent-altr <99423513+laurent-altr@users.noreply.github.com>
Copilot AI changed the title [WIP] Translate converter th_to_csv into Rust Translate th_to_csv converter to Rust Jan 23, 2026
Copilot AI requested a review from laurent-altr January 23, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants