GEOSX
Public Member Functions | Protected Member Functions | List of all members
geosx::HDFHistIO Class Reference

Perform buffered history I/O for a single type(really just output) on using HDF5. More...

#include <TimeHistHDF.hpp>

Inheritance diagram for geosx::HDFHistIO:
Inheritance graph
[legend]

Public Member Functions

 HDFHistIO (string const &filename, localIndex rank, std::vector< localIndex > const &dims, string const &name, std::type_index typeId, localIndex writeHead=0, localIndex initAlloc=1, localIndex overallocMultiple=2, MPI_Comm comm=MPI_COMM_GEOSX)
 Constructor. More...
 
 HDFHistIO (string const &filename, const HistoryMetadata &spec, localIndex writeHead=0, localIndex initAlloc=1, localIndex overallocMultiple=2, MPI_Comm comm=MPI_COMM_GEOSX)
 Constructor. More...
 
virtual ~HDFHistIO ()
 Destructor.
 
virtual void init (bool existsOkay) override
 Perform and intialization needed for time-history output. More...
 
virtual void write () override
 Write the buffered history data to the output target. More...
 
virtual void compressInFile () override
 Ensure the repressentation of the data in the output target is dense and terse. More...
 
virtual void updateCollectingCount (localIndex count) override
 Update the number of items being stored for IO in this object. More...
 
virtual size_t getRowBytes () override
 Get the size in bytes the buffer is currently set to hold per collection operation. More...
 
- Public Member Functions inherited from geosx::BufferedHistoryIO
 BufferedHistoryIO ()
 Constructor.
 
virtual ~BufferedHistoryIO ()
 Destructor.
 
buffer_unit_typegetBufferHead ()
 Get the head of the internal history storage buffer. More...
 
localIndex getBufferedCount ()
 Query the number of history states currently stored in the internal buffer. More...
 

Protected Member Functions

void setupPartition (globalIndex localIdxCount)
 Setup the parallel 'partitioning' of the data to allow dynamically sized output over time. More...
 
void updateDatasetExtent (hsize_t rowLimit)
 Update the extent of the dataset in the target file. More...
 
void resizeFileIfNeeded (localIndex bufferedCount)
 Resize the dataspace in the target file if needed to perform the current write of buffered states. More...
 
virtual void resizeBuffer () override
 Resize the buffer to accomodate additional history collection.
 
- Protected Member Functions inherited from geosx::BufferedHistoryIO
void emptyBuffer ()
 Empty the history collection buffer.
 

Additional Inherited Members

- Protected Attributes inherited from geosx::BufferedHistoryIO
localIndex m_bufferedCount
 The current number of records in the buffer.
 
buffer_unit_typem_bufferHead
 The write head of the buffer.
 
buffer_type m_dataBuffer
 The data buffer containing the history info.
 

Detailed Description

Perform buffered history I/O for a single type(really just output) on using HDF5.

Definition at line 107 of file TimeHistHDF.hpp.

Constructor & Destructor Documentation

◆ HDFHistIO() [1/2]

geosx::HDFHistIO::HDFHistIO ( string const &  filename,
localIndex  rank,
std::vector< localIndex > const &  dims,
string const &  name,
std::type_index  typeId,
localIndex  writeHead = 0,
localIndex  initAlloc = 1,
localIndex  overallocMultiple = 2,
MPI_Comm  comm = MPI_COMM_GEOSX 
)

Constructor.

Parameters
filenameThe filename to perform history output to.
rankThe rank of the history data being collected.
dimsThe dimensional extent for each dimension of the history data being collected.
nameThe name to use to create/modify the dataset for the history data.
typeIdThe std::type_index(typeid(T)) of the underlying data type.
writeHeadHow many time history states have been written to the file (used on restart and to compress data on exit).
initAllocHow many states to preallocate the internal buffer to hold.
overallocMultipleInteger to scale the internal buffer when we fill the existing space.
commA communicator where every rank will participate in writting to the output file.

◆ HDFHistIO() [2/2]

geosx::HDFHistIO::HDFHistIO ( string const &  filename,
const HistoryMetadata spec,
localIndex  writeHead = 0,
localIndex  initAlloc = 1,
localIndex  overallocMultiple = 2,
MPI_Comm  comm = MPI_COMM_GEOSX 
)
inline

Constructor.

Parameters
filenameThe filename to perform history output to.
specHistoryMetadata to use to call the other constructor.
writeHeadHow many time states have been written to the file (used on restart and to compress data on exit).
initAllocHow many states to preallocate the internal buffer to hold.
overallocMultipleInteger to scale the internal buffer when we fill the existing space.
commA communicator where every rank will participate in writing to the output file.

Definition at line 141 of file TimeHistHDF.hpp.

Member Function Documentation

◆ compressInFile()

virtual void geosx::HDFHistIO::compressInFile ( )
overridevirtual

Ensure the repressentation of the data in the output target is dense and terse.

Note
Typically the file will be oversized to receive data writes without constant resizing.

Implements geosx::BufferedHistoryIO.

◆ getRowBytes()

virtual size_t geosx::HDFHistIO::getRowBytes ( )
overridevirtual

Get the size in bytes the buffer is currently set to hold per collection operation.

Returns
The size in bytes.

Implements geosx::BufferedHistoryIO.

◆ init()

virtual void geosx::HDFHistIO::init ( bool  existsOkay)
overridevirtual

Perform and intialization needed for time-history output.

Parameters
existsOkayWhether it is acceptable for the intended output target to already exist ( false on start from scratch, true on restart ).

Implements geosx::BufferedHistoryIO.

◆ resizeFileIfNeeded()

void geosx::HDFHistIO::resizeFileIfNeeded ( localIndex  bufferedCount)
protected

Resize the dataspace in the target file if needed to perform the current write of buffered states.

Parameters
bufferedCountThe number of buffered states to use to determine if the file needs to be resized.

◆ setupPartition()

void geosx::HDFHistIO::setupPartition ( globalIndex  localIdxCount)
protected

Setup the parallel 'partitioning' of the data to allow dynamically sized output over time.

Parameters
localIdxCountThe number of pieces of data associated with the local rank
Note
This is collective over the communicator provided in the constructor

◆ updateCollectingCount()

virtual void geosx::HDFHistIO::updateCollectingCount ( localIndex  count)
overridevirtual

Update the number of items being stored for IO in this object.

Parameters
count[in] The new number of items being collected

Implements geosx::BufferedHistoryIO.

◆ updateDatasetExtent()

void geosx::HDFHistIO::updateDatasetExtent ( hsize_t  rowLimit)
protected

Update the extent of the dataset in the target file.

Parameters
rowLimitThe new discrete 'row' count (the first output dim) to extend the extent to.
Note
The second dimension is set to the global index highwater ( the largest number of output pieces of data encountered during execution ).

◆ write()

virtual void geosx::HDFHistIO::write ( )
overridevirtual

Write the buffered history data to the output target.

Implements geosx::BufferedHistoryIO.


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