WARPXM v1.10.0
Loading...
Searching...
No Matches
WxHdf5Io Class Reference

WxHdf5Io is the interface for the HDF5 implementation of HDF5. More...

#include <wxhdf5io.h>

Inheritance diagram for WxHdf5Io:
WxIoBase

Detailed Description

WxHdf5Io is the interface for the HDF5 implementation of HDF5.

Public Member Functions

 WxHdf5Io (MPI_Comm mc, MPI_Info mi)
 Constructor creates the individual templated writers.
 
 WxHdf5Io (const std::string &bn, int d, MPI_Comm mc, MPI_Info mi)
 Constructor creates the individual templated writers.
 
virtual ~WxHdf5Io ()
 Virtual destructor.
 
virtual WxIoNodeType createFile (const std::string &fileName)
 Create a file.
 
virtual WxIoNodeType openFile (const std::string &fileName, const std::string &perms)
 Open a file.
 
virtual WxIoNodeType createGroup (WxIoNodeType node, const std::string &dataName) const
 Create an empty group.
 
virtual WxIoNodeType openGroup (WxIoNodeType node, const std::string &dataName) const
 Open a group.
 
virtual std::list< std::string > getGroupNames (WxIoNodeType parentNode) const
 Get list of group names under the supplied node.
 
virtual WxIoNodeType createDataSet (WxIoNodeType node, const std::string &name, const WxRange &range, const std::type_info &typeinfo) const
 Collective dataset allocation.
 
virtual WxIoNodeType createDataSet (WxIoNodeType node, const std::string &dataName) const
 Create an empty node.
 
virtual WxIoNodeType openDataSet (WxIoNodeType node, const std::string &dataName) const
 Open a node.
 
virtual void closeFile (WxIoNodeType fileNode)
 Get the top node = file node.
 
virtual void closeNode (WxIoNodeType node) const
 Close a data set.
 
void writeStrAttribute (WxIoNodeType node, const std::string &attribName, const std::string &attrib) const
 Write a string attribute.
 
void writeStrVecAttribute (WxIoNodeType node, const std::string &attribName, const std::vector< std::string > &stringsvector) const
 Write a vector of strings as attribute.
 
void readStrAttribute (WxIoNodeType node, const std::string &attribName, std::string &attrib) const
 Read a string attribute.
 
std::vector< std::string > readStrVecAttribute (WxIoNodeType node, const std::string &attribName) const
 Read a vector of strings attribute.
 
- Public Member Functions inherited from WxIoBase
virtual ~WxIoBase ()
 Virtual destructor.
 
void setBaseName (const std::string &bn)
 Set the base name.
 
std::string getBaseName ()
 Get the base name.
 
void setDumpNo (int d)
 Set the dump number.
 
int getDumpNo ()
 Get the dump number.
 
virtual WxIoNodeType createFile (const std::string &fileName)=0
 Create a file.
 
virtual WxIoNodeType createDumpFile (const std::string &dataName)
 Create a file with base name prepended and dump and suffix appended.
 
virtual WxIoNodeType openFile (const std::string &fileName, const std::string &perms)=0
 Open a file.
 
virtual WxIoNodeType openDumpFile (const std::string &dataName, const std::string &perms)
 Open a file with the base name prepended and the dump and suffix appended.
 
virtual void closeFile (WxIoNodeType fileNode)=0
 Close a file node.
 
virtual std::string getDumpFileName (const std::string &dataName)
 Get the dump name for a given data name.
 
virtual WxIoNodeType createGroup (WxIoNodeType node, const std::string &dataName) const =0
 Create an empty group.
 
virtual WxIoNodeType openGroup (WxIoNodeType node, const std::string &dataName) const =0
 Open a group.
 
virtual std::list< std::string > getGroupNames (WxIoNodeType node) const =0
 Get list of group names under the supplied node.
 
virtual WxIoNodeType createDataSet (WxIoNodeType node, const std::string &name, const WxRange &range, const std::type_info &typeinfo) const =0
 Collective dataset allocation.
 
virtual WxIoNodeType createDataSet (WxIoNodeType node, const std::string &dataName) const =0
 Create an empty node.
 
virtual WxIoNodeType openDataSet (WxIoNodeType node, const std::string &dataName) const =0
 Open a node.
 
