IFEM  90A354
Public Types | Public Member Functions | Private Attributes | List of all members
HDF5Restart Class Reference

Write and read restart data using a HDF5 file. More...

#include <HDF5Restart.h>

Inheritance diagram for HDF5Restart:
Inheritance graph
[legend]
Collaboration diagram for HDF5Restart:
Collaboration graph
[legend]

Public Types

typedef std::map< std::string, std::string > SerializeData
 Convenience type.
 

Public Member Functions

 HDF5Restart (const std::string &name, const ProcessAdm &adm, int stride=1, int level0=0)
 The constructor opens a named HDF5-file. More...
 
bool dumpStep (const TimeStep &tp)
 Returns whether or not restart data should be output. More...
 
bool writeData (const SerializeData &data)
 Writes restart data to file. More...
 
int readData (SerializeData &data, int level=-1, bool basis=false)
 Reads restart data from file. More...
 
int getTimeLevel () const
 Returns current time level.
 
- Public Member Functions inherited from HDF5Base
 HDF5Base (const std::string &name, const ProcessAdm &adm)
 The constructor opens a named HDF5-file. More...
 
virtual ~HDF5Base ()
 The destructor closes the file.
 

Private Attributes

int m_stride
 Time step stride between outputs.
 
int m_level
 Current time level for restart output.
 
int m_last
 Last time step that was written.
 

Additional Inherited Members

- Protected Member Functions inherited from HDF5Base
bool openFile (unsigned int flag)
 Opens the HDF5 file. More...
 
void closeFile ()
 Closes the HDF5 file.
 
- Protected Attributes inherited from HDF5Base
std::string m_hdf5_name
 The file name of the HDF5 file.
 

Detailed Description

Write and read restart data using a HDF5 file.

The HDF5 restart handler writes and reads data using a HDF5 file. It supports parallel I/O, and can be used to add restart capability to applications.

Constructor & Destructor Documentation

◆ HDF5Restart()

HDF5Restart::HDF5Restart ( const std::string &  name,
const ProcessAdm adm,
int  stride = 1,
int  level0 = 0 
)

The constructor opens a named HDF5-file.

Parameters
[in]nameThe name (without extension) of the data file
[in]admThe process administrator
[in]strideRestart data output stride
[in]level0Time level to start output at (in case of new restart)

References HDF5Base::m_hdf5_name.

Member Function Documentation

◆ dumpStep()

bool HDF5Restart::dumpStep ( const TimeStep tp)

Returns whether or not restart data should be output.

Parameters
[in]tpTime stepping information

References m_last, m_stride, and TimeStep::step.

Referenced by SIMSolver< T1 >::saveState().

◆ readData()

int HDF5Restart::readData ( SerializeData data,
int  level = -1,
bool  basis = false 
)

Reads restart data from file.

Parameters
[out]dataThe map to store data in
[in]levelLevel to read (-1 to read last level in file)
[in]basisIf true, read basis instead of data
Returns
Negative value on error, else restart level loaded

References HDF5Base::openFile().

Referenced by MultiStepSIM::checkForRestart(), SIMSolver< T1 >::restart(), and SIMinput::restartBasis().

◆ writeData()

bool HDF5Restart::writeData ( const SerializeData data)

Writes restart data to file.

Parameters
[in]dataData to write

References HDF5Base::closeFile(), HDF5Base::m_hdf5_name, m_level, and HDF5Base::openFile().

Referenced by SIMSolver< T1 >::saveState().


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