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

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

#include <BaseIndexMatrix.h>

Inheritance diagram for BaseIndexMatrix:
Collaboration diagram for BaseIndexMatrix:

Public Member Functions

 BaseIndexMatrix ()
 Default constructor. More...
 
 BaseIndexMatrix (const BaseIndexMatrix &)=delete
 Copy constructor is not allowed.
 
virtual ~BaseIndexMatrix ()
 Destructor.
 
BaseIndexMatrixoperator= (const BaseIndexMatrix &)=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 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.
 
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 deallocation (both on CPU and GPU) More...
 

Protected Attributes

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.
 

Detailed Description

Abstract base class for index 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 49 of file BaseIndexMatrix.h.

Constructor & Destructor Documentation

◆ BaseIndexMatrix()

BaseIndexMatrix::BaseIndexMatrix ( )

Default constructor

Definition at line 54 of file BaseIndexMatrix.cpp.

Member Function Documentation

◆ allocateMemory()

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

Memory allocation based on the capacity and aligned based on kDataAlignment.

Definition at line 86 of file BaseIndexMatrix.cpp.

◆ capacity()

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

Implements BaseMatrix.

Definition at line 77 of file BaseIndexMatrix.h.

◆ freeMemory()

void BaseIndexMatrix::freeMemory ( )
protectedvirtual

Free memory.

Definition at line 105 of file BaseIndexMatrix.cpp.

◆ getData() [1/2]

virtual size_t* BaseIndexMatrix::getData ( )
inlinevirtual
Returns
Mutable matrix data

Definition at line 86 of file BaseIndexMatrix.h.

◆ getData() [2/2]

virtual const size_t* BaseIndexMatrix::getData ( ) const
inlinevirtual
Returns
Immutable matrix data.

Definition at line 92 of file BaseIndexMatrix.h.

◆ getDimensionSizes()

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

Implements BaseMatrix.

Definition at line 66 of file BaseIndexMatrix.h.

◆ size()

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

Implements BaseMatrix.

Definition at line 72 of file BaseIndexMatrix.h.

◆ zeroMatrix()

void BaseIndexMatrix::zeroMatrix ( )
virtual

Zero all allocated elements.

Definition at line 68 of file BaseIndexMatrix.cpp.


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