kspaceFirstOrder3D-OMP  1.1
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 All Classes Files Functions Variables Typedefs Enumerations Friends Pages
TFFTWComplexMatrix Class Reference

Class implementing 3D Real-To-Complex and Complex-To-Real transforms using FFTW interface. More...

#include <FFTWComplexMatrix.h>

Inheritance diagram for TFFTWComplexMatrix:
Collaboration diagram for TFFTWComplexMatrix:

Public Member Functions

 TFFTWComplexMatrix (const TDimensionSizes &DimensionSizes)
 Constructor. More...
 
virtual ~TFFTWComplexMatrix ()
 Destructor. More...
 
void Create_FFT_Plan_3D_R2C (TRealMatrix &InMatrix)
 Create FFTW plan for Real-to-Complex. More...
 
void Create_FFT_Plan_3D_C2R (TRealMatrix &OutMatrix)
 Create FFTW plan for Complex-to-Real. More...
 
void Create_FFT_Plan_1DX_R2C (TRealMatrix &InMatrix)
 Create FFTW plan for Real-to-Complex in the X dimension. More...
 
void Create_FFT_Plan_1DY_R2C (TRealMatrix &InMatrix)
 Create FFTW plan for Real-to-Complex in the Y dimension. More...
 
void Create_FFT_Plan_1DZ_R2C (TRealMatrix &InMatrix)
 Create FFTW plan for Real-to-Complex in the Z dimension. More...
 
void Create_FFT_Plan_1DX_C2R (TRealMatrix &OutMatrix)
 Create FFTW plan for Complex-to-Real in the X dimension. More...
 
void Create_FFT_Plan_1DY_C2R (TRealMatrix &OutMatrix)
 Create FFTW plan for Complex-to-Real in the Y dimension. More...
 
void Create_FFT_Plan_1DZ_C2R (TRealMatrix &OutMatrix)
 Create FFTW plan for Complex-to-Real in the Z dimension. More...
 
void Compute_FFT_3D_R2C (TRealMatrix &InMatrix)
 Compute 3D out-of-place Real-to-Complex FFT. More...
 
void Compute_FFT_3D_C2R (TRealMatrix &OutMatrix)
 Compute 3D out-of-place Complex-to-Real FFT. More...
 
void Compute_FFT_1DX_R2C (TRealMatrix &InMatrix)
 Compute 1D out-of-place Real-to-Complex FFT in the X dimension. More...
 
void Compute_FFT_1DY_R2C (TRealMatrix &InMatrix)
 Compute 1D out-of-place Real-to-Complex FFT in the Y dimension. More...
 
void Compute_FFT_1DZ_R2C (TRealMatrix &InMatrix)
 Compute 1D out-of-place Real-to-Complex FFT in the Z dimension. More...
 
void Compute_FFT_1DX_C2R (TRealMatrix &OutMatrix)
 Compute 1D out-of-place Complex-to-Real FFT in the X dimension. More...
 
void Compute_FFT_1DY_C2R (TRealMatrix &OutMatrix)
 Compute 1D out-of-place Complex-to-Real FFT in the Y dimension. More...
 
void Compute_FFT_1DZ_C2R (TRealMatrix &OutMatrix)
 Compute 1D out-of-place Complex-to-Real FFT in the Z dimension. More...
 
- Public Member Functions inherited from TComplexMatrix
 TComplexMatrix (const TDimensionSizes &DimensionSizes)
 Constructor. More...
 
virtual ~TComplexMatrix ()
 Destructor.
 
TFloatComplexoperator[] (const size_t &index)
 operator []. More...
 
const TFloatComplexoperator[] (const size_t &index) const
 operator [], constant version. More...
 
TFloatComplexGetElementFrom3D (const size_t X, const size_t Y, const size_t Z)
 Get element from 3D matrix. More...
 
const TFloatComplexGetElementFrom3D (const size_t X, const size_t Y, const size_t Z) const
 Get element from 3D matrix, constant version. More...
 
virtual void ReadDataFromHDF5File (THDF5_File &HDF5_File, const char *MatrixName)
 Load data from the HDF5_File. More...
 
virtual void WriteDataToHDF5File (THDF5_File &HDF5_File, const char *MatrixName, const size_t CompressionLevel)
 Write data into the HDF5_File. More...
 
- Public Member Functions inherited from TBaseFloatMatrix
 TBaseFloatMatrix ()
 Default constructor.
 
virtual TDimensionSizes GetDimensionSizes () const
 Get dimension sizes of the matrix.
 
virtual size_t GetTotalElementCount () const
 Get element count of the matrix.
 
virtual size_t GetTotalAllocatedElementCount () const
 Get total allocated element count (might differ from total element count used for the simulation because of padding).
 
