Advanced Multi-Physics (AMP)
On-Line Documentation
Classes | Enumerations | Functions
AMP::IO Namespace Reference

Classes

class  AsciiWriter
 A class used to abstract away reading/writing files. More...
 
class  HDF5data
 Class to wrap HDF5 data. More...
 
class  HDF5writer
 A class used to abstract away reading/writing files for visualization. More...
 
class  NullWriter
 A class used to abstract away reading/writing files for visualization. More...
 
class  RestartManager
 Class to manage reading/writing restart data. More...
 
class  SiloIO
 A class used to abstract away reading/writing files for visualization. More...
 
class  Writer
 A class used to abstract away reading/writing files. More...
 

Enumerations

enum class  Compression : uint8_t { None , GZIP , SZIP }
 

Functions

void closeDataset (hid_t fid)
 Close a dataset.
 
void closeDataspace (hid_t fid)
 Close a dataspace.
 
void closeDatatype (hid_t fid)
 Close a datatype.
 
void closeGroup (hid_t fid)
 Close a group.
 
void closeHDF5 (hid_t fid, bool printLeaks=false)
 Open an HDF5 file.
 
hid_t createChunk (AMP::ArraySize dims, Compression compress, size_t objSize=0)
 Open an HDF5 file.
 
hid_t createGroup (hid_t fid, const std::string &name)
 Create a group.
 
Compression defaultCompression (hid_t fid)
 Retrun the the default compression.
 
void deleteFile (const std::string &filename)
 Delete a file. If the file does not exist, nothing will happen.
 
bool exists (const std::string &filename)
 Check if a file exists and return true if it does.
 
bool fileExists (const std::string &)
 
std::string filename (const std::string &filename)
 Return the filename (strip the path)
 
size_t fileSize (const std::string &filename)
 Return the file size.
 
template<class T >
hid_t getHDF5datatype ()
 Get HDF5 data type.
 
hid_t getHDF5datatype (hid_t fid, const std::string &name)
 Get the type of a dataset.
 
std::string getSuffix (const std::string &filename)
 Get the lower case suffix for a file.
 
bool H5Dexists (hid_t fid, const std::string &name)
 Check if dataset exists.
 
bool H5Gexists (hid_t fid, const std::string &name)
 Check if group exists.
 
bool HDF5enabled ()
 Is HDF5 enabled.
 
hid_t openGroup (hid_t fid, const std::string &name, bool create=false)
 Open a group.
 
hid_t openHDF5 (const std::string &filename, const char *mode, Compression compress=Compression::None)
 Open an HDF5 file.
 
std::tuple< std::vector< hid_t >, std::vector< hid_t >, std::vector< hid_t >, std::vector< hid_t >, std::vector< hid_t > > openObjects (hid_t fid)
 list open objects
 
std::string path (const std::string &filename)
 Return the path to the file.
 
void permissions (const std::string &filename, std::filesystem::perms mode)
 Set the permissions for the file or directory.
 
template<class T >
std::unique_ptr< T > readHDF5 (hid_t fid, const std::string &name, AMP_MPI comm=AMP_COMM_SELF)
 Read a structure from HDF5.
 
void readHDF5 (hid_t fid, const std::string &name, size_t N_bytes, void *data)
 Read data from HDF5.
 
template<class T >
void readHDF5 (hid_t fid, const std::string &name, T &data)
 Read a structure from HDF5.
 
std::unique_ptr< HDF5datareadHDF5 (hid_t fid, const std::string_view &name)
 Read data from HDF5.
 
void recursiveMkdir (const std::string &, mode_t)
 
void recursiveMkdir (const std::string &, mode_t, bool)
 
void recursiveMkdir (const std::string &path)
 
void rename (const std::string &old_filename, const std::string &new_filename)
 Rename a file from old file name to new file name.
 
void renameFile (const std::string &old_filename, const std::string &new_filename)
 
template<class T >
void writeHDF5 (hid_t fid, const std::string &name, const T &data)
 Write a structure to HDF5.
 
void writeHDF5 (hid_t fid, const std::string &name, size_t N_bytes, const void *data)
 Write data to HDF5.
 

Enumeration Type Documentation

◆ Compression

enum class AMP::IO::Compression : uint8_t
strong
Enumerator
None 
GZIP 
SZIP 

Definition at line 31 of file HDF.h.

Function Documentation

