Opm::HDF5File Class Reference

Class handling simple output to HDF5. More...

#include <HDF5File.hpp>

Public Types

enum class  OpenMode { APPEND , OVERWRITE , READ }
 Enumeration of file opening modes. More...
 
enum class  DataSetMode { ROOT_ONLY , PROCESS_SPLIT }
 Enumeration of dataset modes. More...
 

Public Member Functions

 HDF5File (const std::string &fileName, OpenMode mode, Parallel::Communication comm)
 Opens HDF5 file for I/O. More...
 
 ~HDF5File ()
 Destructor clears up any opened files. More...
 
void write (const std::string &group, const std::string &dset, const std::vector< char > &buffer, DataSetMode mode=DataSetMode::PROCESS_SPLIT) const
 Write a char buffer to a specified location in file. More...
 
void read (const std::string &group, const std::string &dset, std::vector< char > &buffer, DataSetMode Mode=DataSetMode::PROCESS_SPLIT) const
 Read a char buffer from a specified location in file. More...
 
std::vector< std::string > list (const std::string &group) const
 Lists the entries in a given group. More...
 

Detailed Description

Class handling simple output to HDF5.

Member Enumeration Documentation

◆ DataSetMode

enum class Opm::HDF5File::DataSetMode
strong

Enumeration of dataset modes.

Enumerator
ROOT_ONLY 

A single dataset created at the root process.

PROCESS_SPLIT 

One separate data set for each parallel process.

◆ OpenMode

enum class Opm::HDF5File::OpenMode
strong

Enumeration of file opening modes.

Enumerator
APPEND 

Append to an existing file (creates new if not)

OVERWRITE 

Overwrite and write to an existing file.

READ 

Open existing file for reading.

Constructor & Destructor Documentation

◆ HDF5File()

Opm::HDF5File::HDF5File ( const std::string &  fileName,
OpenMode  mode,
Parallel::Communication  comm 
)

Opens HDF5 file for I/O.

Parameters
fileNameName of file to open
modeOpen mode for file

◆ ~HDF5File()

Opm::HDF5File::~HDF5File ( )

Destructor clears up any opened files.

Member Function Documentation

◆ list()

std::vector< std::string > Opm::HDF5File::list ( const std::string &  group) const

Lists the entries in a given group.

Note: Both datasets and subgroups are returned

◆ read()

void Opm::HDF5File::read ( const std::string &  group,
const std::string &  dset,
std::vector< char > &  buffer,
DataSetMode  Mode = DataSetMode::PROCESS_SPLIT 
) const

Read a char buffer from a specified location in file.

Parameters
groupGroup ("directory") to read data from
dsetData set ("file") to read data from
bufferVector to store read data in

Throws exception on failure

Referenced by Opm::HDF5Serializer::read().

◆ write()

void Opm::HDF5File::write ( const std::string &  group,
const std::string &  dset,
const std::vector< char > &  buffer,
DataSetMode  mode = DataSetMode::PROCESS_SPLIT 
) const

Write a char buffer to a specified location in file.

Parameters
groupGroup ("directory") to write data to
dsetData set ("file") to write data to
bufferData to write

Throws exception on failure

Referenced by Opm::HDF5Serializer::write().


The documentation for this class was generated from the following file: