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
TRealMatrix Class Reference

The class for real matrices. More...

#include <RealMatrix.h>

Inheritance diagram for TRealMatrix:
Collaboration diagram for TRealMatrix:

Public Member Functions

 TRealMatrix (const TDimensionSizes &dimensionSizes)
 Constructor. More...
 
virtual ~TRealMatrix ()
 Destructor. More...
 
virtual void ReadDataFromHDF5File (THDF5_File &file, TMatrixName &matrixName)
 Read data from the HDF5 file - only from the root group. More...
 
virtual void WriteDataToHDF5File (THDF5_File &file, TMatrixName &matrixName, const size_t compressionLevel)
 Write data into the HDF5 file. More...
 
float & operator[] (const size_t &index)
 Operator []. More...
 
const float & operator[] (const size_t &index) const
 Operator [], constant version. More...
 
 TRealMatrix ()
 Default constructor is not allowed for public.
 
 TRealMatrix (const TRealMatrix &src)
 Copy constructor not allowed for public.
 
TRealMatrixoperator= (const TRealMatrix &src)
 Operator = is not allowed for public.
 
virtual void InitDimensions (const TDimensionSizes &dimensionSizes)
 Init dimension sizes. More...
 
- Public Member Functions inherited from TBaseFloatMatrix
 TBaseFloatMatrix ()
 Default constructor. More...
 
virtual TDimensionSizes GetDimensionSizes () const
 Get dimension sizes of the matrix.
 
virtual size_t GetElementCount () const
 Get element count of the matrix.
 
virtual size_t GetAllocatedElementCount () const
 Get total allocated element count (might differ from total element count used for the simulation because of padding).
 
virtual void ZeroMatrix ()
 Zero all elements of the matrix (NUMA first touch). More...
 
virtual void ScalarDividedBy (const float scalar)
 Divide scalar/ matrix_element[i]. More...
 
virtual float * GetHostData ()
 Get raw CPU data out of the class (for direct CPU kernel access).
 
virtual const float * GetHostData () const
 Get raw CPU data out of the class (for direct CPU kernel access).
 
virtual float * GetDeviceData ()
 Get raw GPU data out of the class (for direct GPU kernel access).
 
virtual const float * GetDeviceData () const
 Get raw GPU data out of the class (for direct GPU kernel access).
 
virtual void CopyToDevice ()
 Copy data from CPU -> GPU (Host -> Device). More...
 
virtual void CopyFromDevice ()
 Copy data from GPU -> CPU (Device -> Host). More...
 
- Public Member Functions inherited from TBaseMatrix
 TBaseMatrix ()
 Default constructor.
 
virtual ~TBaseMatrix ()
 Destructor.
 

Static Private Attributes

static const size_t CHUNK_SIZE_1D_4MB = 1048576
 Number of elements to get 4MB block of data.
 
static const size_t CHUNK_SIZE_1D_1MB = 262144
 Number of elements to get 1MB block of data.
 
static const size_t CHUNK_SIZE_1D_256KB = 65536
 Number of elements to get 256KB block of data.
 

Additional Inherited Members

- Protected Member Functions inherited from TBaseFloatMatrix
virtual void AllocateMemory ()
 Memory allocation (both on CPU and GPU). More...
 
virtual void FreeMemory ()
 Memory allocation (both on CPU and GPU). More...
 
 TBaseFloatMatrix (const TBaseFloatMatrix &src)
 Copy constructor is not directly allowed.
 
TBaseFloatMatrixoperator= (const TBaseFloatMatrix &src)
 Operator = is not directly allowed.
 
- Protected Attributes inherited from TBaseFloatMatrix
size_t nElements
 Total number of elements.
 
size_t nAllocatedElements
 Total number of allocated elements (in terms of floats).
 
struct TDimensionSizes dimensionSizes
 Dimension sizes.
 
size_t dataRowSize
 Size of a 1D row in X dimension.
 
size_t dataSlabSize
 Size of a 2D slab.
 
float * hostData
 Raw CPU matrix data.
 
float * deviceData
 Raw GPU matrix data.
 

Detailed Description

The class for real matrices (floats) on both CPU and GPU side

Definition at line 45 of file RealMatrix.h.

Constructor & Destructor Documentation

TRealMatrix::TRealMatrix ( const TDimensionSizes dimensionSizes)

Constructor.

Parameters
[in]dimensionSizes- Dimension sizes of the matrix

Definition at line 49 of file RealMatrix.cpp.

Here is the call graph for this function:

TRealMatrix::~TRealMatrix ( )
virtual

Destructor.

Definition at line 60 of file RealMatrix.cpp.

Here is the call graph for this function:

Member Function Documentation

void TRealMatrix::InitDimensions ( const TDimensionSizes dimensionSizes)
virtual

Set necessary dimensions and auxiliary variables.

Parameters
[in]dimensionSizes- 3D Dimension sizes

Definition at line 152 of file RealMatrix.cpp.

Here is the caller graph for this function:

float& TRealMatrix::operator[] ( const size_t &  index)
inline

Operator [].

Parameters
[in]index- 1D index
Returns
An element

Definition at line 68 of file RealMatrix.h.

const float& TRealMatrix::operator[] ( const size_t &  index) const
inline

Operator [], constant version.

Parameters
[in]index- 1D index
Returns
An element

Definition at line 79 of file RealMatrix.h.

void TRealMatrix::ReadDataFromHDF5File ( THDF5_File file,
TMatrixName matrixName 
)
virtual

Read data data from HDF5 file (only from the root group).

Parameters
[in]file- HDF5 file
[in]matrixName- HDF5 dataset name
Exceptions
ios::failureif error occurred.

Implements TBaseMatrix.

Definition at line 74 of file RealMatrix.cpp.

Here is the call graph for this function:

void TRealMatrix::WriteDataToHDF5File ( THDF5_File file,
TMatrixName matrixName,
const size_t  compressionLevel 
)
virtual

Write data to HDF5 file (only from the root group).

Parameters
[in]file- HDF5 file
[in]matrixName- HDF5 Matrix name
[in]compressionLevel- Compression level
Exceptions
ios::failureif an error occurred.

Implements TBaseMatrix.

Definition at line 102 of file RealMatrix.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: