kspaceFirstOrder3D-CUDA  1.1
The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TBaseOutputHDF5Stream Class Referenceabstract

Abstract base class for output data streams (sampled data). More...

#include <BaseOutputHDF5Stream.h>

Inheritance diagram for TBaseOutputHDF5Stream:
Collaboration diagram for TBaseOutputHDF5Stream:

Public Types

enum  TReduceOperator { NONE, RMS, MAX, MIN }
 How to aggregate data. More...
 

Public Member Functions

 TBaseOutputHDF5Stream (THDF5_File &file, TMatrixName &rootObjectName, const TRealMatrix &sourceMatrix, const TReduceOperator reduceOp)
 Constructor. More...
 
virtual ~TBaseOutputHDF5Stream ()
 Destructor.
 
virtual void Create ()=0
 Create a HDF5 stream and allocate data for it.
 
virtual void Reopen ()=0
 Reopen the output stream after restart.
 
virtual void Sample ()=0
 Sample data into buffer, apply reduction - based on a sensor mask (no data flushed to disk).
 
virtual void FlushRaw ()=0
 Flush raw data to disk.
 
virtual void PostProcess ()
 Apply post-processing on the buffer and flush it to the file. More...
 
virtual void Checkpoint ()=0
 Checkpoint the stream.
 
virtual void Close ()=0
 Close stream (apply post-processing if necessary, flush data and close).
 

Protected Member Functions

 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...
 
virtual void CopyDataToDevice ()
 Copy data hostBuffer-> deviceBuffer. More...
 
virtual void CopyDataFromDevice ()
 Copy data deviceBuffer -> hostBuffer. More...
 

Protected Attributes

THDF5_Filefile
 HDF5 file handle.
 
std::string rootObjectName
 Dataset name.
 
const TRealMatrixsourceMatrix
 Source matrix to be sampled.
 
hid_t dataset
 HDF5 dataset handle.
 
const TReduceOperator reduceOp
 Reduce operator.
 
TDimensionSizes position
 Position in the dataset.
 
size_t bufferSize
 Buffer size.
 
float * hostBuffer
 Temporary buffer for store on the GPU side.
 
float * deviceBuffer
 Temporary buffer on the GPU side - only for aggregated quantities.
 

Static Protected Attributes

static const size_t CHUNK_SIZE_4MB = 1048576
 chunk size of 4MB in number of float elements
 
static const size_t MIN_GRIDPOINTS_TO_SAMPLE_IN_PARALLEL = 1048576
 The minimum number of elements to start sampling in parallel (4MB)
 

Detailed Description

Abstract base class for output data streams (sampled data).

Definition at line 46 of file BaseOutputHDF5Stream.h.

Member Enumeration Documentation

How to aggregate data.

Enumerator
NONE 

store actual data (time series)

RMS 

calculate root mean square

MAX 

store maximum

MIN 

store minimum

Definition at line 54 of file BaseOutputHDF5Stream.h.

Constructor & Destructor Documentation

TBaseOutputHDF5Stream::TBaseOutputHDF5Stream ( THDF5_File file,
TMatrixName rootObjectName,
const TRealMatrix sourceMatrix,
const TReduceOperator  reduceOp 
)

Constructor - there is no sensor mask by default! it links the HDF5 dataset, source (sampled matrix) and the reduce 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.

Parameters
[in]file- Handle to the HDF5 (output) file
[in]rootObjectName- The root object that stores the sample data (dataset or group)
[in]sourceMatrix- The source matrix (only real matrices are supported)
[in]reduceOp- Reduce operator

Definition at line 63 of file BaseOutputHDF5Stream.cpp.

Member Function Documentation

void TBaseOutputHDF5Stream::AllocateMemory ( )
protectedvirtual

Allocate memory using proper memory alignment.

Warning
- This can routine is not used in the base class (should be used in derived ones).

Definition at line 124 of file BaseOutputHDF5Stream.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TBaseOutputHDF5Stream::CopyDataFromDevice ( )
protectedvirtual

Copy data deviceBuffer -> hostBuffer

Definition at line 245 of file BaseOutputHDF5Stream.cpp.

Here is the caller graph for this function:

void TBaseOutputHDF5Stream::CopyDataToDevice ( )
protectedvirtual

Copy data hostBuffer -> deviceBuffer

Definition at line 231 of file BaseOutputHDF5Stream.cpp.

Here is the caller graph for this function:

void TBaseOutputHDF5Stream::FreeMemory ( )
protectedvirtual

Free memory.

Warning
- This can routine is not used in the base class (should be used in derived ones).

Definition at line 209 of file BaseOutputHDF5Stream.cpp.

Here is the caller graph for this function:

void TBaseOutputHDF5Stream::PostProcess ( )
virtual

Apply post-processing on the buffer (Done on the GPU side as well).

Reimplemented in TCuboidOutputHDF5Stream, TIndexOutputHDF5Stream, and TWholeDomainOutputHDF5Stream.

Definition at line 80 of file BaseOutputHDF5Stream.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


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