HDF5FrameContext Class Reference#

DiFfRG: DiFfRG::HDF5FrameContext Class Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows
DiFfRG::HDF5FrameContext Class Reference

The one place HDF5 identifiers live while a frame is being written. More...

#include <hdf5_frame.hh>

Public Member Functions

 HDF5FrameContext (const std::string &path, FrameTimings *timings=nullptr)
 
 ~HDF5FrameContext () noexcept
 
 HDF5FrameContext (const HDF5FrameContext &)=delete
 
HDF5FrameContext & operator= (const HDF5FrameContext &)=delete
 
DiFfRG::hdf5::Group & group (const std::string &name)
 
DiFfRG::hdf5::Group & root ()
 

Private Attributes

DiFfRG::hdf5::File h5_file
 
DiFfRG::hdf5::Group root_group
 
std::map< std::string, DiFfRG::hdf5::Group > open_groups
 
FrameTimings * timings
 

Detailed Description

The one place HDF5 identifiers live while a frame is being written.

Opens the file, hands out cached top-level group handles for the duration of the frame, and flushes and closes on destruction – including when an action throws, so a failed frame still leaves a closed, readable file behind.

Caching the group handles matters: a frame writes one dataset per scalar, and reopening "scalars" for each of them would turn a handful of writes into a handful of group lookups.

The context is deliberately not copyable and not shareable. HDF5 in this build is compiled without thread safety (HDF5_ENABLE_THREADSAFE=OFF, and the system HDF5 in use likewise leaves H5_HAVE_THREADSAFE undefined), so every HDF5 call in the process must be serialised. Confining the identifiers to one short-lived object owned by whoever executes the frame is what makes that a structural property rather than a review rule.

Constructor & Destructor Documentation

◆ HDF5FrameContext() [1/2]

DiFfRG::HDF5FrameContext::HDF5FrameContext ( const std::string & path,
FrameTimings * timings = nullptr )
explicit

Opens path read-write. Charges the open to timings if one is given.

◆ ~HDF5FrameContext()

DiFfRG::HDF5FrameContext::~HDF5FrameContext ( )
noexcept

◆ HDF5FrameContext() [2/2]

DiFfRG::HDF5FrameContext::HDF5FrameContext ( const HDF5FrameContext & )
delete

Member Function Documentation

◆ group()

DiFfRG::hdf5::Group & DiFfRG::HDF5FrameContext::group ( const std::string & name)

A cached handle to a top-level group, opened on first use.

◆ operator=()

HDF5FrameContext & DiFfRG::HDF5FrameContext::operator= ( const HDF5FrameContext & )
delete

◆ root()

DiFfRG::hdf5::Group & DiFfRG::HDF5FrameContext::root ( )
inline

Member Data Documentation

◆ h5_file

DiFfRG::hdf5::File DiFfRG::HDF5FrameContext::h5_file
private

◆ open_groups

std::map<std::string, DiFfRG::hdf5::Group> DiFfRG::HDF5FrameContext::open_groups
private

◆ root_group

DiFfRG::hdf5::Group DiFfRG::HDF5FrameContext::root_group
private

◆ timings

FrameTimings* DiFfRG::HDF5FrameContext::timings
private

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/data/hdf5_frame.hh