kspaceFirstOrder3D-OMP  1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
WholeDomainOutputStream Class Reference

Output stream for quantities sampled in the whole domain. More...

#include <WholeDomainOutputStream.h>

Inheritance diagram for WholeDomainOutputStream:
Collaboration diagram for WholeDomainOutputStream:

Public Member Functions

 WholeDomainOutputStream ()=delete
 Default constructor not allowed.
 
 WholeDomainOutputStream (Hdf5File &file, MatrixName &datasetName, const RealMatrix &sourceMatrix, const ReduceOperator reductionOp, float *bufferToReuse=nullptr)
 Constructor links the HDF5 File, SourceMatrix, and SensorMask together. More...
 
 WholeDomainOutputStream (const WholeDomainOutputStream &)=delete
 Copy constructor not allowed.
 
virtual ~WholeDomainOutputStream ()
 Destructor. More...
 
WholeDomainOutputStreamoperator= (const WholeDomainOutputStream &)=delete
 operator= is not allowed.
 
virtual void create ()
 Create a HDF5 stream and allocate data for it. More...
 
virtual void reopen ()
 Reopen the output stream after restart and reload data. More...
 
virtual void sample ()
 Sample data into buffer and apply reduction, or flush to disk (no sensor mask here). More...
 
virtual void postProcess ()
 Apply post-processing on the buffer and flush it to the file. More...
 
virtual void checkpoint ()
 Checkpoint the stream and close. More...
 
virtual void close ()
 Close stream (apply post-processing if necessary, flush data and close). More...
 
- Public Member Functions inherited from BaseOutputStream
 BaseOutputStream ()=delete
 Default constructor not allowed.
 
 BaseOutputStream (Hdf5File &file, MatrixName &rootObjectName, const RealMatrix &sourceMatrix, const ReduceOperator reduceOp, float *bufferToReuse=nullptr)
 Constructor. More...
 
 BaseOutputStream (const BaseOutputStream &src)
 Copy constructor not allowed.
 
virtual ~BaseOutputStream ()
 Destructor. More...
 
BaseOutputStreamoperator= (const BaseOutputStream &src)
 Operator = not allowed (we don't want any data movements).
 

Protected Member Functions

virtual void flushBufferToFile ()
 Flush the buffer to the file. More...
 
- Protected Member Functions inherited from BaseOutputStream
virtual void allocateMemory ()
 Allocate memory using proper memory alignment. More...
 
virtual void freeMemory ()
 Free memory. More...
 

Protected Attributes

hid_t mDataset
 Handle to a HDF5 dataset.
 
size_t mSampledTimeStep
 Time step to store (N/A for aggregated).
 
- Protected Attributes inherited from BaseOutputStream
Hdf5FilemFile
 Handle to HDF5 output file.
 
std::string mRootObjectName
 HDF5 group/dataset in the output file where to store data in.
 
const RealMatrixmSourceMatrix
 Source matrix to be sampled.
 
const ReduceOperator mReduceOp
 Reduction operator.
 
bool mBufferReuse
 if true, the container reuses another matrix as scratch place, e.g. Temp_1_RS3D, Temp_2_RS3D, Temp_3_RS3D.
 
size_t mBufferSize
 Buffer size.
 
float * mStoreBuffer
 Temporary buffer for store - only if Buffer Reuse = false!
 

Additional Inherited Members

- Public Types inherited from BaseOutputStream
enum  ReduceOperator { ReduceOperator::kNone, ReduceOperator::kRms, ReduceOperator::kMax, ReduceOperator::kMin }
 How to aggregate data. More...
 
- Static Protected Attributes inherited from BaseOutputStream
static constexpr size_t kChunkSize4MB = 1048576
 chunk size of 4MB in number of float elements.
 

Detailed Description

Output stream for quantities sampled in the whole domain. The data is stored in a single dataset (aggregated quantities only).

Definition at line 44 of file WholeDomainOutputStream.h.

Constructor & Destructor Documentation

◆ WholeDomainOutputStream()

WholeDomainOutputStream::WholeDomainOutputStream ( Hdf5File file,
MatrixName datasetName,
const RealMatrix sourceMatrix,
const ReduceOperator  reductionOp,
float *  bufferToReuse = nullptr 
)
Parameters
[in]file- HDF5 file to write the output to
[in]datasetName- The name of the HDF5 group. This group contains datasets for particular cuboids
[in]sourceMatrix- Source matrix to be sampled
[in]reductionOp- Reduction operator
[in]bufferToReuse- If there is a memory space to be reused, provide a pointer

Constructor - links the HDF5 dataset and SourceMatrix.

Parameters
[in]file- HDF5 file to write the output to
[in]datasetName- The name of the HDF5 group. This group contains datasets for particular cuboids
[in]sourceMatrix- Source matrix to be sampled
[in]reductionOp- Reduction operator
[in]bufferToReuse- If there is a memory space to be reused, provide a pointer

Definition at line 55 of file WholeDomainOutputStream.cpp.

◆ ~WholeDomainOutputStream()

WholeDomainOutputStream::~WholeDomainOutputStream ( )
virtual

Destructor.

Definition at line 71 of file WholeDomainOutputStream.cpp.

Member Function Documentation

◆ checkpoint()

void WholeDomainOutputStream::checkpoint ( )
virtual

Checkpoint the stream

Implements BaseOutputStream.

Definition at line 224 of file WholeDomainOutputStream.cpp.

◆ close()

void WholeDomainOutputStream::close ( )
virtual

Close stream (apply post-processing if necessary, flush data and close).

Implements BaseOutputStream.

Definition at line 234 of file WholeDomainOutputStream.cpp.

◆ create()

void WholeDomainOutputStream::create ( )
virtual

Create a HDF5 stream for the whole domain and allocate data for it.

Implements BaseOutputStream.

Definition at line 82 of file WholeDomainOutputStream.cpp.

◆ flushBufferToFile()

void WholeDomainOutputStream::flushBufferToFile ( )
protectedvirtual

Flush the buffer down to the file at the actual position.

Definition at line 254 of file WholeDomainOutputStream.cpp.

◆ postProcess()

void WholeDomainOutputStream::postProcess ( )
virtual

Apply post-processing on the buffer and flush it to the file.

Reimplemented from BaseOutputStream.

Definition at line 212 of file WholeDomainOutputStream.cpp.

◆ reopen()

void WholeDomainOutputStream::reopen ( )
virtual

Reopen the output stream after restart and reload data.

Implements BaseOutputStream.

Definition at line 113 of file WholeDomainOutputStream.cpp.

◆ sample()

void WholeDomainOutputStream::sample ( )
virtual

Sample all grid points, line them up in the buffer an flush to the disk unless a reduction operator is applied.

Implements BaseOutputStream.

Definition at line 148 of file WholeDomainOutputStream.cpp.


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