kspaceFirstOrder3D-OMP
1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
|
Class implementing 3D and 1D Real-To-Complex and Complex-To-Real transforms using FFTW interface. More...
#include <FftwComplexMatrix.h>
Public Member Functions | |
FftwComplexMatrix ()=delete | |
Default constructor not allowed for public. | |
FftwComplexMatrix (const DimensionSizes &dimensionSizes) | |
Constructor, inherited from ComplexMatrix. More... | |
FftwComplexMatrix (const FftwComplexMatrix &src)=delete | |
Copy constructor not allowed for public. | |
virtual | ~FftwComplexMatrix () |
Destructor. More... | |
FftwComplexMatrix & | operator= (const FftwComplexMatrix &src) |
Operator = not allowed for public. | |
void | createR2CFftPlan3D (RealMatrix &inMatrix) |
Create FFTW plan for 3D Real-to-Complex. More... | |
void | createC2RFftPlan3D (RealMatrix &outMatrix) |
Create FFTW plan for 3D Complex-to-Real. More... | |
void | createR2CFftPlan1DX (RealMatrix &inMatrix) |
Create an FFTW plan for 1D Real-to-Complex in the x dimension. More... | |
void | createR2CFftPlan1DY (RealMatrix &inMatrix) |
Create an FFTW plan for 1D Real-to-Complex in the y dimension. More... | |
void | createR2CFftPlan1DZ (RealMatrix &inMatrix) |
Create an FFTW plan for 1D Real-to-Complex in the z dimension. More... | |
void | createC2RFftPlan1DX (RealMatrix &outMatrix) |
Create FFTW plan for Complex-to-Real in the x dimension. More... | |
void | createC2RFftPlan1DY (RealMatrix &outMatrix) |
Create FFTW plan for Complex-to-Real in the y dimension. More... | |
void | createC2RFftPlan1DZ (RealMatrix &outMatrix) |
Create FFTW plan for Complex-to-Real in the z dimension. More... | |
void | computeR2CFft3D (RealMatrix &inMatrix) |
Compute forward out-of-place 3D Real-to-Complex FFT. More... | |
void | computeC2RFft3D (RealMatrix &outMatrix) |
Compute forward out-of-place 3D Complex-to-Real FFT. More... | |
void | computeR2CFft1DX (RealMatrix &inMatrix) |
Compute 1D out-of-place Real-to-Complex FFT in the x dimension. More... | |
void | computeR2CFft1DY (RealMatrix &inMatrix) |
Compute 1D out-of-place Real-to-Complex FFT in the y dimension. More... | |
void | computeR2CFft1DZ (RealMatrix &inMatrix) |
Compute 1D out-of-place Real-to-Complex FFT in the z dimension. More... | |
void | computeC2RFft1DX (RealMatrix &outMatrix) |
Compute 1D out-of-place Complex-to-Real FFT in the x dimension. More... | |
void | computeC2RFft1DY (RealMatrix &outMatrix) |
Compute 1D out-of-place Complex-to-Real FFT in the y dimension. More... | |
void | computeC2RFft1DZ (RealMatrix &outMatrix) |
Compute 1D out-of-place Complex-to-Real FFT in the z dimension. More... | |
Public Member Functions inherited from ComplexMatrix | |
ComplexMatrix ()=delete | |
Default constructor not allowed. | |
ComplexMatrix (const DimensionSizes &dimensionSizes) | |
Constructor. More... | |
ComplexMatrix (const ComplexMatrix &)=delete | |
Copy constructor not allowed. | |
virtual | ~ComplexMatrix () |
Destructor. More... | |
ComplexMatrix & | operator= (const ComplexMatrix &) |
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... | |
virtual FloatComplex * | getComplexData () |
Get raw complex data out of the class (for direct kernel access). More... | |
virtual const FloatComplex * | getComplexData () const |
Get raw complex data out of the class (for direct kernel access). More... | |
FloatComplex & | operator[] (const size_t &index) |
Operator []. More... | |
const FloatComplex & | operator[] (const size_t &index) const |
Operator [], constant version. More... | |
FloatComplex & | GetElementFrom3D (const size_t x, const size_t y, const size_t z) |
Get element from 3D matrix. More... | |
const FloatComplex & | GetElementFrom3D (const size_t x, const size_t y, const size_t z) const |
Get element from 3D matrix, constant version. More... | |
Public Member Functions inherited from BaseFloatMatrix | |
BaseFloatMatrix () | |
Default constructor. More... | |
BaseFloatMatrix (const BaseFloatMatrix &)=delete | |
Copy constructor is not allowed. | |
virtual | ~BaseFloatMatrix () |
Destructor. | |
BaseFloatMatrix & | operator= (const BaseFloatMatrix &)=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 | 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. | |
BaseMatrix & | operator= (const BaseMatrix &)=delete |
Operator= is not allowed. | |
Static Public Member Functions | |
static void | exportWisdom () |
Export wisdom to the file. More... | |
static void | importWisdom () |
Import wisdom from the file. More... | |
static void | deleteStoredWisdom () |
Destroy wisdom in the file (delete it). More... | |
Protected Member Functions | |
virtual void | allocateMemory () |
Allocate memory for the FFTW matrix. More... | |
virtual void | freeMemory () |
Free memory of the FFTW matrix. More... | |
Static Protected Member Functions | |
static std::string | getWisdomFileName () |
Protected Attributes | |
fftwf_plan | mR2CFftPlan3D |
FFTW plan for the 3D Real-to-Complex transform. | |
fftwf_plan | mC2RFftPlan3D |
FFTW plan for the 3D Complex-to-Real transform. | |
fftwf_plan | mR2CFftPlan1DX |
FFTW plan for the 1D Real-to-Complex transform in the x dimension. | |
fftwf_plan | mR2CFftPlan1DY |
FFTW plan for the 3D Real-to-Complex transform in the y dimension. | |
fftwf_plan | mR2CFftPlan1DZ |
FFTW plan for the 3D Real-to-Complex transform in the z dimension. | |
fftwf_plan | mC2RFftPlan1DX |
FFTW plan for the 3D Complex-to-Real transform in the x dimension. | |
fftwf_plan | mC2RFftPlan1DY |
FFTW plan for the 3D Complex-to-Real transform in the y dimension. | |
fftwf_plan | mC2RFftPlan1DZ |
FFTW plan for the 3Z Complex-to-Real transform in the z dimension. | |
Protected Attributes inherited from BaseFloatMatrix | |
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. | |
Static Protected Attributes | |
static const unsigned | kFftMeasureFlag = FFTW_MEASURE |
FFTW plan flag. | |
static const std::string | kFftWisdomFileExtension = "FFTW_Wisdom" |
The file extension for FFTW wisdom. | |
Class implementing 3D and 1D Real-To-Complex and Complex-To-Real transforms using FFTW interface.
Definition at line 46 of file FftwComplexMatrix.h.
FftwComplexMatrix::FftwComplexMatrix | ( | const DimensionSizes & | dimensionSizes | ) |
[in] | dimensionSizes | - Dimension sizes of the matrix. |
Constructor.
Definition at line 54 of file FftwComplexMatrix.cpp.
|
virtual |
Destructor.
Definition at line 66 of file FftwComplexMatrix.cpp.
|
protectedvirtual |
Allocate Memory using fftwf_malloc function to ensure correct alignment.
Reimplemented from BaseFloatMatrix.
Definition at line 785 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeC2RFft1DX | ( | RealMatrix & | outMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build! The FFTW version processes the whole matrix at one while the MKL slab by slab.
[out] | outMatrix | - Output matrix |
std::runtime_error | - If the plan is not valid. |
Compute 1D out-of-place Complex-to-Real FFT in the x dimension.
Definition at line 644 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeC2RFft1DY | ( | RealMatrix & | outMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build! The FFTW version processes the whole matrix at one while the MKL slab by slab.
[out] | outMatrix | - Output matrix |
std::runtime_error | - If the plan is not valid. |
Compute 1D out-of-place Complex-to-Real FFT in the y dimension.
Definition at line 676 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeC2RFft1DZ | ( | RealMatrix & | outMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build! The FFTW version processes the whole matrix at one while the MKL slab by slab.
[out] | outMatrix | Output matrix |
std::runtime_error | - If the plan is not valid. |
Compute 1D out-of-place Complex-to-Real FFT in the Z dimension
Definition at line 708 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeC2RFft3D | ( | RealMatrix & | outMatrix | ) |
[out] | outMatrix | - Output of the inverse FFT. |
std::runtime_error | - If the plan is not valid. |
Compute inverse out-of-place 3D Complex to Real FFT.
Definition at line 532 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeR2CFft1DX | ( | RealMatrix & | inMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build! The FFTW version processes the whole matrix at one while the MKL slab by slab.
[in] | inMatrix | - Input matrix |
std::runtime_error | - If the plan is not valid. |
Compute 1D out-of-place Real-to-Complex FFT in the x dimension.
Definition at line 548 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeR2CFft1DY | ( | RealMatrix & | inMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build! The FFTW version processes the whole matrix at one while the MKL slab by slab.
[in] | inMatrix | - Input matrix |
std::runtime_error | - If the plan is not valid. |
Compute 1D out-of-place Real-to-Complex FFT in the Y dimension.
Definition at line 580 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeR2CFft1DZ | ( | RealMatrix & | inMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build! The FFTW version processes the whole matrix at one while the MKL slab by slab.
[in] | inMatrix | - Input matrix |
std::runtime_error | - If the plan is not valid. |
Compute 1D out-of-place Real-to-Complex FFT in the z dimension.
Definition at line 612 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::computeR2CFft3D | ( | RealMatrix & | inMatrix | ) |
[in] | inMatrix | - Input data for the forward FFT. |
std::runtime_error | - If the plan is not valid. |
Computer forward out-of place 3D Real-to-Complex FFT.
Definition at line 516 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createC2RFftPlan1DX | ( | RealMatrix & | outMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build!
The FFTW version processes the whole matrix at one while the MKL slab by slab.
[in,out] | outMatrix | - RealMatrix of which to create the plan. |
std::runtime_error | - If the plan can't be created. |
Create FFTW plan for Complex-to-Real in the x dimension.
Definition at line 328 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createC2RFftPlan1DY | ( | RealMatrix & | outMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build!
The FFTW version processes the whole matrix at one while the MKL slab by slab.
[in,out] | outMatrix | - RealMatrix of which to create the plan. |
std::runtime_error | - If the plan can't be created. |
Create FFTW plan for Complex-to-Real in the y dimension.
Definition at line 391 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createC2RFftPlan1DZ | ( | RealMatrix & | outMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build!
The FFTW version processes the whole matrix at one while the MKL slab by slab.
[in,out] | outMatrix | - RealMatrix of which to create the plan. |
std::runtime_error | - If the plan can't be created. |
Create FFTW plan for Complex-to-Real in the z dimension.
Definition at line 454 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createC2RFftPlan3D | ( | RealMatrix & | outMatrix | ) |
[in] | outMatrix | - Output matrix serving as scratch place for planning. |
std::runtime_error | - If the plan can't be created. |
Create an FFTW plan for 3D Complex-to-Real.
Definition at line 120 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createR2CFftPlan1DX | ( | RealMatrix & | inMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build!
The FFTW version processes the whole matrix at one while the MKL slab by slab.
[in,out] | inMatrix | - RealMatrix of which to create the plan. |
std::runtime_error | - If the plan can't be created. |
Create an FFTW plan for 1D Real-to-Complex in the x dimension.
Definition at line 139 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createR2CFftPlan1DY | ( | RealMatrix & | inMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build!
The FFTW version processes the whole matrix at one while the MKL slab by slab
[in,out] | inMatrix | - RealMatrix of which to create the plan. |
std::runtime_error | - If the plan can't be created. |
Create an FFTW plan for 1D Real-to-Complex in the y dimension.
Definition at line 203 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createR2CFftPlan1DZ | ( | RealMatrix & | inMatrix | ) |
There are two versions of this routine for GCC+FFTW and ICPC + MKL, otherwise it will not build!
The FFTW version processes the whole matrix at one while the MKL slab by slab
[in,out] | inMatrix | - RealMatrix of which to create the plan. |
std::runtime_error | - If the plan can't be created. |
Create an FFTW plan for 1D Real-to-Complex in the z dimension.
Definition at line 266 of file FftwComplexMatrix.cpp.
void FftwComplexMatrix::createR2CFftPlan3D | ( | RealMatrix & | inMatrix | ) |
[in] | inMatrix | - Input matrix serving as scratch place for planning. |
std::runtime_error | - If the plan can't be created. |
Create an FFTW plan for 3D Real-to-Complex.
Definition at line 101 of file FftwComplexMatrix.cpp.
|
static |
Delete stored wisdom (delete the file).
Definition at line 771 of file FftwComplexMatrix.cpp.
|
static |
Export wisdom to the file.
Definition at line 740 of file FftwComplexMatrix.cpp.
|
protectedvirtual |
Free memory using fftwf_free.
Reimplemented from BaseFloatMatrix.
Definition at line 807 of file FftwComplexMatrix.cpp.
|
staticprotected |
Get Wisdom file name (derive it form the checkpoint filename).
Get Wisdom file name (derive it form the checkpoint filename).
Definition at line 817 of file FftwComplexMatrix.cpp.
|
static |
Import wisdom from the file.
Definition at line 755 of file FftwComplexMatrix.cpp.