virtual ~TBaseFloatMatrix ()
 Destructor.
 
virtual void CopyData (const TBaseFloatMatrix &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)
 Divide scalar/ matrix_element[i]. More...
 
virtual float * GetRawData ()
 Get raw data out of the class (for direct kernel access).
 
virtual const float * GetRawData () const
 Get raw data out of the class (for direct kernel access).
 
- Public Member Functions inherited from TBaseMatrix
 TBaseMatrix ()
 Default constructor.
 
virtual ~TBaseMatrix ()
 Destructor.
 

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

 TFFTWComplexMatrix ()
 Default constructor not allowed for public.
 
 TFFTWComplexMatrix (const TFFTWComplexMatrix &src)
 Copy constructor not allowed for public.
 
TFFTWComplexMatrixoperator= (const TFFTWComplexMatrix &src)
 Operator = not allowed for public.
 
virtual void AllocateMemory ()
 Allocate memory for the FFTW matrix. More...
 
virtual void FreeMemory ()
 Free memory of the FFTW matrix. More...
 
- Protected Member Functions inherited from TComplexMatrix
 TComplexMatrix ()
 Default constructor not allowed for public.
 
 TComplexMatrix (const TComplexMatrix &src)
 Copy constructor not allowed for public.
 
TComplexMatrixoperator= (const TComplexMatrix &src)
 Operator not allowed for public.
 
virtual void InitDimensions (const TDimensionSizes &DimensionSizes)
 Initialize dimension sizes and related structures. More...
 
- Protected Member Functions inherited from TBaseFloatMatrix
 TBaseFloatMatrix (const TBaseFloatMatrix &src)
 Copy constructor is not directly allowed.
 
TBaseFloatMatrixoperator= (const TBaseFloatMatrix &src)
 operator = is not directly allowed.
 

Static Protected Member Functions

static string GetWisdomFileName ()
 Get Wisdom file name, base on the checkpoint filename. More...
 

Protected Attributes

fftwf_plan fftw_plan_3D_R2C
 FFTW plan for the 3D Real-to-Complex transform.
 
fftwf_plan fftw_plan_3D_C2R
 FFTW plan for the 3D Complex-to-Real transform.
 
fftwf_plan fftw_plan_1DX_R2C
 FFTW plan for the 1D Real-to-Complex transform in the X dimension.
 
fftwf_plan fftw_plan_1DY_R2C
 FFTW plan for the 3D Real-to-Complex transform in the Y dimension.
 
fftwf_plan fftw_plan_1DZ_R2C
 FFTW plan for the 3D Real-to-Complex transform in the Z dimension.
 
fftwf_plan fftw_plan_1DX_C2R
 FFTW plan for the 3D Complex-to-Real transform in the X dimension.
 
fftwf_plan fftw_plan_1DY_C2R
 FFTW plan for the 3D Complex-to-Real transform in the Y dimension.
 
fftwf_plan fftw_plan_1DZ_C2R
 FFTW plan for the 3Z Complex-to-Real transform in the Z dimension.
 
- Protected Attributes inherited from TBaseFloatMatrix
size_t pTotalElementCount
 Total number of elements.
 
size_t pTotalAllocatedElementCount
 Total number of allocated elements (in terms of floats).
 
struct TDimensionSizes pDimensionSizes
 Dimension sizes.
 
size_t pDataRowSize
 Size of a 1D row in X dimension.
 
size_t p2DDataSliceSize
 Size of a 2D slab (X,Y).
 
float * pMatrixData
 Raw matrix data.
 

Static Protected Attributes

static const unsigned TFFTWComplexMatrix_FFT_FLAG = FFTW_MEASURE
 FFTW plan flag.
 
static const string FFTW_Wisdom_FileName_Extension = "FFTW_Wisdom"
 The file extension for FFTW wisdom.
 

Detailed Description

Class implementing 3D Real-To-Complex and Complex-To-Real transforms using FFTW interface.

Definition at line 50 of file FFTWComplexMatrix.h.

Constructor & Destructor Documentation

TFFTWComplexMatrix::TFFTWComplexMatrix ( const TDimensionSizes DimensionSizes)

Constructor.

Parameters
[in]DimensionSizes- Dimension sizes of the reduced complex matrix

Definition at line 60 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

TFFTWComplexMatrix::~TFFTWComplexMatrix ( )
virtual

Destructor.

Definition at line 76 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Member Function Documentation

void TFFTWComplexMatrix::AllocateMemory ( )
protectedvirtual

Allocate Memory using fftwf_malloc function to ensure correct alignment.

Reimplemented from TBaseFloatMatrix.

Definition at line 918 of file FFTWComplexMatrix.cpp.

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_1DX_C2R ( TRealMatrix OutMatrix)

