kspaceFirstOrder3D-OMP
1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
|
The class for 64b unsigned integers (indices). It is used for linear and cuboid corners masks to get the address of sampled voxels. More...
#include <IndexMatrix.h>
Public Member Functions | |
IndexMatrix ()=delete | |
Default constructor not allowed. | |
IndexMatrix (const DimensionSizes &dimensionSizes) | |
Constructor. More... | |
IndexMatrix (const IndexMatrix &)=delete | |
Copy constructor not allowed. | |
virtual | ~IndexMatrix () |
Destructor. More... | |
IndexMatrix & | operator= (const IndexMatrix &) |
Operator= is not allowed. | |
virtual void | readData (Hdf5File &file, MatrixName &matrixName) |
Read matrix from HDF5 file. More... | |
virtual void | writeData (Hdf5File &file, MatrixName &matrixName, const size_t compressionLevel) |
Write data into 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... | |
DimensionSizes | getTopLeftCorner (const size_t &index) const |
Get the top left corner of the index-th cuboid. More... | |
DimensionSizes | getBottomRightCorner (const size_t &index) const |
Get the top bottom right of the index-th cuboid. More... | |
void | recomputeIndicesToCPP () |
Recompute indices MATALAB->C++. More... | |
void | recomputeIndicesToMatlab () |
Recompute indices C++ -> MATLAB. More... | |
size_t | getSizeOfAllCuboids () const |
Get total number of elements in all cuboids to be able to allocate output file. More... | |
Public Member Functions inherited from BaseIndexMatrix | |
BaseIndexMatrix () | |
Default constructor. More... | |
BaseIndexMatrix (const BaseIndexMatrix &)=delete | |
Copy constructor is not allowed. | |
virtual | ~BaseIndexMatrix () |
Destructor. | |
BaseIndexMatrix & | operator= (const BaseIndexMatrix &)=delete |
operator= is not allowed. | |
virtual const DimensionSizes & | getDimensionSizes () const |
Get dimension sizes of the matrix. More... | |
virtual size_t | size () const |
Size of the matrix. More... | |
virtual size_t | capacity () const |
The capacity of the matrix (this may differ from size due to padding, etc.). More... | |
virtual void | zeroMatrix () |
Zero all elements of the matrix (NUMA first touch). More... | |
virtual size_t * | getData () |
Get raw data out of the class (for direct kernel access). More... | |
virtual const size_t * | getData () const |
Get raw data out of the class (for direct kernel access), const version. More... | |
Public Member Functions inherited from BaseMatrix | |
BaseMatrix () | |
Default constructor. | |
BaseMatrix (const BaseMatrix &)=delete | |
Copy constructor is not allowed. | |
virtual | ~BaseMatrix () |
Destructor. | |
BaseMatrix & | operator= (const BaseMatrix &)=delete |
Operator= is not allowed. | |
Private Member Functions | |
void | initDimensions (const DimensionSizes &dimensionSizes) |
Init dimension. More... | |
Static Private Attributes | |
static constexpr size_t | kChunkSize1D4MB = 1048576 |
Number of elements to get 4MB block of data. | |
static constexpr size_t | kChunkSize1D1MB = 262144 |
Number of elements to get 1MB block of data. | |
static constexpr size_t | kChunkSize1D256kB = 65536 |
Number of elements to get 256KB block of data. | |
Additional Inherited Members | |
Protected Member Functions inherited from BaseIndexMatrix | |
virtual void | allocateMemory () |
Aligned memory allocation (both on CPU and GPU). More... | |
virtual void | freeMemory () |
Memory deallocation (both on CPU and GPU) More... | |
Protected Attributes inherited from BaseIndexMatrix | |
size_t | mSize |
Total number of elements. | |
size_t | mCapacity |
Total number of allocated elements (in terms of size_t). | |
DimensionSizes | mDimensionSizes |
Dimension sizes. | |
size_t | mRowSize |
Size of 1D row in X dimension. | |
size_t | mSlabSize |
Size of a XY slab. | |
size_t * | mData |
Raw matrix data. | |
The class for 64b unsigned integers (indices). It is used for linear and cuboid corners masks to get the get the address of sampled voxels.
Definition at line 47 of file IndexMatrix.h.
IndexMatrix::IndexMatrix | ( | const DimensionSizes & | dimensionSizes | ) |
[in] | dimensionSizes | - Dimension sizes of the matrix. |
Constructor allocating memory.
Definition at line 50 of file IndexMatrix.cpp.
|
virtual |
Destructor.
Definition at line 61 of file IndexMatrix.cpp.
DimensionSizes IndexMatrix::getBottomRightCorner | ( | const size_t & | index | ) | const |
[in] | index | - Index of the cuboid |
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.
Definition at line 156 of file IndexMatrix.cpp.
size_t IndexMatrix::getSizeOfAllCuboids | ( | ) | const |
Get total number of elements in all cuboids to be able to allocate output file.
Definition at line 195 of file IndexMatrix.cpp.
DimensionSizes IndexMatrix::getTopLeftCorner | ( | const size_t & | index | ) | const |
[in] | index | - Index of the cuboid |
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.
Definition at line 142 of file IndexMatrix.cpp.
|
private |
Set necessary dimensions and auxiliary variables.
Definition at line 218 of file IndexMatrix.cpp.
|
inline |
[in] | index | - 1D index into the matrix. |
Definition at line 92 of file IndexMatrix.h.
|
inline |
[in] | index | - 1D index into the matrix. |
Definition at line 98 of file IndexMatrix.h.
|
virtual |
Read matrix from HDF5 file.
[in] | file | - Handle to the HDF5 file |
[in] | matrixName | - HDF5 dataset name to read from |
ios::failure | - If error occurred. |
Read data from HDF5 file (only from the root group).
Implements BaseMatrix.
Definition at line 70 of file IndexMatrix.cpp.
void IndexMatrix::recomputeIndicesToCPP | ( | ) |
Recompute indeces, MATLAB -> C++.
Definition at line 169 of file IndexMatrix.cpp.
void IndexMatrix::recomputeIndicesToMatlab | ( | ) |
Recompute indeces, C++ -> MATLAB.
Definition at line 182 of file IndexMatrix.cpp.
|
virtual |
Write data into HDF5 file.
[in] | file | - Handle to the HDF5 file |
[in] | matrixName | - HDF5 dataset name to write to |
[in] | compressionLevel | - Compression level for the HDF5 dataset |
ios::failure | - If an error occurred. |
Write data to HDF5 file.
Implements BaseMatrix.
Definition at line 94 of file IndexMatrix.cpp.