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

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Friends Pages
FFTWComplexMatrix.h
Go to the documentation of this file.
1 /**
2 * @file FFTWComplexMatrix.h
3 * @author Jiri Jaros \n
4 * Faculty of Information Technology\n
5 * Brno University of Technology \n
6 * jarosjir@fit.vutbr.cz
7 *
8 * @brief The header file containing the class that implements
9 * 3D FFT using the FFTW interface
10 *
11 * @version kspaceFirstOrder3D 2.15
12 *
13 * @date 09 August 2011, 13:10 (created) \n
14 * 25 September 2014, 12:45 (revised)
15 *
16 * @section License
17 * This file is part of the C++ extension of the k-Wave Toolbox (http://www.k-wave.org).\n
18 * Copyright (C) 2014 Jiri Jaros and Bradley Treeby
19 *
20 * This file is part of k-Wave. k-Wave is free software: you can redistribute it
21 * and/or modify it under the terms of the GNU Lesser General Public License as
22 * published by the Free Software Foundation, either version 3 of the License,
23 * or (at your option) any later version.
24 *
25 * k-Wave is distributed in the hope that it will be useful, but
26 * WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28 * See the GNU Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public License
31 * along with k-Wave. If not, see <http://www.gnu.org/licenses/>.
32 */
33
34 #ifndef FFTWCOMPLEXMATRIX_H
35 #define FFTWCOMPLEXMATRIX_H
36
37
38 #include <fftw3.h>
39
40 #include <MatrixClasses/ComplexMatrix.h>
41
42 /**
43 * @class TFFTWComplexMatrix
44 * @brief Class implementing 3D Real-To-Complex and Complex-To-Real transforms
45 * using FFTW interface.
46 * @details Class implementing 3D Real-To-Complex and Complex-To-Real transforms
47 * using FFTW interface.
48 *
49 */
50 class TFFTWComplexMatrix : public TComplexMatrix
51 {
52 public:
53 /// Constructor.
54 TFFTWComplexMatrix(const TDimensionSizes& DimensionSizes);
55 /// Destructor.
56 virtual ~TFFTWComplexMatrix();
57
58 /// Create FFTW plan for Real-to-Complex.
59 void Create_FFT_Plan_3D_R2C(TRealMatrix& InMatrix);
60 /// Create FFTW plan for Complex-to-Real.
61 void Create_FFT_Plan_3D_C2R(TRealMatrix& OutMatrix);
62
63 /// Create FFTW plan for Real-to-Complex in the X dimension.
64 void Create_FFT_Plan_1DX_R2C(TRealMatrix& InMatrix);
65 /// Create FFTW plan for Real-to-Complex in the Y dimension.
66 void Create_FFT_Plan_1DY_R2C(TRealMatrix& InMatrix);
67 /// Create FFTW plan for Real-to-Complex in the Z dimension.
68 void Create_FFT_Plan_1DZ_R2C(TRealMatrix& InMatrix);
69
70 /// Create FFTW plan for Complex-to-Real in the X dimension.
71 void Create_FFT_Plan_1DX_C2R(TRealMatrix& OutMatrix);
72 /// Create FFTW plan for Complex-to-Real in the Y dimension.
73 void Create_FFT_Plan_1DY_C2R(TRealMatrix& OutMatrix);
74 /// Create FFTW plan for Complex-to-Real in the Z dimension.
75 void Create_FFT_Plan_1DZ_C2R(TRealMatrix& OutMatrix);
76
77
78
79 /// Compute 3D out-of-place Real-to-Complex FFT.
80 void Compute_FFT_3D_R2C(TRealMatrix& InMatrix);
81 /// Compute 3D out-of-place Complex-to-Real FFT.
82 void Compute_FFT_3D_C2R(TRealMatrix& OutMatrix);
83
84 /// Compute 1D out-of-place Real-to-Complex FFT in the X dimension.
85 void Compute_FFT_1DX_R2C(TRealMatrix& InMatrix);
86 /// Compute 1D out-of-place Real-to-Complex FFT in the Y dimension.
87 void Compute_FFT_1DY_R2C(TRealMatrix& InMatrix);
88 /// Compute 1D out-of-place Real-to-Complex FFT in the Z dimension.
89 void Compute_FFT_1DZ_R2C(TRealMatrix& InMatrix);
90
91 /// Compute 1D out-of-place Complex-to-Real FFT in the X dimension.
92 void Compute_FFT_1DX_C2R(TRealMatrix& OutMatrix);
93 /// Compute 1D out-of-place Complex-to-Real FFT in the Y dimension.
94 void Compute_FFT_1DY_C2R(TRealMatrix& OutMatrix);
95 /// Compute 1D out-of-place Complex-to-Real FFT in the Z dimension.
96 void Compute_FFT_1DZ_C2R(TRealMatrix& OutMatrix);
97
98 /// Export wisdom to the file.
99 static void ExportWisdom();
100 /// Import wisdom from the file.
101 static void ImportWisdom();
102 /// Destroy wisdom in the file (delete it).
103 static void DeleteStoredWisdom();
104
105 protected:
106 /// Default constructor not allowed for public
107 TFFTWComplexMatrix() :
108 TComplexMatrix(),
109 fftw_plan_3D_R2C(NULL), fftw_plan_3D_C2R(NULL),
110 fftw_plan_1DX_R2C(NULL), fftw_plan_1DY_R2C(NULL), fftw_plan_1DZ_R2C(NULL),
111 fftw_plan_1DX_C2R(NULL), fftw_plan_1DY_C2R(NULL), fftw_plan_1DZ_C2R(NULL)
112 {};
113
114 /// Copy constructor not allowed for public.
115 TFFTWComplexMatrix(const TFFTWComplexMatrix& src);
116
117 /// Operator = not allowed for public.
118 TFFTWComplexMatrix & operator = (const TFFTWComplexMatrix& src);
119
120 /// Get Wisdom file name, base on the checkpoint filename.
121 static string GetWisdomFileName();
122
123 /// Allocate memory for the FFTW matrix.
124 virtual void AllocateMemory();
125 /// Free memory of the FFTW matrix.
126 virtual void FreeMemory();
127
128 /// FFTW plan flag.
129 static const unsigned TFFTWComplexMatrix_FFT_FLAG = FFTW_MEASURE;
130 /// The file extension for FFTW wisdom.
131 static const string FFTW_Wisdom_FileName_Extension;// = "FFTW_Wisdom";
132
133 /// FFTW plan for the 3D Real-to-Complex transform.
134 fftwf_plan fftw_plan_3D_R2C;
135 /// FFTW plan for the 3D Complex-to-Real transform.
136 fftwf_plan fftw_plan_3D_C2R;
137
138 /// FFTW plan for the 1D Real-to-Complex transform in the X dimension.
139 fftwf_plan fftw_plan_1DX_R2C;
140 /// FFTW plan for the 3D Real-to-Complex transform in the Y dimension.
141 fftwf_plan fftw_plan_1DY_R2C;
142 /// FFTW plan for the 3D Real-to-Complex transform in the Z dimension.
143 fftwf_plan fftw_plan_1DZ_R2C;
144
145 /// FFTW plan for the 3D Complex-to-Real transform in the X dimension.
146 fftwf_plan fftw_plan_1DX_C2R;
147 /// FFTW plan for the 3D Complex-to-Real transform in the Y dimension.
148 fftwf_plan fftw_plan_1DY_C2R;
149 /// FFTW plan for the 3Z Complex-to-Real transform in the Z dimension.
150 fftwf_plan fftw_plan_1DZ_C2R;
151
152 private:
153
154 };// TFFTWComplexMatrix
155
156 #endif /* FFTWCOMPLEXMATRIX_H */
157
TFFTWComplexMatrix::ExportWisdom
static void ExportWisdom()
Export wisdom to the file.
Definition: FFTWComplexMatrix.cpp:869
TFFTWComplexMatrix::FreeMemory
virtual void FreeMemory()
Free memory of the FFTW matrix.
Definition: FFTWComplexMatrix.cpp:942
TFFTWComplexMatrix::fftw_plan_1DY_R2C
fftwf_plan fftw_plan_1DY_R2C
FFTW plan for the 3D Real-to-Complex transform in the Y dimension.
Definition: FFTWComplexMatrix.h:141
TFFTWComplexMatrix::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: FFTWComplexMatrix.cpp:688
TFFTWComplexMatrix::TFFTWComplexMatrix_FFT_FLAG
static const unsigned TFFTWComplexMatrix_FFT_FLAG
FFTW plan flag.
Definition: FFTWComplexMatrix.h:129
TFFTWComplexMatrix::Create_FFT_Plan_1DZ_C2R
void Create_FFT_Plan_1DZ_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real in the Z dimension.
Definition: FFTWComplexMatrix.cpp:539
TFFTWComplexMatrix::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: FFTWComplexMatrix.cpp:761
TFFTWComplexMatrix::Create_FFT_Plan_1DY_R2C
void Create_FFT_Plan_1DY_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex in the Y dimension.
Definition: FFTWComplexMatrix.cpp:243
TFFTWComplexMatrix::Create_FFT_Plan_3D_R2C
void Create_FFT_Plan_3D_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex.
Definition: FFTWComplexMatrix.cpp:115
TFFTWComplexMatrix::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: FFTWComplexMatrix.cpp:833
TFFTWComplexMatrix::fftw_plan_1DZ_R2C
fftwf_plan fftw_plan_1DZ_R2C
FFTW plan for the 3D Real-to-Complex transform in the Z dimension.
Definition: FFTWComplexMatrix.h:143
TFFTWComplexMatrix::fftw_plan_3D_R2C
fftwf_plan fftw_plan_3D_R2C
FFTW plan for the 3D Real-to-Complex transform.
Definition: FFTWComplexMatrix.h:134
TFFTWComplexMatrix::AllocateMemory
virtual void AllocateMemory()
Allocate memory for the FFTW matrix.
Definition: FFTWComplexMatrix.cpp:918
TFFTWComplexMatrix::fftw_plan_3D_C2R
fftwf_plan fftw_plan_3D_C2R
FFTW plan for the 3D Complex-to-Real transform.
Definition: FFTWComplexMatrix.h:136
TFFTWComplexMatrix::TFFTWComplexMatrix
TFFTWComplexMatrix()
Default constructor not allowed for public.
Definition: FFTWComplexMatrix.h:107
TFFTWComplexMatrix::Create_FFT_Plan_1DX_R2C
void Create_FFT_Plan_1DX_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex in the X dimension.
Definition: FFTWComplexMatrix.cpp:167
TFFTWComplexMatrix
Class implementing 3D Real-To-Complex and Complex-To-Real transforms using FFTW interface.
Definition: FFTWComplexMatrix.h:50
TFFTWComplexMatrix::Create_FFT_Plan_1DZ_R2C
void Create_FFT_Plan_1DZ_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex in the Z dimension.
Definition: FFTWComplexMatrix.cpp:319
TFFTWComplexMatrix::Compute_FFT_3D_C2R
void Compute_FFT_3D_C2R(TRealMatrix &OutMatrix)
Compute 3D out-of-place Complex-to-Real FFT.
Definition: FFTWComplexMatrix.cpp:628
TFFTWComplexMatrix::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: FFTWComplexMatrix.cpp:652
TFFTWComplexMatrix::DeleteStoredWisdom
static void DeleteStoredWisdom()
Destroy wisdom in the file (delete it).
Definition: FFTWComplexMatrix.cpp:903
TFFTWComplexMatrix::fftw_plan_1DZ_C2R
fftwf_plan fftw_plan_1DZ_C2R
FFTW plan for the 3Z Complex-to-Real transform in the Z dimension.
Definition: FFTWComplexMatrix.h:150
TFFTWComplexMatrix::Create_FFT_Plan_1DY_C2R
void Create_FFT_Plan_1DY_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real in the Y dimension.
Definition: FFTWComplexMatrix.cpp:466
TFFTWComplexMatrix::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: FFTWComplexMatrix.cpp:797
TFFTWComplexMatrix::GetWisdomFileName
static string GetWisdomFileName()
Get Wisdom file name, base on the checkpoint filename.
Definition: FFTWComplexMatrix.cpp:953
TFFTWComplexMatrix::ImportWisdom
static void ImportWisdom()
Import wisdom from the file.
Definition: FFTWComplexMatrix.cpp:888
ComplexMatrix.h
The header file with the class for complex matrices.
TRealMatrix
The class for real matrices.
Definition: RealMatrix.h:48
TFFTWComplexMatrix::FFTW_Wisdom_FileName_Extension
static const string FFTW_Wisdom_FileName_Extension
The file extension for FFTW wisdom.
Definition: FFTWComplexMatrix.h:131
TFFTWComplexMatrix::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: FFTWComplexMatrix.cpp:724
TFFTWComplexMatrix::Create_FFT_Plan_3D_C2R
void Create_FFT_Plan_3D_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real.
Definition: FFTWComplexMatrix.cpp:140
TFFTWComplexMatrix::Compute_FFT_3D_R2C
void Compute_FFT_3D_R2C(TRealMatrix &InMatrix)
Compute 3D out-of-place Real-to-Complex FFT.
Definition: FFTWComplexMatrix.cpp:608
TFFTWComplexMatrix::operator=
TFFTWComplexMatrix & operator=(const TFFTWComplexMatrix &src)
Operator = not allowed for public.
TFFTWComplexMatrix::fftw_plan_1DX_C2R
fftwf_plan fftw_plan_1DX_C2R
FFTW plan for the 3D Complex-to-Real transform in the X dimension.
Definition: FFTWComplexMatrix.h:146
TFFTWComplexMatrix::fftw_plan_1DY_C2R
fftwf_plan fftw_plan_1DY_C2R
FFTW plan for the 3D Complex-to-Real transform in the Y dimension.
Definition: FFTWComplexMatrix.h:148
TFFTWComplexMatrix::fftw_plan_1DX_R2C
fftwf_plan fftw_plan_1DX_R2C
FFTW plan for the 1D Real-to-Complex transform in the X dimension.
Definition: FFTWComplexMatrix.h:139
TComplexMatrix
The class for complex matrices.
Definition: ComplexMatrix.h:64
TFFTWComplexMatrix::Create_FFT_Plan_1DX_C2R
void Create_FFT_Plan_1DX_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real in the X dimension.
Definition: FFTWComplexMatrix.cpp:392
TFFTWComplexMatrix::~TFFTWComplexMatrix
virtual ~TFFTWComplexMatrix()
Destructor.
Definition: FFTWComplexMatrix.cpp:76
TDimensionSizes
Structure with 4D dimension sizes (3 in space and 1 in time).
Definition: DimensionSizes.h:63