template<typename T >
WxIoNodeType writeDataSet (WxIoNodeType node, const std::string &dataName, const std::vector< std::pair< int, int > > &fileSpaceCorners, const std::vector< std::pair< int, int > > &memorySpaceCorners, const std::vector< std::pair< int, int > > &writeSelectionCorners, const T *data) const
 Write a new data set under a node.
 
template<typename T >
void writeToDataSet (WxIoNodeType node, const WxRange &memoryRange, const WxRange &memorySubRange, const WxRange &fileRange, const WxRange &fileSubRange, const T *data) const
 Write to an open dataset (independent)
 
template<typename T >
WxIoNodeType readDataSet (WxIoNodeType node, const std::string &dataName, const std::vector< std::pair< int, int > > &memorySpaceCorners, const std::vector< std::pair< int, int > > &readSelectionCorners, T *data) const
 Read a new data set under a node.
 
template<typename T >
void readFromDataSet (WxIoNodeType node, const WxRange &memoryRange, const WxRange &memorySubRange, const WxRange &fileRange, const WxRange &fileSubRange, T *data) const
 Read from an open dataset (independent)
 
WxIoNodeType getDataShape (WxIoNodeType node, const std::string &dataSetName, WxRange &dataShape) const
 Obtain simple data shape for a data set under a node.
 
virtual void closeNode (WxIoNodeType node) const =0
 Close a data set.
 
template<typename T >
void writeAttribute (WxIoNodeType node, const std::string &attribName, const T *attrib)
 Write an attribute.
 
template<typename T >
void writeVecAttribute (WxIoNodeType node, const std::string &attribName, const std::vector< T > &attrib)
 Write an attribute (vector).
 
template<typename T >
void writeVecAttribute (WxIoNodeType node, const std::string &attribName, const T *attribStorage, int count)
 Write a vector of attributes.
 
virtual void writeStrAttribute (WxIoNodeType node, const std::string &attribName, const std::string &attrib) const =0
 Write a string attribute.
 
virtual void writeStrVecAttribute (WxIoNodeType node, const std::string &attribName, const std::vector< std::string > &stringsvector) const =0
 Write a vector of strings as attribute.
 
virtual void readStrAttribute (WxIoNodeType node, const std::string &attribName, std::string &attrib) const =0
 Read a string attribute.
 
virtual std::vector< std::string > readStrVecAttribute (WxIoNodeType node, const std::string &attribName) const =0
 Read a vector of strings attribute.
 
template<typename T >
void readAttribute (WxIoNodeType node, const std::string &attribName, T *attrib)
 Read an attribute.
 
template<typename T >
int readVecAttribute (WxIoNodeType node, const std::string &attribName, T *attribStorage, int count)
 Read a vector attribute.
 

Additional Inherited Members

- Protected Member Functions inherited from WxIoBase
 WxIoBase ()
 Default constructor - no dump, basename or suffix.
 
 WxIoBase (const std::string &sfx)
 Constructor is protected, as this class cannot be made standalone.
 
 WxIoBase (const std::string &bn, int d, const std::string &sfx)
 Constructor is protected, as this class cannot be made standalone.
 
virtual void addOpenFile (WxIoNodeType node)
 Add a file to the list of open files.
 
virtual void removeOpenFile (WxIoNodeType node)
 Remove a file from the list of open files.
 
virtual void closeOpenFiles ()
 Close any files currently open.
 
void setIo (const WxIoTmpl *b)
 Sets the new io object implementation.
 
- Protected Attributes inherited from WxIoBase
std::string suffix
 

Constructor & Destructor Documentation

◆ WxHdf5Io() [1/2]

WxHdf5Io::WxHdf5Io ( MPI_Comm  mc,
MPI_Info  mi 
)

Constructor creates the individual templated writers.

Parameters
mcthe MPI communicator
miinfo for the MPI communicator

◆ WxHdf5Io() [2/2]

WxHdf5Io::WxHdf5Io ( const std::string &  bn,
int  d,
MPI_Comm  mc,
MPI_Info  mi 
)

Constructor creates the individual templated writers.

Parameters
bnbase name for the dump
dthe dump number
mcthe MPI communicator
miinfo for the MPI communicator

◆ ~WxHdf5Io()

virtual WxHdf5Io::~WxHdf5Io ( )
virtual

Virtual destructor.

Member Function Documentation

◆ closeFile()

virtual void WxHdf5Io::closeFile ( WxIoNodeType  fileNode)
virtual

Get the top node = file node.

Implements WxIoBase.

