# VTKFortran v3.1.0 is out: support VTKHDF, and the rest of VTK's XML file types

**URL:** <https://fortran-lang.discourse.group/t/vtkfortran-v3-1-0-is-out-support-vtkhdf-and-the-rest-of-vtks-xml-file-types/11299>\
**Category:** Announcements\
**Created:** [November 12, 2026, 8:15pm UTC](https://fortran-lang.discourse.group/t/vtkfortran-v3-1-0-is-out-support-vtkhdf-and-the-rest-of-vtks-xml-file-types/11299 "2026-11-12T20:15:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![szaghi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/szaghi/32/6974_2.png) [@szaghi](https://fortran-lang.discourse.group/u/szaghi)\
**Post date:** [November 12, 2026, 8:15pm UTC](https://fortran-lang.discourse.group/t/vtkfortran-v3-1-0-is-out-support-vtkhdf-and-the-rest-of-vtks-xml-file-types/11299/1 "2026-11-12T20:15:47Z")

</div>

## VTKFortran

 ![vtkfortran-logo](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/2/22cd18318775c5e71870a2b9f73b2b7555d180e5.png)

> Pure Fortran VTK API: XML and VTKHDF, written and read

- Documentation: [VTKFortran Documentation](https://szaghi.github.io/VTKFortran/) ([tutorial](https://szaghi.github.io/VTKFortran/manual/tutorial/01-first-file), [cookbook](https://szaghi.github.io/VTKFortran/manual/cookbook), [feature map](https://szaghi.github.io/VTKFortran/guide/features))
- GitHub: [GitHub - szaghi/VTKFortran: pure Fortran VTK (XML) API · GitHub](https://github.com/szaghi/VTKFortran)

VTKFortran is a pure modern Fortran library that writes and reads the files ParaView and VisIt open natively. You give it your mesh and your fields as plain Fortran arrays. v3.0.0 (announced [here](https://fortran-lang.discourse.group/t/vtkfortran-v3-0-0-released/11159)) added reading. v3.1.0, 95 commits later (with the help of an AI assistant), adds VTK’s HDF5 format, **VTKHDF** : a whole simulation in **one HDF5 file** , time series and MPI ranks included. It also covers the XML file types that were still missing.

![vtkhdf_mpi_series](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/5/5a5be54f3a55b5e3bd097b913ccfba9e08e48fb1.gif)

_A wave travelling along the blocks of four MPI ranks: the six steps all four ranks wrote into one `.vtkhdf` file, played by ParaView._

## VTKHDF

`format='vtkhdf'` writes one HDF5 file in the VTKHDF layout, **with the calls you already use for the XML formats**. Only the HDF5 C library is needed, bound with `iso_c_binding`: no `hdf5.mod`, so the HDF5 build need not come from your Fortran compiler (tested with HDF5 1.10 and 2.3).

- **Every topology.** Image Data, Rectilinear and Structured Grids, Unstructured Grids (polyhedra included), PolyData, Tables, OverlappingAMR and HyperTreeGrids. Point, cell, and field data of every kind, unsigned, strings as field data, active arrays (the default scalars, vectors, … that ParaView picks), and deflate compression.
- **Time series in one file.** `write_step(time=...)`, and the file is valid after every piece. A mesh that does not change, or unchanged geometry or arrays, is stored once. After a restart, `action='append'` continues the file.
- **One file from MPI ranks.** `initialize(..., comm=)` with a parallel HDF5: one partition per rank for unstructured meshes, one region per rank for grids. Time series, restarts, and polyhedra work from the ranks too, and compression for unstructured meshes. A check that fails on one rank is refused on every rank, so none is left waiting.
- **Composites.** Multi-block files and PartitionedDataSetCollections: each dataset is copied into one file, and the tree goes in an `Assembly`. Static or time series.
- **Reading back** with `action='read'`: every topology, time series step by step, AMR level by level, HyperTreeGrids tree by tree, and each dataset of a composite.

![vtkhdf_motion](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/5/597770a710e1636123f4b51e0a252ffdf84894c2.gif)

_A wave (a PolyData surface) and a buoy riding it (an Unstructured Grid), each its own time series, copied as the blocks of one multi-block VTKHDF file._

 ![vtkhdf_htg](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/a/afe28be82031d311b55ad3080cd53a24fd67610d.png)

_A HyperTreeGrid refined around a circle, coloured by depth._

## The rest of VTK’s XML file types

- **New file types** , each written and read:
  - Tables (`.vtt`) and parallel Tables (`.pvtt`);
  - HyperTreeGrids (`.htg`);
  - OverlappingAMR (`.vthb`);
  - partitioned composites (`.vtpc`, `.vtpd`);
  - blocks of pieces in a `.vtm`;
  - ParaView’s JSON file series (`.series`).

- **More data:**
  - string point and cell data and Table columns;
  - component names (`ComponentName0="u"`, …);
  - field data with several components.

- **More of what VTK writes is read:**
  - `Bit` arrays;
  - `BigEndian` files;
  - string arrays in parallel headers;
  - VTK 9.7’s polyhedra;
  - `nan`/`inf`/`-inf`.

## A taste

A time series in one file, written in two runs: the second one reopens the file and continues it, as after a restart.

```fortran
! first run: the file is created, steps 0 to 3
error = a_vtk_file%initialize(format='vtkhdf', filename='wave.vtkhdf', mesh_topology='ImageData', &
                              nx1=0, nx2=nx, ny1=0, ny2=ny, nz1=0, nz2=0, &
                              origin=[0._R8P, 0._R8P, 0._R8P], spacing=[1._R8P, 1._R8P, 1._R8P])
do s=0, 3
  error = output(time=0.25_R8P * s)
enddo
error = a_vtk_file%finalize()
! second run (a restart): the file is reopened, steps 4 to 7 follow
error = a_vtk_file%initialize(format='vtkhdf', filename='wave.vtkhdf', action='append')
do s=4, 7
  error = output(time=0.25_R8P * s)
enddo
error = a_vtk_file%finalize()

```

where each output is a step, its piece, and its array:

```fortran
error = a_vtk_file%xml_writer%write_step(time=time)
error = a_vtk_file%xml_writer%write_piece(nx1=0, nx2=nx, ny1=0, ny2=ny, nz1=0, nz2=0)
error = a_vtk_file%xml_writer%write_dataarray(location='node', action='open')
error = a_vtk_file%xml_writer%write_dataarray(data_name='wave', x=wave, one_component=.true.)
error = a_vtk_file%xml_writer%write_dataarray(location='node', action='close')
error = a_vtk_file%xml_writer%write_piece()

```

```plaintext
wave.vtkhdf: 8 steps, at the times
 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75

```

![vtkhdf_series](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/d/ddb5af16bee6156b5893ee53334f5fcb77070747.gif)

## How it is checked

- **VTK is the judge.** Each feature was checked by having VTK 9.7.2 read the files the library writes, and the library read files VTK writes. The VTKHDF files of the tests are read by VTK and compared, value by value, with the same data written as XML, step by step for the time series. ParaView 6.1.1 plays the series.
- **Honest limits:** ParaView 6.1 does not read VTKHDF Rectilinear and Structured Grids, Tables, or OverlappingAMR (VTK 9.7 does); the feature map says so for each.
- **Tests:** 45 test programs, run on every push with and without HDF5, serial and on 4 MPI ranks. The library is tested with GNU gfortran 14 and 16.2, Intel ifx 2025.3, and NVIDIA nvfortran 26.9, and every test passes with each.
- **Docs:** every snippet, output, and ParaView render in the documentation comes from a program that is compiled and run. Nothing is typed by hand.

* * *

VTKFortran builds with FoBiS, fpm and CMake; HDF5 (VTKHDF), MPI and zlib are optional. It is multi-licensed (GPL v3, BSD 2-Clause, BSD 3-Clause, MIT): pick the one that fits you.

Coming next: LZ4 and LZMA compression ([#91](https://github.com/szaghi/VTKFortran/issues/91)).

Feedback, issues, and contributions are welcome.

Stefano