◆ closeDataset()

void AMP::IO::closeDataset ( hid_t  fid)

Close a dataset.

This function closes an HDF5 dataset

Parameters
[in]fidDataset to close

◆ closeDataspace()

void AMP::IO::closeDataspace ( hid_t  fid)

Close a dataspace.

This function closes an HDF5 dataspace

Parameters
[in]fidcloseDataspace to close

◆ closeDatatype()

void AMP::IO::closeDatatype ( hid_t  fid)

Close a datatype.

This function closes an HDF5 datatype

Parameters
[in]fidDatatype to close

◆ closeGroup()

void AMP::IO::closeGroup ( hid_t  fid)

Close a group.

This function closes an HDF5 group

Parameters
[in]fidGroup to close

◆ closeHDF5()

void AMP::IO::closeHDF5 ( hid_t  fid,
bool  printLeaks = false 
)

Open an HDF5 file.

This function opens and HDF5 file for reading/writing

Parameters
[in]fidFile to open
[in]printLeaksPrint the resource leaks

◆ createChunk()

hid_t AMP::IO::createChunk ( AMP::ArraySize  dims,
Compression  compress,
size_t  objSize = 0 
)

Open an HDF5 file.

This function create a chunk for HDF5

Parameters
[in]dimsChunk size
[in]compressCompression to use
[in]objSizeOptional number of bytes of an object
Returns
Return a handle to the file.

◆ createGroup()

hid_t AMP::IO::createGroup ( hid_t  fid,
const std::string &  name 
)

Create a group.

This function creates a new HDF5 group

Parameters
[in]fidFile or group to write to
[in]nameThe name of the group

◆ defaultCompression()

Compression AMP::IO::defaultCompression ( hid_t  fid)

Retrun the the default compression.

This function returns the default compression used when the file was created

Parameters
[in]fidFile/Group id

◆ deleteFile()

void AMP::IO::deleteFile ( const std::string &  filename)

Delete a file. If the file does not exist, nothing will happen.

◆ exists()

bool AMP::IO::exists ( const std::string &  filename)

Check if a file exists and return true if it does.

◆ fileExists()

bool AMP::IO::fileExists ( const std::string &  )

◆ filename()

std::string AMP::IO::filename ( const std::string &  filename)

Return the filename (strip the path)

◆ fileSize()

size_t AMP::IO::fileSize ( const std::string &  filename)

Return the file size.

◆ getHDF5datatype() [1/2]

template<class T >
hid_t AMP::IO::getHDF5datatype ( )

Get HDF5 data type.

This function returns the id of the data type

◆ getHDF5datatype() [2/2]

hid_t AMP::IO::getHDF5datatype ( hid_t  fid,
const std::string &  name 
)

Get the type of a dataset.

This function returns the type of a dataset

Parameters
[in]fidFile or group to write to
[in]nameThe name of the group

◆ getSuffix()

std::string AMP::IO::getSuffix ( const std::string &  filename)

Get the lower case suffix for a file.

◆ H5Dexists()

bool AMP::IO::H5Dexists ( hid_t  fid,
const std::string &  name 
)

Check if dataset exists.

This function checks if an HDF5 dataset exists in the file

Parameters
[in]fidFile to open
[in]nameThe name of the dataset

◆ H5Gexists()

bool AMP::IO::H5Gexists ( hid_t  fid,
const std::string &  name 
)

Check if group exists.

This function checks if an HDF5 group exists in the file

Parameters
[in]fidID of group or database to read
[in]nameThe name of the group

◆ HDF5enabled()

bool AMP::IO::HDF5enabled ( )

Is HDF5 enabled.

This function returns true if HDF5 support is enabled (AMP was compiled with HDF5)

◆ openGroup()

hid_t AMP::IO::openGroup ( hid_t  fid,
const std::string &  name,
bool  create = false 
)

Open a group.

This function opens an HDF5 group

Parameters
[in]fidFile or group to write to
[in]nameThe name of the group
[in]createCreate the group if it does not exist?

◆ openHDF5()

hid_t AMP::IO::openHDF5 ( const std::string &  filename,
const char *  mode,
Compression  compress = Compression::None 
)

Open an HDF5 file.

This function opens and HDF5 file for reading/writing. Once complete, we must close the file using closeHDF5