Compute 1D out-of-place Complex-to-Real FFT in the X dimension.

Parameters
[out]OutMatrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 761 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_1DX_R2C ( TRealMatrix InMatrix)

Compute 1D out-of-place Real-to-Complex FFT in the X dimension. 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

Parameters
[in]InMatrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 652 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_1DY_C2R ( TRealMatrix OutMatrix)

Compute 1D out-of-place Complex-to-Real FFT in the Y dimension.

Parameters
[out]OutMatrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 797 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_1DY_R2C ( TRealMatrix InMatrix)

Compute 1D out-of-place Real-to-Complex FFT in the Y dimension.

Parameters
[in]InMatrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 688 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_1DZ_C2R ( TRealMatrix OutMatrix)

Compute 1D out-of-place Complex-to-Real FFT in the Z dimension

Parameters
[out]OutMatrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 833 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_1DZ_R2C ( TRealMatrix InMatrix)

Compute 1D out-of-place Real-to-Complex FFT in the Z dimension.

Parameters
[in]InMatrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 724 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_3D_C2R ( TRealMatrix OutMatrix)

Compute inverse out-of-place 3D Complex to Real FFT.

Parameters
[out]OutMatrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 628 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Compute_FFT_3D_R2C ( TRealMatrix InMatrix)

Computer forward out-of place 3D Real-to-Complex FFT.

Parameters
[in]InMatrix- Input Matrix
Exceptions
runtime_errorif the plan is not valid.

Definition at line 608 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_1DX_C2R ( TRealMatrix OutMatrix)

Create FFTW plan for Complex-to-Real in the X dimension. 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

Parameters
[in,out]OutMatrix- RealMatrix of which to create the plan.
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 392 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_1DX_R2C ( TRealMatrix InMatrix)

Create an FFTW plan for 1D Real-to-Complex in the X dimension. 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

Parameters
[in,out]InMatrix- RealMatrix of which to create the plan
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 167 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_1DY_C2R ( TRealMatrix OutMatrix)

Create FFTW plan for Complex-to-Real in the Y dimension. 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

Parameters
[in,out]OutMatrix- RealMatrix of which to create the plan.
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 466 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_1DY_R2C ( TRealMatrix InMatrix)

Create an FFTW plan for 1D Real-to-Complex in the Y dimension. 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

Parameters
[in,out]InMatrix- RealMatrix of which to create the plan
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
The FFTW matrix must be able to store 2 * (X * (Y/2 + 1) * Z) elements - possibly more than reduced dims!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 243 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_1DZ_C2R ( TRealMatrix OutMatrix)

Create FFTW plan for Complex-to-Real in the Z dimension. 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

Parameters
[in,out]OutMatrix- RealMatrix of which to create the plan.
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 539 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_1DZ_R2C ( TRealMatrix InMatrix)

Create an FFTW plan for 1D Real-to-Complex in the Z dimension. 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

Parameters
[in,out]InMatrix- RealMatrix of which to create the plan
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
The FFTW matrix must be able to store 2 * (X * Y * (Z/2+1) ) elements - possibly more than reduced dims!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 319 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_3D_C2R ( TRealMatrix OutMatrix)

Create an FFTW plan for 3D Complex-to-Real.

Parameters
[in,out]OutMatrix- RealMatrix of which to create the plan.
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 140 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::Create_FFT_Plan_3D_R2C ( TRealMatrix InMatrix)

Create an FFTW plan for 3D Real-to-Complex.

Parameters
[in,out]InMatrix- RealMatrix of which to create the plan
Warning
Unless FFTW_ESTIMATE flag is specified, the content of the InMatrix is destroyed!
Exceptions
runtime_errorif the plan can't be created.

Definition at line 115 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::DeleteStoredWisdom ( )
static

Delete stored wisdom (delete the file).

Definition at line 903 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::ExportWisdom ( )
static

Export wisdom to the file.

Warning
This routine is supported only while compiling with the GNU C++ compiler.

Definition at line 869 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::FreeMemory ( )
protectedvirtual

Free memory using fftwf_free.

Reimplemented from TBaseFloatMatrix.

Definition at line 942 of file FFTWComplexMatrix.cpp.

Here is the caller graph for this function:

string TFFTWComplexMatrix::GetWisdomFileName ( )
staticprotected

Get Wisdom file name (derive it form the checkpoint filename).

Returns
the filename for wisdom.

Definition at line 953 of file FFTWComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TFFTWComplexMatrix::ImportWisdom ( )
static

Import wisdom from the file.

Warning
This routine is supported only while compiling with the GNU C++ compiler.

Definition at line 888 of file FFTWComplexMatrix.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: