hmftools

HMF mesh format


Keywords
file-format, format, mesh
License
AML
Install
pip install hmftools==0.0.3

Documentation

tmf

tar + XDMF.

gh-actions Code style: black PyPi Version GitHub stars PyPi downloads

The XDMF data and mesh format is arguably one of the best mesh formats out there in terms of file size, I/O speed, and ecosystem support. There is one annoyance though that has bugged me over the years: If using the binary or HDF data type (which you should), an XDMF archive consists of multiple files. When copying things over, it is easy to miss or accidentally replace one of those.

Along comes TMF, tar + XDMF convenience format. It's just like XDMF, except that it puts all files in one: tarball, the TMF file. It also restricts itself to HDF data (which most XDMF files use anyway).

Disadvantage: Since tar is inheriently serial, all your data has to be pushed through one core and its memory. If your files are too large for that, better stick with vanilla XDMF.

This repository contains a Python package that makes working with TMF files easy. Install with

pip install tmf

and use the command-line tools

tmf-info <input-tmf>                               # print some info about the file
tmf-convert <input-mesh-file> <output-mesh-file>   # convert to/from TMF into other formats
tmf-compress <input-tmf>                           # compress the TMF file
tmf-uncompress <input-tmf>                         # uncompress the TMF file

Note that compressed TMF files (which is the default) tend to be much smaller, but require a bit longer to read. Depending on how often you need to read a file, you might want to tmf-uncompress it first.

ParaView plugin

You can use a plugin to read TMF files with ParaView. Open ParaView and go to

Tools -> Manage Plugins... -> Load New ...

and select the file paraview-tmf-plugin.py (typically installed at $HOME/.local/paraview-plugin). Also activate Auto Load.

After that, you can view any TMF file with ParaView. Note that you might have to start ParaView with

HDF5_DISABLE_VERSION_CHECK=1 paraview out.tmf

to avoid a version warning/error.

License

The code in this repository is published under the MIT license.