Parameters
[in]filenameFile to open
[in]modeC string containing a file access mode. It can be: "r" read: Open file for input operations. The file must exist. "w" write: Create an empty file for output operations. If a file with the same name already exists, its contents are discarded and the file is treated as a new empty file. "rw" read+write: Open file for reading and writing. The file must exist.
[in]compressDefault compression
Returns
Return a handle to the file.

◆ openObjects()

std::tuple< std::vector< hid_t >, std::vector< hid_t >, std::vector< hid_t >, std::vector< hid_t >, std::vector< hid_t > > AMP::IO::openObjects ( hid_t  fid)

list open objects

This function closes an HDF5 group

Returns
Returns the list of open objects associated with the file: [files,datasets,groups,datatypes,attributes]
Parameters
[in]fidGroup to close

◆ path()

std::string AMP::IO::path ( const std::string &  filename)

Return the path to the file.

◆ permissions()

void AMP::IO::permissions ( const std::string &  filename,
std::filesystem::perms  mode 
)

Set the permissions for the file or directory.

◆ readHDF5() [1/4]

template<class T >
std::unique_ptr< T > AMP::IO::readHDF5 ( hid_t  fid,
const std::string &  name,
AMP_MPI  comm = AMP_COMM_SELF 
)

Read a structure from HDF5.

This function reads a C++ class/struct from HDF5. This is a templated function and users can implement their own data types by creating explicit instantiations for a given type. There is no default instantiation except when compiled without HDF5 which is a no-op.

Parameters
[in]fidFile or group to read from
[in]nameThe name of the variable
[in]commThe communicator of the object

◆ readHDF5() [2/4]

void AMP::IO::readHDF5 ( hid_t  fid,
const std::string &  name,
size_t  N_bytes,
void *  data 
)

Read data from HDF5.

This function reads a fixed number of bytes from HDF5.

Parameters
[in]fidFile or group to write to
[in]nameThe name of the variable
[in]N_bytesThe number of bytes to write
[out]dataThe data to read

◆ readHDF5() [3/4]

template<class T >
void AMP::IO::readHDF5 ( hid_t  fid,
const std::string &  name,
T &  data 
)

Read a structure from HDF5.

This function reads a C++ class/struct from HDF5. This is a templated function and users can implement their own data types by creating explicit instantiations for a given type. There is no default instantiation except when compiled without HDF5 which is a no-op.

Parameters
[in]fidFile or group to read from
[in]nameThe name of the variable
[out]dataThe structure to read

◆ readHDF5() [4/4]

std::unique_ptr< HDF5data > AMP::IO::readHDF5 ( hid_t  fid,
const std::string_view &  name 
)

Read data from HDF5.

This function reads arbitrary from HDF5. The user then requests the individual data from the class.

Parameters
[in]fidFile or group to read from
[in]nameThe name of the variable
Returns
The structure to read

◆ recursiveMkdir() [1/3]

void AMP::IO::recursiveMkdir ( const std::string &  ,
mode_t   
)

◆ recursiveMkdir() [2/3]

void AMP::IO::recursiveMkdir ( const std::string &  ,
mode_t  ,
bool   
)

◆ recursiveMkdir() [3/3]

void AMP::IO::recursiveMkdir ( const std::string &  path)

◆ rename()

void AMP::IO::rename ( const std::string &  old_filename,
const std::string &  new_filename 
)

Rename a file from old file name to new file name.

◆ renameFile()

void AMP::IO::renameFile ( const std::string &  old_filename,
const std::string &  new_filename 
)

◆ writeHDF5() [1/2]

template<class T >
void AMP::IO::writeHDF5 ( hid_t  fid,
const std::string &  name,
const T &  data 
)

Write a structure to HDF5.

This function writes a C++ class/struct to HDF5. This is a templated function and users can implement their own data types by creating explicit instantiations for a given type. There is no default instantiation except when compiled without HDF5 which is a no-op.

Parameters
[in]fidFile or group to write to
[in]nameThe name of the variable
[in]dataThe structure to write

◆ writeHDF5() [2/2]

void AMP::IO::writeHDF5 ( hid_t  fid,
const std::string &  name,
size_t  N_bytes,
const void *  data 
)

Write data to HDF5.

This function writes a fixed number of bytes from HDF5.

Parameters
[in]fidFile or group to write to
[in]nameThe name of the variable
[in]N_bytesThe number of bytes to write
[in]dataThe data to write



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page