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

The class for 64b unsigned integers (indices). It is used for sensor_mask_index or sensor_corners_mask to get the address of sampled voxels. More...

#include <IndexMatrix.h>

Inheritance diagram for TIndexMatrix:
Collaboration diagram for TIndexMatrix:

Public Member Functions

 TIndexMatrix (const TDimensionSizes &dimensionSizes)
 Constructor allocating memory. More...
 
virtual ~TIndexMatrix ()
 Destructor. More...
 
virtual void ReadDataFromHDF5File (THDF5_File &file, TMatrixName &matrixName)
 Read data from the HDF5 file. More...
 
virtual void WriteDataToHDF5File (THDF5_File &file, TMatrixName &matrixName, const size_t compressionLevel)
 Write data into the HDF5 file. More...
 
size_t & operator[] (const size_t &index)
 Operator []. More...
 
const size_t & operator[] (const size_t &index) const
 Operator [], constant version. More...
 
TDimensionSizes GetTopLeftCorner (const size_t &index) const
 Get the top left corner of the index-th cuboid. More...
 
TDimensionSizes GetBottomRightCorner (const size_t &index) const
 Get the bottom right corner of the index-th cuboid. More...
 
void RecomputeIndicesToCPP ()
 Recompute indices MATALAB->C++. More...
 
void RecomputeIndicesToMatlab ()
 Recompute indices C++ -> MATLAB. More...
 
size_t GetTotalNumberOfElementsInAllCuboids () const
 Get the total number of elements to be sampled within all cuboids. More...
 
- Public Member Functions inherited from TBaseIndexMatrix
 TBaseIndexMatrix ()
 Default constructor. More...
 
virtual ~TBaseIndexMatrix ()
 Destructor.
 
virtual struct TDimensionSizes GetDimensionSizes () const
 Get dimension sizes of the matrix.
 
virtual size_t GetElementCount () const
 Get total 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 size_t * GetHostData ()
 Get raw data out of the class (for direct CPU kernel access).
 
virtual const size_t * GetHostData () const
 Get raw data out of the class (for direct CPU kernel access).
 
virtual size_t * GetDeviceData ()
 Get raw GPU data out of the class (for direct GPU kernel access).
 
virtual const size_t * 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.
 

Protected Member Functions

 TIndexMatrix ()
 Default constructor not allowed for public.
 
 TIndexMatrix (const TIndexMatrix &src)
 Copy constructor not allowed for public.
 
TIndexMatrixoperator= (const TIndexMatrix &src)
 Operator = not allowed for public.
 
- Protected Member Functions inherited from TBaseIndexMatrix
virtual void AllocateMemory ()
 Memory allocation (both on CPU and GPU) More...
 
virtual void FreeMemory ()
 Memory deallocation (both on CPU and GPU) More...
 
 TBaseIndexMatrix (const TBaseIndexMatrix &src)
 Copy constructor is not allowed for public.
 
TBaseIndexMatrixoperator= (const TBaseIndexMatrix &src)
 operator = is not allowed for public
 

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 Attributes inherited from TBaseIndexMatrix
size_t nElements
 Total number of elements.
 
size_t nAllocatedElements
 Total number of allocated elements (the array size).
 
struct TDimensionSizes dimensionSizes
 Dimension sizes.
 
size_t rowSize
 Size of 1D row in X dimension.
 
size_t slabSize
 Size of 2D slab (X,Y).
 
size_t * hostData
 Raw CPU matrix data.
 
size_t * deviceData
 Raw GPU matrix data.
 

Detailed Description

The class for 64b unsigned integers (indices). It is used for sensor_mask_index or sensor_corners_mask to get the address of sampled voxels. Stores data both GPU and CPU side.

Definition at line 46 of file IndexMatrix.h.

Constructor & Destructor Documentation

TIndexMatrix::TIndexMatrix ( const TDimensionSizes dimensionSizes)

Constructor allocating memory.

Parameters
[in]dimensionSizes- Dimension sizes

Definition at line 48 of file IndexMatrix.cpp.

Here is the call graph for this function:

TIndexMatrix::~TIndexMatrix ( )
virtual

Destructor.

Definition at line 67 of file IndexMatrix.cpp.

Here is the call graph for this function:

Member Function Documentation

TDimensionSizes TIndexMatrix::GetBottomRightCorner ( const size_t &  index) const

Get the top bottom right of the index-th cuboid. Cuboids are stored as 6-tuples (two 3D coordinates). This gives the first three coordinates. This routine works only on the CPU side.

Parameters
[in]index-Index of the cuboid
Returns
The bottom right corner

Definition at line 175 of file IndexMatrix.cpp.

Here is the caller graph for this function:

TDimensionSizes TIndexMatrix::GetTopLeftCorner ( const size_t &  index) const

Get the top left corner of the index-th cuboid. Cuboids are stored as 6-tuples (two 3D coordinates). This gives the first three coordinates.

Parameters
[in]index- Index of the cuboid
Returns
The top left corner

Definition at line 158 of file IndexMatrix.cpp.

Here is the caller graph for this function:

size_t TIndexMatrix::GetTotalNumberOfElementsInAllCuboids ( ) const

Get total number of elements in all cuboids to be able to allocate output file.

Returns
Total sampled grid points

Definition at line 217 of file IndexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

size_t& TIndexMatrix::operator[] ( const size_t &  index)
inline

Operator [].

Parameters
[in]index- 1D index into the matrix
Returns
Value of the index

Definition at line 69 of file IndexMatrix.h.

const size_t& TIndexMatrix::operator[] ( const size_t &  index) const
inline

Operator [], constant version

Parameters
[in]index- 1D index into the matrix
Returns
Value of the index

Definition at line 80 of file IndexMatrix.h.

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

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

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

Implements TBaseMatrix.

Definition at line 81 of file IndexMatrix.cpp.

Here is the call graph for this function:

void TIndexMatrix::RecomputeIndicesToCPP ( )

Recompute indeces, MATLAB -> C++.

Definition at line 189 of file IndexMatrix.cpp.

Here is the caller graph for this function:

void TIndexMatrix::RecomputeIndicesToMatlab ( )

Recompute indeces, C++ -> MATLAB.

Definition at line 202 of file IndexMatrix.cpp.

Here is the caller graph for this function:

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

Write data to HDF5 file.

Parameters
[in]file- HDF5 file handle
[in]matrixName- HDF5 dataset name
[in]compressionLevel- compression level
Exceptions
ios:failureif error occurs.

Implements TBaseMatrix.

Definition at line 107 of file IndexMatrix.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: