kspaceFirstOrder3D-OMP  1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
BaseFloatMatrix Class Reference

Abstract base class for float based matrices defining basic interface. Higher dimensional matrices stored as 1D arrays, row-major order. More...

#include <BaseFloatMatrix.h>

Inheritance diagram for BaseFloatMatrix:
Collaboration diagram for BaseFloatMatrix:

Public Member Functions

 BaseFloatMatrix ()
 Default constructor. More...
 
 BaseFloatMatrix (const BaseFloatMatrix &)=delete
 Copy constructor is not allowed.
 
virtual ~BaseFloatMatrix ()
 Destructor.
 
BaseFloatMatrixoperator= (const BaseFloatMatrix &)=delete
 operator= is not allowed.
 
virtual const DimensionSizesgetDimensionSizes () 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 copyData (const BaseFloatMatrix &src)
 Copy data from other matrix with the same size. More...
 
virtual void zeroMatrix ()
 Zero all elements of the matrix (NUMA first touch). More...
 
virtual void scalarDividedBy (const float scalar)
 Calculate matrix = scalar / matrix. More...
 
virtual float * getData ()
 Get raw data out of the class (for direct kernel access). More...
 
virtual const float * 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.
 
BaseMatrixoperator= (const BaseMatrix &)=delete
 Operator= is not allowed.
 
virtual void readData (Hdf5File &file, MatrixName &matrixName)=0
 Read matrix from HDF5 file. More...
 
virtual void writeData (Hdf5File &file, MatrixName &matrixName, const size_t compressionLevel)=0
 Write data into HDF5 file. More...
 

Protected Member Functions

virtual void allocateMemory ()
 Aligned memory allocation (both on CPU and GPU). More...
 
virtual void freeMemory ()
 Memory allocation (both on CPU and GPU). More...
 

Protected Attributes

size_t mSize
 Total number of used elements.
 
size_t mCapacity
 Total number of allocated elements (in terms of floats).
 
DimensionSizes mDimensionSizes
 Dimension sizes.
 
size_t mRowSize
 Size of a 1D row in X dimension.
 
size_t mSlabSize
 Size of a XY slab.
 
float * mData
 Raw matrix data.
 

Detailed Description

Abstract base class for float based matrices defining basic interface. Higher dimensional matrices stored as 1D arrays, row-major order. The I/O is done via HDF5 files.

Definition at line 47 of file BaseFloatMatrix.h.

Constructor & Destructor Documentation

◆ BaseFloatMatrix()

BaseFloatMatrix::BaseFloatMatrix ( )

Default constructor.

Definition at line 56 of file BaseFloatMatrix.cpp.

Member Function Documentation

◆ allocateMemory()

void BaseFloatMatrix::allocateMemory ( )
protectedvirtual
Exceptions
std::bad_alloc- If there's not enough memory.

Memory allocation based on the capacity and aligned at kDataAlignment

Reimplemented in FftwComplexMatrix.

Definition at line 114 of file BaseFloatMatrix.cpp.

◆ capacity()

virtual size_t BaseFloatMatrix::capacity ( ) const
inlinevirtual
Returns
Capacity of the currently allocated storage.

Implements BaseMatrix.

Definition at line 75 of file BaseFloatMatrix.h.

◆ copyData()

void BaseFloatMatrix::copyData ( const BaseFloatMatrix src)
virtual
Parameters
[in]src- Matrix to copy data in.

Copy data from another matrix with same size.

Definition at line 70 of file BaseFloatMatrix.cpp.

◆ freeMemory()

void BaseFloatMatrix::freeMemory ( )
protectedvirtual

Free memory.

Reimplemented in FftwComplexMatrix.

Definition at line 133 of file BaseFloatMatrix.cpp.

◆ getData() [1/2]

virtual float* BaseFloatMatrix::getData ( )
inlinevirtual
Returns
Mutable matrix data

Definition at line 96 of file BaseFloatMatrix.h.

◆ getData() [2/2]

virtual const float* BaseFloatMatrix::getData ( ) const
inlinevirtual
Returns
Immutable matrix data.

Definition at line 102 of file BaseFloatMatrix.h.

◆ getDimensionSizes()

virtual const DimensionSizes& BaseFloatMatrix::getDimensionSizes ( ) const
inlinevirtual
Returns
Dimension sizes of the matrix.

Implements BaseMatrix.

Definition at line 65 of file BaseFloatMatrix.h.

◆ scalarDividedBy()

void BaseFloatMatrix::scalarDividedBy ( const float  scalar)
virtual
Parameters
[in]scalar- Scalar constant

Calculate matrix = scalar / matrix.

Definition at line 96 of file BaseFloatMatrix.cpp.

◆ size()

virtual size_t BaseFloatMatrix::size ( ) const
inlinevirtual
Returns
Number of elements.

Implements BaseMatrix.

Definition at line 70 of file BaseFloatMatrix.h.

◆ zeroMatrix()

void BaseFloatMatrix::zeroMatrix ( )
virtual

Zero all allocated elements in parallel for NUMA first touch.

Definition at line 83 of file BaseFloatMatrix.cpp.


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