Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ vs_build*
*.a
*.pyc
.vscode/settings.json
target/
Cargo.lock
exec/
12 changes: 12 additions & 0 deletions output_converters/anim_to_vtk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "anim_to_vtk"
version = "0.1.0"
edition = "2021"
description = "Convert OpenRadioss animation files to legacy VTK format (ASCII or binary)"
license = "MIT"

[dependencies]
ryu = "1.0"

[dev-dependencies]
tempfile = "3"
109 changes: 89 additions & 20 deletions output_converters/anim_to_vtk/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# anim_to_vtk

anim_to_vtk is an external tool to convert OpenRadioss animation files to legacy vtk ascii format.
anim_to_vtk is an external tool to convert OpenRadioss animation files to legacy VTK format (ASCII or binary) or Universal File Format (.unv) for FEMAP / Simcenter.

## How to build

### Linux
A Rust toolchain installation is required. Install from https://rustup.rs/

gcc/g++ compiler installation requested.
### Linux

Enter the platform directory : anim_to_vtk/linux64
Apply the build script : ./build.bash
Expand All @@ -15,44 +15,113 @@ Executable will be copied in [OpenRadioss]/exec directory

### Linux ARM64

gcc/g++ compiler installation requested.

Enter the platform directory : anim_to_vtk/linuxa64
Apply the build script : ./build.bash

Executable will be copied in [OpenRadioss]/exec directory

### Windows

Visual Studio Community, Enterprise or Professional Edition installation is required.
Launch Visual Studio Shell for X86-64 Native tools.

Enter the platform directory : anim_to_vtk/win64
Apply the script : build.bat

Executable is copied in [OpenRadioss]/exec

### Using Cargo directly

From the anim_to_vtk directory:

cargo build --release

The executable will be in target/release/anim_to_vtk (or target\release\anim_to_vtk.exe on Windows).

## How to use

Apply anim_to_vtk_linux64_gf to each animation file :
### Basic Usage

The tool automatically creates output files with `.vtk` extension added to the input filename.

#### Convert a single file

Generate ASCII VTK format (default):

./anim_to_vtk_linux64_gf [Deck Rootname]A001

This creates `[Deck Rootname]A001.vtk`

To generate binary VTK format (smaller file size, faster I/O), use the `--binary` flag:

./anim_to_vtk_linux64_gf [Deck Rootname]A001 --binary

To match the legacy C++ ASCII float formatting, use `--legacy` (ASCII only):

./anim_to_vtk_linux64_gf [Deck Rootname]A001 --legacy

To generate Universal File Format (.unv) output for FEMAP / Simcenter, use the `--unv` flag:

./anim_to_vtk_linux64_gf [Deck Rootname]A001 --unv

This creates `[Deck Rootname]A001.unv`

./anim_to_vtk_linux64_gf [Deck Rootname]A001 > [Deck Rootname]_001.vtk
./anim_to_vtk_linux64_gf [Deck Rootname]A002 > [Deck Rootname]_002.vtk
...
./anim_to_vtk_linux64_gf [Deck Rootname]A002 > [Deck Rootname]_002.vtk
#### Convert multiple files

Following Linux bash script can be used to convert all files in a single task:
You can convert multiple files in a single command:

./anim_to_vtk_linux64_gf [Deck Rootname]A001 [Deck Rootname]A002 [Deck Rootname]A003

Or with binary format:

./anim_to_vtk_linux64_gf [Deck Rootname]A001 [Deck Rootname]A002 [Deck Rootname]A003 --binary

Or UNV format:

./anim_to_vtk_linux64_gf [Deck Rootname]A001 [Deck Rootname]A002 [Deck Rootname]A003 --unv

The `--binary` and `--legacy` flags can be placed anywhere in the command line arguments.

#### Convert all animation files using wildcards

Using shell wildcards to convert all animation files at once:

./anim_to_vtk_linux64_gf [Deck Rootname]A*

Or with binary format:

./anim_to_vtk_linux64_gf [Deck Rootname]A* --binary

Or convert all to UNV:

./anim_to_vtk_linux64_gf [Deck Rootname]A* --unv

### Legacy Batch Conversion Script (Optional)

The following Linux bash script can still be used for more complex batch processing:

