Rodin/IO/HDF5.h file

HDF5-based mesh and grid function persistence for Rodin.

This file provides the HDF5 storage backend for Rodin meshes and grid functions using the official HDF5 C API. It implements:

  • Full mesh persistence and direct reconstruction from disk, including vertex geometry, full connectivity (entities, incidences, state), attributes, and polytope transformations.
  • Standalone grid function field-file serialization (one .h5 per grid function), without mesh or finite element space embedding.
  • Utility functions for XDMF mixed-topology stream generation and minimal visualization mesh export, used by the IO::XDMF writer. These helpers (writeXDMFMesh, writeXDMFTopology, writeXDMFVertices, writeXDMFRegionAttribute, writeXDMFNodeAttribute, writeXDMFCellAttribute) write only the minimal HDF5 datasets needed by ParaView/XDMF, and are completely separate from the canonical persistence path.

HDF5 Mesh Layout

/Mesh
  /Meta
    SpaceDimension                  scalar (U64)
  /Geometry
    Vertices                        [nv × sdim] (F64)
  /Connectivity
    /Meta
      MaximalDimension              scalar (U64)
      Dimension                     scalar (U64)
    /Counts
      ByDimension                   [Dmax+1] (U64)
      ByGeometry                    [num_types] (U64)
    /Entities/{d}
      Types                         [n_d] (I32)
      Offsets                        [n_d+1] (U64)
      Indices                        [nnz] (U64)
    /State
      Present                       [(Dmax+1)×(Dmax+1)] (U8)
      Dirty                         [(Dmax+1)×(Dmax+1)] (U8)
    /Incidence/{d}_{dp}
      Offsets                        [n_d+1] (U64)
      Indices                        [nnz] (U64)
  /Attributes/{d}                   [n_d] (U64)
  /Transformations/{d}
    Kind                            [n_d] (I32)

XDMF Visualization Datasets (written by IO::XDMF via writeXDMFMesh)

/Mesh                               (visualization-only file, no canonical persistence)
  /Geometry
    Vertices                          [nv × sdim] (F64)
  /XDMF
    Topology                          [mixed_stream_size] (U64)
    TopologySize                      scalar (U64)
  /Attributes/{d}                     [n_d] (U64)

HDF5 GridFunction Layout (standalone field file)

/GridFunction
  /Meta
    Size                            scalar (U64)
    Dimension                       scalar (U64)
  /Values
    Data                            [N] (F64)

The IO classes follow the MeshLoader/MeshPrinter and GridFunctionLoader/GridFunctionPrinter API patterns established by the MFEM and MEDIT format specializations.

Namespaces

namespace Rodin
The Rodin library for finite element methods and shape optimization.
namespace Rodin::IO
Module for mesh and grid function input/output.
namespace Rodin::IO::HDF5
HDF5 utility namespace providing type aliases, path constants, RAII handle wrappers, and low-level dataset read/write helpers.
namespace Rodin::IO::HDF5::Path
HDF5 dataset path constants for the mesh and grid function storage layouts.

Classes

class Rodin::IO::HDF5::Handle
RAII wrapper for HDF5 identifier handles.
template<>
class Rodin::IO::MeshLoader<FileFormat::HDF5, Context::Local>
HDF5 mesh loader specialization for local (sequential) meshes.
template<>
class Rodin::IO::MeshPrinter<FileFormat::HDF5, Context::Local>
HDF5 mesh printer specialization for local (sequential) meshes.
template<class FES, class Scalar>
class Rodin::IO::GridFunctionLoader<FileFormat::HDF5, FES, Math::Vector<Scalar>>
HDF5 grid function loader for local grid functions backed by Math::Vector<Scalar>.
template<class FES, class Scalar>
class Rodin::IO::GridFunctionPrinter<FileFormat::HDF5, FES, Math::Vector<Scalar>>
HDF5 grid function printer for local grid functions backed by Math::Vector<Scalar>.