kspaceFirstOrder3D-OMP
1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
|
Output stream for quantities sampled by an index sensor mask. More...
#include <IndexOutputStream.h>
Public Member Functions | |
IndexOutputStream ()=delete | |
Default constructor not allowed. | |
IndexOutputStream (Hdf5File &file, MatrixName &datasetName, const RealMatrix &sourceMatrix, const IndexMatrix &sensorMask, const ReduceOperator reduceOp, float *bufferToReuse=nullptr) | |
Constructor links the HDF5 dataset, SourceMatrix, and SensorMask together. More... | |
IndexOutputStream (const IndexOutputStream &)=delete | |
Copy constructor not allowed. | |
virtual | ~IndexOutputStream () |
Destructor. More... | |
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, apply reduction or flush to disk - based on a sensor mask. More... | |
virtual void | postProcess () |
Apply post-processing on the buffer and flush it to the file. More... | |
virtual void | checkpoint () |
Checkpoint the stream. 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... | |
BaseOutputStream & | operator= (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 | |
const IndexMatrix & | sensorMask |
Sensor mask to sample data. | |
hid_t | mDataset |
Handle to a HDF5 dataset. | |
size_t | mSampledTimeStep |
Time step to store (N/A for aggregated). | |
Protected Attributes inherited from BaseOutputStream | |
Hdf5File & | mFile |
Handle to HDF5 output file. | |
std::string | mRootObjectName |
HDF5 group/dataset in the output file where to store data in. | |
const RealMatrix & | mSourceMatrix |
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. | |
Output stream for quantities sampled by an index sensor mask. This class writes data to a single dataset in a root group of the HDF5 file (time-series as well as aggregations).
Definition at line 44 of file IndexOutputStream.h.
IndexOutputStream::IndexOutputStream | ( | Hdf5File & | file, |
MatrixName & | datasetName, | ||
const RealMatrix & | sourceMatrix, | ||
const IndexMatrix & | sensorMask, | ||
const ReduceOperator | reduceOp, | ||
float * | bufferToReuse = nullptr |
||
) |
Constructor - links the HDF5 dataset, source (sampled matrix), Sensor mask and the reduction operator together. The constructor DOES NOT allocate memory because the size of the sensor mask is not known at the time the instance of the class is being created.
[in] | file | - Handle to the HDF5 (output) file. |
[in] | datasetName | - The dataset's name (index based sensor data is store in a single dataset). |
[in] | sourceMatrix | - The source matrix (only real matrices are supported). |
[in] | sensorMask | - Index based sensor mask. |
[in] | reduceOp | - Reduction operator. |
[in] | bufferToReuse | - An external buffer can be used to line up the grid points. |
Constructor - links the HDF5 dataset, SourceMatrix, and SensorMask together.
Definition at line 52 of file IndexOutputStream.cpp.
|
virtual |
If the file is still opened, it applies the post processing and flush the data. Then, the object memory is freed and the object destroyed.
Destructor.
Definition at line 70 of file IndexOutputStream.cpp.
|
virtual |
Checkpoint the stream and close.
Implements BaseOutputStream.
Definition at line 244 of file IndexOutputStream.cpp.
|
virtual |
Close stream (apply post-processing if necessary, flush data and close).
Implements BaseOutputStream.
Definition at line 257 of file IndexOutputStream.cpp.
|
virtual |
Create a HDF5 stream, create a dataset, and allocate data for it.
Implements BaseOutputStream.
Definition at line 81 of file IndexOutputStream.cpp.
|
protectedvirtual |
Flush the buffer down to the file at the actual position.
Definition at line 278 of file IndexOutputStream.cpp.
|
virtual |
Apply post-processing on the buffer and flush it to the file.
Reimplemented from BaseOutputStream.
Definition at line 229 of file IndexOutputStream.cpp.
|
virtual |
Reopen the output stream after restart.
Implements BaseOutputStream.
Definition at line 127 of file IndexOutputStream.cpp.
|
virtual |
Sample grid points, line them up in the buffer an flush to the disk unless a reduction operator is applied.
Implements BaseOutputStream.
Definition at line 165 of file IndexOutputStream.cpp.