#!/bin/bash
#
# Script to be lanch in Animation file directory
# Script to be launched in Animation file directory
#
Rootname=[Deck Rootname]
OpenRadioss_root=[Path to OpenRadioss installation]
for file in `ls ${Rootname}A*`
do
animation_number=${file#"${Rootname}A"}
${OpenRadioss_root}/exec/anim_to_vtk_linuxa64_gf $file > ${Rootname}_${animation_number}.vtk
done
# Use "--binary" for binary VTK or leave empty for ASCII VTK
FORMAT="--binary"
${OpenRadioss_root}/exec/anim_to_vtk_linuxa64_gf ${Rootname}A* ${FORMAT}

In Paraview, the vtk files are bundled and can be loaded in one step.

### Output Format Options

- **ASCII format** (default): Human-readable VTK text format, larger file size
- **Binary format** (`--binary` or `-b` flag): Compact binary VTK format with approximately 70-80% smaller file size and faster loading times in visualization software
- **Legacy formatting** (`--legacy` or `-l` flag): C++-compatible ASCII float formatting to match historical VTK output
- **Universal File Format** (`--unv` or `-u` flag): ASCII UNV output for FEMAP, Simcenter, and other FEA pre/post-processors. Uses UNV datasets 2411 (nodes), 2412 (elements), and 2414 (results). Supported element types: Rod (11), Thin Shell Tri (91), Thin Shell Quad (94), Solid Tetra (111), Solid Brick (115), Lumped Mass (161 for SPH). All nodal/elemental scalar, vector, and tensor results are exported.

## Performance

The Rust implementation is significantly faster than previous C++ implementations due to:
- Specialized number formatting libraries (ryu, itoa)
- Efficient buffered I/O strategy
- Zero-allocation data processing
- Reusable scratch buffers

For detailed performance analysis and optimization techniques, see [PERFORMANCE.md](PERFORMANCE.md).
9 changes: 5 additions & 4 deletions output_converters/anim_to_vtk/linux64/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ then
mkdir ../../../exec
fi


g++ -DLINUX -o ../../../exec/anim_to_vtk_linux64_gf ../src/anim_to_vtk.cpp
EXEC_DIR=$(cd ../../../exec && pwd)
cd ..
cargo build --release
export BUILD_RETURN_CODE=$?
if [ $BUILD_RETURN_CODE -ne 0 ]
then
echo " "
echo "Build failed"
echo " "
rm -f *.o
exit $BUILD_RETURN_CODE
fi

cp target/release/anim_to_vtk "$EXEC_DIR/anim_to_vtk_linux64_gf"

echo " "
echo "Build succeeded"
echo " "
rm -f *.o
exit 0
28 changes: 28 additions & 0 deletions output_converters/anim_to_vtk/linux64/build_rust.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#
# check if exec directory exists, create if not
#
if [ ! -d ../../../exec ]
then
mkdir ../../../exec
fi

EXEC_DIR=$(cd ../../../exec && pwd)
cd ..
cargo build --release
export BUILD_RETURN_CODE=$?
if [ $BUILD_RETURN_CODE -ne 0 ]
then
echo " "
echo "Build failed"
echo " "
exit $BUILD_RETURN_CODE
fi

cp target/release/anim_to_vtk "$EXEC_DIR/anim_to_vtk_linux64_gf"

echo " "
echo "Build succeeded"
echo " "
exit 0
9 changes: 5 additions & 4 deletions output_converters/anim_to_vtk/linuxa64/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ then
mkdir ../../../exec
fi


g++ -DLINUX -o ../../../exec/anim_to_vtk_linuxa64 ../src/anim_to_vtk.cpp
EXEC_DIR=$(cd ../../../exec && pwd)
cd ..
cargo build --release
export BUILD_RETURN_CODE=$?
if [ $BUILD_RETURN_CODE -ne 0 ]
then
echo " "
echo "Build failed"
echo " "
rm -f *.o
exit $BUILD_RETURN_CODE
fi

cp target/release/anim_to_vtk "$EXEC_DIR/anim_to_vtk_linuxa64"

echo " "
echo "Build succeeded"
echo " "
rm -f *.o
exit 0

28 changes: 28 additions & 0 deletions output_converters/anim_to_vtk/linuxa64/build_rust.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#
# check if exec directory exists, create if not
#
if [ ! -d ../../../exec ]
then
mkdir ../../../exec
fi


g++ -DLINUX -o ../../../exec/anim_to_vtk_linuxa64 ../src/anim_to_vtk.cpp
export BUILD_RETURN_CODE=$?
if [ $BUILD_RETURN_CODE -ne 0 ]
then
echo " "
echo "Build failed"
echo " "
rm -f *.o
exit $BUILD_RETURN_CODE
fi

echo " "
echo "Build succeeded"
echo " "
rm -f *.o
exit 0

Loading