kspaceFirstOrder3D-OMP  1.1
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 All Classes Files Functions Variables Typedefs Enumerations Friends Pages
TCuboidOutputHDF5Stream Class Reference

Output stream for quantities sampled by a cuboid corner sensor mask. More...

#include <OutputHDF5Stream.h>

Inheritance diagram for TCuboidOutputHDF5Stream:
Collaboration diagram for TCuboidOutputHDF5Stream:

Classes

struct  TCuboidInfo
 This structure information about a HDF5 dataset (one cuboid). Namely, its HDF5_ID, Starting position in a lineup buffer. More...
 

Public Member Functions

 TCuboidOutputHDF5Stream (THDF5_File &HDF5_File, const char *HDF5_GroupName, const TRealMatrix &SourceMatrix, const TIndexMatrix &SensorMask, const TReductionOperator ReductionOp, float *BufferToReuse=NULL)
 Constructor - links the HDF5 File, SourceMatrix, and SensorMask together. More...
 
virtual ~TCuboidOutputHDF5Stream ()
 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 and 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 and close. More...
 
virtual void Close ()
 Close stream (apply post-processing if necessary, flush data and close). More...
 
- Public Member Functions inherited from TBaseOutputHDF5Stream
 TBaseOutputHDF5Stream (THDF5_File &HDF5_File, const char *HDF5_RootObjectName, const TRealMatrix &SourceMatrix, const TReductionOperator ReductionOp, float *BufferToReuse=NULL)
 Constructor - there is no sensor mask by default! More...
 
virtual ~TBaseOutputHDF5Stream ()
 Destructor. More...
 

Protected Member Functions

virtual hid_t CreateCuboidDataset (const size_t Index)
 Create a new dataset for a given cuboid specified by index (order). More...
 
virtual void FlushBufferToFile ()
 Flush the buffer to the file. More...
 
- Protected Member Functions inherited from TBaseOutputHDF5Stream
 TBaseOutputHDF5Stream ()
 Default constructor not allowed.
 
 TBaseOutputHDF5Stream (const TBaseOutputHDF5Stream &src)
 Copy constructor not allowed.
 
TBaseOutputHDF5Streamoperator= (const TBaseOutputHDF5Stream &src)
 Operator = not allowed (we don't want any data movements).
 
virtual void AllocateMemory ()
 A generic function to allocate memory - not used in the base class. More...
 
virtual void FreeMemory ()
 A generic function to free memory - not used in the base class. More...
 

Protected Attributes

const TIndexMatrixSensorMask
 Sensor mask to sample data.
 
hid_t HDF5_GroupId
 Handle to a HDF5 dataset.
 
std::vector< TCuboidInfoCuboidsInfo
 vector keeping handles and positions of all cuboids
 
size_t SampledTimeStep
 Timestep to store (N/A for aggregated).
 
- Protected Attributes inherited from TBaseOutputHDF5Stream
THDF5_FileHDF5_File
 HDF5 file handle.
 
char * HDF5_RootObjectName
 Dataset name.
 
const TRealMatrixSourceMatrix
 Source matrix to be sampled.
 
const TReductionOperator ReductionOp
 Reduction operator.
 
bool BufferReuse
 if true, the container reuses e.g. Temp_1_RS3D, Temp_2_RS3D, Temp_3_RS3D.
 
size_t BufferSize
 Buffer size.
 
float * StoreBuffer
 Temporary buffer for store - only if Buffer Reuse = false!
 

Additional Inherited Members

- Public Types inherited from TBaseOutputHDF5Stream
enum  TReductionOperator { roNONE, roRMS, roMAX, roMIN }
 How to aggregate data. More...
 
- Static Protected Attributes inherited from TBaseOutputHDF5Stream
static const size_t ChunkSize_4MB = 1048576
 chunk size of 4MB in number of float elements.
 
static const size_t MinGridpointsToSampleInParallel = 1048576
 The minimum number of elements to start sampling in parallel (4MB).
 

Detailed Description

Output stream for quantities sampled by a cuboid corner sensor mask. This class writes data into separated datasets (one per cuboid) under a given dataset in the HDF5 file (time-series as well as aggregations).

Definition at line 239 of file OutputHDF5Stream.h.

Constructor & Destructor Documentation

TCuboidOutputHDF5Stream::TCuboidOutputHDF5Stream ( THDF5_File HDF5_File,
const char *  HDF5_GroupName,
const TRealMatrix SourceMatrix,
const TIndexMatrix SensorMask,
const TReductionOperator  ReductionOp,
float *  BufferToReuse = NULL 
)

Constructor - links the HDF5 dataset, SourceMatrix, and SensorMask together.

Parameters
[in]HDF5_File- HDF5 file to write the output to
[in]HDF5_GroupName- The name of the HDF5 group. This group contains datasets for particular cuboids
[in]SourceMatrix- Source matrix to be sampled
[in]SensorMask- Sensor mask with the cuboid coordinates
[in]ReductionOp- Reduction operator
[in]BufferToReuse- If there is a memory space to be reused, provide a pointer

Definition at line 480 of file OutputHDF5Stream.cpp.

TCuboidOutputHDF5Stream::~TCuboidOutputHDF5Stream ( )
virtual

Destructor. 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.

Definition at line 501 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

Member Function Documentation

void TCuboidOutputHDF5Stream::Checkpoint ( )
virtual

Checkpoint the stream.

Implements TBaseOutputHDF5Stream.

Definition at line 811 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

void TCuboidOutputHDF5Stream::Close ( )
virtual

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

Implements TBaseOutputHDF5Stream.

Definition at line 823 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCuboidOutputHDF5Stream::Create ( )
virtual

Create a HDF5 stream and allocate data for it. It also creates a HDF5 group with particular datasets (one per cuboid).

Implements TBaseOutputHDF5Stream.

Definition at line 515 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

hid_t TCuboidOutputHDF5Stream::CreateCuboidDataset ( const size_t  Index)
protectedvirtual

Create a new dataset for a given cuboid specified by index (order).

Parameters
[in]Index- Index of the cuboid in the sensor mask
Returns
HDF5 handle to the dataset.

Definition at line 853 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCuboidOutputHDF5Stream::FlushBufferToFile ( )
protectedvirtual

Flush the buffer to the file (to multiple datasets if necessary).

Definition at line 907 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCuboidOutputHDF5Stream::PostProcess ( )
virtual

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

Reimplemented from TBaseOutputHDF5Stream.

Definition at line 799 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

void TCuboidOutputHDF5Stream::Reopen ( )
virtual

Reopen the output stream after restart and reload data.

Implements TBaseOutputHDF5Stream.

Definition at line 551 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:

void TCuboidOutputHDF5Stream::Sample ( )
virtual

Sample data into buffer and apply reduction, or flush to disk - based on a sensor mask.

Implements TBaseOutputHDF5Stream.

Definition at line 614 of file OutputHDF5Stream.cpp.

Here is the call graph for this function:


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