◆ closeNode()

virtual void WxHdf5Io::closeNode ( WxIoNodeType  node) const
virtual

Close a data set.

Parameters
nodethe node to be closed

Implements WxIoBase.

◆ createDataSet() [1/2]

virtual WxIoNodeType WxHdf5Io::createDataSet ( WxIoNodeType  node,
const std::string &  dataName 
) const
virtual

Create an empty node.

Parameters
nodethe node to write under
dataNamethe name of the data
Returns
the node to the written data

Implements WxIoBase.

◆ createDataSet() [2/2]

virtual WxIoNodeType WxHdf5Io::createDataSet ( WxIoNodeType  node,
const std::string &  name,
const WxRange range,
const std::type_info &  typeinfo 
) const
virtual

Collective dataset allocation.

Parameters
nodethe node to write under
namethe name of the data
rangethe name of the data
Returns
the node to the dataset. This is not closed.

Implements WxIoBase.

◆ createFile()

virtual WxIoNodeType WxHdf5Io::createFile ( const std::string &  fileName)
virtual

Create a file.

Parameters
fileNamethe name for the file. (an extension of '.h5' is added to the supplied filename.) Assumed to be rw.
Returns
node for the file

Implements WxIoBase.

◆ createGroup()

virtual WxIoNodeType WxHdf5Io::createGroup ( WxIoNodeType  node,
const std::string &  dataName 
) const
virtual

Create an empty group.

Parameters
nodethe node to write under
dataNamethe name of the data
Returns
the node to the written data

Implements WxIoBase.

◆ getGroupNames()

virtual std::list< std::string > WxHdf5Io::getGroupNames ( WxIoNodeType  parentNode) const
virtual

Get list of group names under the supplied node.

Parameters
nodethe node to look in
Returns
list of group names found under the supplied node

Implements WxIoBase.

◆ openDataSet()

virtual WxIoNodeType WxHdf5Io::openDataSet ( WxIoNodeType  node,
const std::string &  dataName 
) const
virtual

Open a node.

Parameters
nodethe node to look in
dataNamethe name of the node to open
Returns
the node to the read data

Implements WxIoBase.

◆ openFile()

virtual WxIoNodeType WxHdf5Io::openFile ( const std::string &  fileName,
const std::string &  perms 
)
virtual

Open a file.

Parameters
fileNamethe name for the file
permsthe read and write permissions. "r" or "rw"
Returns
node for the file

Implements WxIoBase.

◆ openGroup()

virtual WxIoNodeType WxHdf5Io::openGroup ( WxIoNodeType  node,
const std::string &  dataName 
) const
virtual

Open a group.

Parameters
nodethe node to look in
dataNamethe name of the data to open
Returns
the node to the read data

Implements WxIoBase.

◆ readStrAttribute()

void WxHdf5Io::readStrAttribute ( WxIoNodeType  node,
const std::string &  attribName,
std::string &  attrib 
) const
virtual

Read a string attribute.

The string attribute data type may be a fixed length or variable length string.

Parameters
nodethe node to read under
attribNamethe name of the attribute
attribthe string value of the attribute

Implements WxIoBase.

◆ readStrVecAttribute()

std::vector< std::string > WxHdf5Io::readStrVecAttribute ( WxIoNodeType  node,
const std::string &  attribName 
) const
virtual

Read a vector of strings attribute.

Parameters
nodethe node to read under
attribNamethe name of the attribute
Returns
the vector of string values in the attribute.
Exceptions
AtttributeNotFoundExceptionif attribName is not found at node.

Implements WxIoBase.

◆ writeStrAttribute()

void WxHdf5Io::writeStrAttribute ( WxIoNodeType  node,
const std::string &  attribName,
const std::string &  attrib 
) const
virtual

Write a string attribute.

Note that the attribute data type will be a fixed size character string in a scalar dataspace.

Parameters
nodethe node to write under
attribNamethe name of the attribute
attribthe string value of the attribute

Implements WxIoBase.

◆ writeStrVecAttribute()

void WxHdf5Io::writeStrVecAttribute ( WxIoNodeType  node,
const std::string &  attribName,
const std::vector< std::string > &  stringsvector 
) const
virtual

Write a vector of strings as attribute.

Note that the strings are written out as HDF5 variable-length strings.

Parameters
nodethe node to write under
attribNamethe name of the attribute
thevector of strings for the attribute

Implements WxIoBase.


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