| kspaceFirstOrder3D-CUDA 1.1 The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CUFFTComplexMatrix.h
Go to the documentation of this file.
1 /**
2 * @file CUFFTComplexMatrix.h
3 *
4 * @author Jiri Jaros \n
5 * Faculty of Information Technology \n
6 * Brno University of Technology \n
7 * jarosjir@fit.vutbr.cz
8 *
9 * @brief The header file containing the class that implements 3D FFT using the cuFFT
10 * interface.
11 *
12 * @version kspaceFirstOrder3D 3.4
13 *
14 * @date 09 August 2011, 13:10 (created) \n
15 * 10 August 2016, 10:57 (revised)
16 *
17 * @section License
18 * This file is part of the C++ extension of the k-Wave Toolbox
19 * (http://www.k-wave.org).\n Copyright (C) 2016 Jiri Jaros and Bradley Treeby.
20 *
21 * This file is part of the k-Wave. k-Wave is free software: you can redistribute it and/or modify
22 * it under the terms of the GNU Lesser General Public License as published by the Free Software
23 * Foundation, either version 3 of the License, or (at your option) any later version.
24 *
25 * k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
26 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU Lesser General Public License along with k-Wave.
30 * If not, see http://www.gnu.org/licenses/.
31 */
32
33 #ifndef CUFFT_COMPLEX_MATRIX_H
34 #define CUFFT_COMPLEX_MATRIX_H
35
36 #include <map>
37 #include <cufft.h>
38
39 #include <MatrixClasses/ComplexMatrix.h>
40 #include <Logger/ErrorMessages.h>
41
42 /**
43 * @class TCUFFTComplexMatrix
44 * @brief Class implementing 3D Real-To-Complex and Complex-To-Real transforms using CUDA
45 * FFT interface.
46 * @details Class implementing 3D Real-To-Complex and Complex-To-Real transforms using CUDA
47 * FFT interface.
48 *
49 */
50 class TCUFFTComplexMatrix : public TComplexMatrix
51 {
52 public:
53 /// Constructor (inherited from TComplexMatrix).
54 TCUFFTComplexMatrix(const TDimensionSizes& DimensionSizes) : TComplexMatrix(DimensionSizes) {};
55 /// Destructor (Inherited from TComplexMatrix).
56 virtual ~TCUFFTComplexMatrix(){};
57
58 /// Create static cuFFT plan for Real-to-Complex.
59 static void Create_FFT_Plan_3D_R2C(const TDimensionSizes& inMatrixDims);
60 /// Create static cuFFT plan for Complex-to-Real.
61 static void Create_FFT_Plan_3D_C2R(const TDimensionSizes& outMatrixDims);
62
63 /// Create static cuFFT plan for Real-to-Complex in the X dimension.
64 static void Create_FFT_Plan_1DX_R2C(const TDimensionSizes& inMatrixDims);
65 /// Create static cuFFT plan for Real-to-Complex in the Y dimension.
66 static void Create_FFT_Plan_1DY_R2C(const TDimensionSizes& inMatrixDims);
67 /// Create static cuFFT plan for Real-to-Complex in the Z dimension.
68 static void Create_FFT_Plan_1DZ_R2C(const TDimensionSizes& inMatrixDims);
69
70 /// Create static cuFFT plan for Complex-to-Real in the X dimension.
71 static void Create_FFT_Plan_1DX_C2R(const TDimensionSizes& outMatrixDims);
72 /// Create static cuFFT plan for Complex-to-Real in the Y dimension.
73 static void Create_FFT_Plan_1DY_C2R(const TDimensionSizes& outMatrixDims);
74 /// Create static cuFFT plan for Complex-to-Real in the Z dimension.
75 static void Create_FFT_Plan_1DZ_C2R(const TDimensionSizes& outMatrixDims);
76
77 /// Destroy all static plans and error messages.
78 static void DestroyAllPlansAndStaticData();
79
80 /// Compute 3D out-of-place Real-to-Complex FFT.
81 void Compute_FFT_3D_R2C(TRealMatrix& inMatrix);
82 /// Compute 3D out-of-place Complex-to-Real FFT.
83 void Compute_FFT_3D_C2R(TRealMatrix& outMatrix);
84
85 /// Compute 1D out-of-place Real-to-Complex FFT in the X dimension.
86 void Compute_FFT_1DX_R2C(TRealMatrix& inMatrix);
87 /// Compute 1D out-of-place Real-to-Complex FFT in the Y dimension.
88 void Compute_FFT_1DY_R2C(TRealMatrix& inMatrix);
89 /// Compute 1D out-of-place Real-to-Complex FFT in the Z dimension.
90 void Compute_FFT_1DZ_R2C(TRealMatrix& inMatrix);
91
92 /// Compute 1D out-of-place Complex-to-Real FFT in the X dimension.
93 void Compute_FFT_1DX_C2R(TRealMatrix& outMatrix);
94 /// Compute 1D out-of-place Complex-to-Real FFT in the Y dimension.
95 void Compute_FFT_1DY_C2R(TRealMatrix& outMatrix);
96 /// Compute 1D out-of-place Complex-to-Real FFT in the Z dimension.
97 void Compute_FFT_1DZ_C2R(TRealMatrix& outMatrix);
98
99
100 protected:
101
102 /// Copy constructor not allowed for public.
103 TCUFFTComplexMatrix(const TCUFFTComplexMatrix& src);
104 /// Operator = not allowed for public.
105 TCUFFTComplexMatrix & operator = (const TCUFFTComplexMatrix& src);
106
107 /// cuFFT plan for the 3D Real-to-Complex transform.
108 static cufftHandle cufftPlan_3D_R2C;
109 /// cuFFT plan for the 3D Complex-to-Real transform.
110 static cufftHandle cufftPlan_3D_C2R;
111
112 /// cuFFT plan for the 1D Real-to-Complex transform in the X dimension.
113 static cufftHandle cufftPlan_1DX_R2C;
114 /// cuFFT plan for the 3D Real-to-Complex transform in the Y dimension.
115 static cufftHandle cufftPlan_1DY_R2C;
116 /// cuFFT plan for the 3D Real-to-Complex transform in the Z dimension.
117 static cufftHandle cufftPlan_1DZ_R2C;
118
119 /// cuFFT plan for the 3D Complex-to-Real transform in the X dimension.
120 static cufftHandle cufftPlan_1DX_C2R;
121 /// cuFFT plan for the 3D Complex-to-Real transform in the Y dimension.
122 static cufftHandle cufftPlan_1DY_C2R;
123 /// cuFFT plan for the 3Z Complex-to-Real transform in the Z dimension.
124 static cufftHandle cufftPlan_1DZ_C2R;
125
126 private:
127
128 /// Throw an exception with a given error message
129 static void ThrowCUFFTException(const cufftResult cufftError,
130 const std::string& transformTypeName);
131
132 static std::map<cufftResult, TErrorMessage> cuFFTErrorMessages;
133
134 };// TCUFFTComplexMatrix
135
136 #endif /* CUFFT_COMPLEX_MATRIX_H */
TCUFFTComplexMatrix::Compute_FFT_1DY_R2C
void Compute_FFT_1DY_R2C(TRealMatrix &inMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the Y dimension.
Definition: CUFFTComplexMatrix.cpp:569
TCUFFTComplexMatrix::cufftPlan_1DZ_C2R
static cufftHandle cufftPlan_1DZ_C2R
cuFFT plan for the 3Z Complex-to-Real transform in the Z dimension.
Definition: CUFFTComplexMatrix.h:124
TCUFFTComplexMatrix::~TCUFFTComplexMatrix
virtual ~TCUFFTComplexMatrix()
Destructor (Inherited from TComplexMatrix).
Definition: CUFFTComplexMatrix.h:56
TCUFFTComplexMatrix::Create_FFT_Plan_1DZ_R2C
static void Create_FFT_Plan_1DZ_R2C(const TDimensionSizes &inMatrixDims)
Create static cuFFT plan for Real-to-Complex in the Z dimension.
Definition: CUFFTComplexMatrix.cpp:252
TCUFFTComplexMatrix::Compute_FFT_3D_C2R
void Compute_FFT_3D_C2R(TRealMatrix &outMatrix)
Compute 3D out-of-place Complex-to-Real FFT.
Definition: CUFFTComplexMatrix.cpp:533
TCUFFTComplexMatrix::DestroyAllPlansAndStaticData
static void DestroyAllPlansAndStaticData()
Destroy all static plans and error messages.
Definition: CUFFTComplexMatrix.cpp:443
TCUFFTComplexMatrix::Create_FFT_Plan_1DX_R2C
static void Create_FFT_Plan_1DX_R2C(const TDimensionSizes &inMatrixDims)
Create static cuFFT plan for Real-to-Complex in the X dimension.
Definition: CUFFTComplexMatrix.cpp:154
TCUFFTComplexMatrix::Compute_FFT_1DZ_R2C
void Compute_FFT_1DZ_R2C(TRealMatrix &inMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the Z dimension.
Definition: CUFFTComplexMatrix.cpp:598
TCUFFTComplexMatrix::Create_FFT_Plan_1DY_C2R
static void Create_FFT_Plan_1DY_C2R(const TDimensionSizes &outMatrixDims)
Create static cuFFT plan for Complex-to-Real in the Y dimension.
Definition: CUFFTComplexMatrix.cpp:350
TCUFFTComplexMatrix::Compute_FFT_1DY_C2R
void Compute_FFT_1DY_C2R(TRealMatrix &outMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the Y dimension.
Definition: CUFFTComplexMatrix.cpp:646
TCUFFTComplexMatrix::Create_FFT_Plan_1DZ_C2R
static void Create_FFT_Plan_1DZ_C2R(const TDimensionSizes &outMatrixDims)
Create static cuFFT plan for Complex-to-Real in the Z dimension.
Definition: CUFFTComplexMatrix.cpp:398
TCUFFTComplexMatrix::cufftPlan_1DX_C2R
static cufftHandle cufftPlan_1DX_C2R
cuFFT plan for the 3D Complex-to-Real transform in the X dimension.
Definition: CUFFTComplexMatrix.h:120
TCUFFTComplexMatrix::Create_FFT_Plan_3D_C2R
static void Create_FFT_Plan_3D_C2R(const TDimensionSizes &outMatrixDims)
Create static cuFFT plan for Complex-to-Real.
Definition: CUFFTComplexMatrix.cpp:126
TCUFFTComplexMatrix::cufftPlan_1DY_R2C
static cufftHandle cufftPlan_1DY_R2C
cuFFT plan for the 3D Real-to-Complex transform in the Y dimension.
Definition: CUFFTComplexMatrix.h:115
TCUFFTComplexMatrix::cufftPlan_3D_R2C
static cufftHandle cufftPlan_3D_R2C
cuFFT plan for the 3D Real-to-Complex transform.
Definition: CUFFTComplexMatrix.h:108
TCUFFTComplexMatrix::Create_FFT_Plan_1DX_C2R
static void Create_FFT_Plan_1DX_C2R(const TDimensionSizes &outMatrixDims)
Create static cuFFT plan for Complex-to-Real in the X dimension.
Definition: CUFFTComplexMatrix.cpp:301
TCUFFTComplexMatrix::Compute_FFT_1DX_R2C
void Compute_FFT_1DX_R2C(TRealMatrix &inMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the X dimension.
Definition: CUFFTComplexMatrix.cpp:550
TCUFFTComplexMatrix::TCUFFTComplexMatrix
TCUFFTComplexMatrix(const TDimensionSizes &DimensionSizes)
Constructor (inherited from TComplexMatrix).
Definition: CUFFTComplexMatrix.h:54
TCUFFTComplexMatrix::Create_FFT_Plan_1DY_R2C
static void Create_FFT_Plan_1DY_R2C(const TDimensionSizes &inMatrixDims)
Create static cuFFT plan for Real-to-Complex in the Y dimension.
Definition: CUFFTComplexMatrix.cpp:204
TCUFFTComplexMatrix::Compute_FFT_3D_R2C
void Compute_FFT_3D_R2C(TRealMatrix &inMatrix)
Compute 3D out-of-place Real-to-Complex FFT.
Definition: CUFFTComplexMatrix.cpp:514
TCUFFTComplexMatrix::Compute_FFT_1DX_C2R
void Compute_FFT_1DX_C2R(TRealMatrix &outMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the X dimension.
Definition: CUFFTComplexMatrix.cpp:626
TCUFFTComplexMatrix::cufftPlan_3D_C2R
static cufftHandle cufftPlan_3D_C2R
cuFFT plan for the 3D Complex-to-Real transform.
Definition: CUFFTComplexMatrix.h:110
ErrorMessages.h
The header file containing routines for error messages and error messages common for both linux and w...
TCUFFTComplexMatrix::Create_FFT_Plan_3D_R2C
static void Create_FFT_Plan_3D_R2C(const TDimensionSizes &inMatrixDims)
Create static cuFFT plan for Real-to-Complex.
Definition: CUFFTComplexMatrix.cpp:101
ComplexMatrix.h
The header file with the class for complex matrices.
TRealMatrix
The class for real matrices.
Definition: RealMatrix.h:45
TCUFFTComplexMatrix::operator=
TCUFFTComplexMatrix & operator=(const TCUFFTComplexMatrix &src)
Operator = not allowed for public.
TCUFFTComplexMatrix::Compute_FFT_1DZ_C2R
void Compute_FFT_1DZ_C2R(TRealMatrix &outMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the Z dimension.
Definition: CUFFTComplexMatrix.cpp:677
TCUFFTComplexMatrix::ThrowCUFFTException
static void ThrowCUFFTException(const cufftResult cufftError, const std::string &transformTypeName)
Throw an exception with a given error message.
Definition: CUFFTComplexMatrix.cpp:716
TCUFFTComplexMatrix::cufftPlan_1DY_C2R
static cufftHandle cufftPlan_1DY_C2R
cuFFT plan for the 3D Complex-to-Real transform in the Y dimension.
Definition: CUFFTComplexMatrix.h:122
TCUFFTComplexMatrix::cufftPlan_1DX_R2C
static cufftHandle cufftPlan_1DX_R2C
cuFFT plan for the 1D Real-to-Complex transform in the X dimension.
Definition: CUFFTComplexMatrix.h:113
TCUFFTComplexMatrix::cuFFTErrorMessages
static std::map< cufftResult, TErrorMessage > cuFFTErrorMessages
Definition: CUFFTComplexMatrix.h:132
TComplexMatrix
The class for complex matrices.
Definition: ComplexMatrix.h:54
TCUFFTComplexMatrix
Class implementing 3D Real-To-Complex and Complex-To-Real transforms using CUDA FFT interface...
Definition: CUFFTComplexMatrix.h:50
TCUFFTComplexMatrix::cufftPlan_1DZ_R2C
static cufftHandle cufftPlan_1DZ_R2C
cuFFT plan for the 3D Real-to-Complex transform in the Z dimension.
Definition: CUFFTComplexMatrix.h:117
TDimensionSizes
Structure with 4D dimension sizes (3 in space and 1 in time).
Definition: DimensionSizes.h:66