Rodin::IO namespace

Module for mesh and grid function input/output.

The IO module provides facilities for reading and writing meshes and grid functions in several formats:

Additionally, the XDMF class provides XDMF 3.0 output for scientific visualization in ParaView, supporting time series and multiple fields.

File format is specified explicitly via the FileFormat enumeration:

mesh.save("output.mesh", IO::FileFormat::MFEM);
mesh.load("domain.mesh", IO::FileFormat::MEDIT);

Namespaces

namespace HDF5
HDF5 utility namespace providing type aliases, path constants, RAII handle wrappers, and low-level dataset read/write helpers.
namespace Internal
Internal helpers for PETSc HDF5 serialization primitives.

Classes

template<FileFormat Fmt, class FES, class Data>
class GridFunctionLoader
Loader template for grid functions with specific file format.
template<class FES>
class GridFunctionLoader<FileFormat::HDF5, FES, ::Vec>
HDF5 loader for PETSc-backed grid functions.
template<class FES, class Scalar>
class GridFunctionLoader<FileFormat::HDF5, FES, Math::Vector<Scalar>>
HDF5 grid function loader for local grid functions backed by Math::Vector<Scalar>.
template<size_t K, class Range>
class GridFunctionLoader<FileFormat::MFEM, Variational::H1<K, Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
Specialization for loading H1 grid functions from MFEM format.
template<class Range>
class GridFunctionLoader<FileFormat::MFEM, Variational::P0<Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
Loader for P0 (piecewise constant) grid functions in MFEM format.
template<class Range>
class GridFunctionLoader<FileFormat::MFEM, Variational::P1<Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
Specialization for loading P1 grid functions from MFEM format.
template<FileFormat Fmt, class FES, class Data>
class GridFunctionPrinter
Printer template for grid functions with specific file format.
template<class FES>
class GridFunctionPrinter<FileFormat::HDF5, FES, ::Vec>
HDF5 printer for PETSc-backed grid functions.
template<class FES, class Scalar>
class GridFunctionPrinter<FileFormat::HDF5, FES, Math::Vector<Scalar>>
HDF5 grid function printer for local grid functions backed by Math::Vector<Scalar>.
template<class FES>
class GridFunctionPrinter<FileFormat::MEDIT, FES, ::Vec>
MEDIT printer for PETSc-backed grid functions.
template<class FES, class Scalar>
class GridFunctionPrinter<FileFormat::MFEM, FES, Math::Vector<Scalar>>
Final specialization for printing grid functions with vector data in MFEM format.
template<size_t K, class Range, class Scalar>
class GridFunctionPrinter<FileFormat::MFEM, Variational::H1<K, Range, Geometry::Mesh<Context::Local>>, Math::Vector<Scalar>>
Specialization for printing H1 grid functions with vector data in MFEM format.
template<size_t K, class Range, class Ctx>
class GridFunctionPrinter<FileFormat::MFEM, Variational::H1<K, Range, Geometry::Mesh<Ctx>>, ::Vec>
MFEM printer for PETSc-backed H1 (order $ K $ ) grid functions.
template<class Range, class Ctx>
class GridFunctionPrinter<FileFormat::MFEM, Variational::P0<Range, Geometry::Mesh<Ctx>>, ::Vec>
MFEM printer for PETSc-backed P0 grid functions.
template<class Range, class Ctx>
class GridFunctionPrinter<FileFormat::MFEM, Variational::P1<Range, Geometry::Mesh<Ctx>>, ::Vec>
MFEM printer for PETSc-backed P1 grid functions.
template<size_t K, class Range, class Context, class Data>
class GridFunctionPrinterBase<FileFormat::MFEM, Variational::H1<K, Range, Geometry::Mesh<Context>>, Data>
Base class for printing H1 (continuous Lagrange) grid functions in MFEM format.
template<class Range, class Context, class Data>
class GridFunctionPrinterBase<FileFormat::MFEM, Variational::P0<Range, Geometry::Mesh<Context>>, Data>
Base class for printing P0 (piecewise constant) grid functions in MFEM format.
template<class Range, class Context, class Data>
class GridFunctionPrinterBase<FileFormat::MFEM, Variational::P1<Range, Geometry::Mesh<Context>>, Data>
Base class for printing P1 (continuous Lagrange) grid functions in MFEM format.
template<class T>
class Loader
Base template for loading objects from files or streams.
template<FileFormat Fmt, class Trait>
class MeshLoader
Loader template for meshes with specific file format and context.
template<>
class MeshLoader<FileFormat::HDF5, Context::Local>
HDF5 mesh loader specialization for local (sequential) meshes.
template<>
class MeshLoader<FileFormat::HDF5, Context::MPI>
Loads a distributed MPI mesh from an HDF5 file.
template<>
class MeshLoader<IO::FileFormat::MEDIT, Context::Local>
Specialization for loading Sequential meshes in the MEDIT file format.
template<>
class MeshLoader<IO::FileFormat::MFEM, Context::Local>
Specialization for loading sequential meshes in MFEM format.
template<class Context>
class MeshLoaderBase
Base class for loading meshes from files or streams.
template<FileFormat Fmt, class Trait>
class MeshPrinter
Printer template for meshes with specific file format and context.
template<>
class MeshPrinter<FileFormat::HDF5, Context::Local>
HDF5 mesh printer specialization for local (sequential) meshes.
template<>
class MeshPrinter<FileFormat::HDF5, Context::MPI>
Prints a distributed MPI mesh to an HDF5 file.
template<>
class MeshPrinter<FileFormat::MFEM, Context::Local>
Specialization for printing sequential meshes in MFEM format.
template<class Context>
class MeshPrinterBase
Base class for printing meshes to streams or files.
template<class T>
class Printer
Base template for printing objects to streams.
class XDMF
XDMF domain writer for static or transient visualization output.

Enums

enum class FileFormat { MFEM, MEDIT, HDF5 }
Enumeration of supported file formats for mesh and grid function I/O.

Functions

auto toCharString(FileFormat fmt) -> const char* constexpr
Converts a FileFormat enum value to its string representation.
auto operator<<(std::ostream& os, FileFormat fmt) -> std::ostream&
Stream output operator for FileFormat enum.

Enum documentation

enum class Rodin::IO::FileFormat

Enumeration of supported file formats for mesh and grid function I/O.

This enum identifies the different file formats that can be used for reading and writing meshes and grid functions in Rodin.

Enumerators
MFEM

MFEM mesh format - native format for MFEM library.

MEDIT

MEDIT mesh format - used by MMG remeshing software.

HDF5

HDF5 hierarchical binary format for raw mesh/function storage.

Function documentation

const char* Rodin::IO::toCharString(FileFormat fmt) constexpr

Converts a FileFormat enum value to its string representation.

Parameters
fmt in File format enum value
Returns C-style string name of the format, or nullptr if invalid
Example
const char* name = toCharString(FileFormat::MFEM);  // Returns "MFEM"

std::ostream& Rodin::IO::operator<<(std::ostream& os, FileFormat fmt)

Stream output operator for FileFormat enum.

Parameters
os in/out Output stream
fmt in File format to output
Returns Reference to the output stream

Writes the string representation of the file format to the stream.

Example
std::cout << FileFormat::MEDIT;  // Outputs "MEDIT"