62 fftw_plan_3D_R2C(NULL), fftw_plan_3D_C2R(NULL),
63 fftw_plan_1DX_R2C(NULL), fftw_plan_1DY_R2C(NULL), fftw_plan_1DZ_R2C(NULL),
64 fftw_plan_1DX_C2R(NULL), fftw_plan_1DY_C2R(NULL), fftw_plan_1DZ_C2R(NULL)
126 char ErrorMessage[256];
128 throw runtime_error(ErrorMessage);
151 char ErrorMessage[256];
153 throw runtime_error(ErrorMessage);
174 const int X_2 = ((X / 2) + 1);
177 const int fft_rank = 1;
178 fftw_iodim fft_dims[1];
185 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
187 const int fft_howmany_rank = 2;
188 fftw_iodim fft_howmany_dims[2];
191 fft_howmany_dims[0].is = X * Y;
192 fft_howmany_dims[0].n = Z;
193 fft_howmany_dims[0].os = X_2 * Y;
196 fft_howmany_dims[1].is = X;
197 fft_howmany_dims[1].n = Y;
198 fft_howmany_dims[1].os = X_2;
202 #if (defined(__INTEL_COMPILER))
203 const int fft_howmany_rank = 1;
204 fftw_iodim fft_howmany_dims[1];
207 fft_howmany_dims[0].is = X;
208 fft_howmany_dims[0].n = Y;
209 fft_howmany_dims[0].os = X_2;
224 char ErrorMessage[256];
226 throw runtime_error(ErrorMessage);
250 const int Y_2 = ((Y / 2) + 1);
253 const int fft_rank = 1;
254 fftw_iodim fft_dims[1];
261 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
263 const int fft_howmany_rank = 2;
264 fftw_iodim fft_howmany_dims[2];
267 fft_howmany_dims[0].is = X * Y;
268 fft_howmany_dims[0].n = Z;
269 fft_howmany_dims[0].os = X * Y_2 ;
272 fft_howmany_dims[1].is = 1;
273 fft_howmany_dims[1].n = X;
274 fft_howmany_dims[1].os = 1;
278 #if (defined(__INTEL_COMPILER))
279 const int fft_howmany_rank = 1;
280 fftw_iodim fft_howmany_dims[1];
283 fft_howmany_dims[0].is = 1;
284 fft_howmany_dims[0].n = X;
285 fft_howmany_dims[0].os = 1;
300 char ErrorMessage[256];
302 throw runtime_error(ErrorMessage);
328 const int fft_rank = 1;
329 fftw_iodim fft_dims[1];
331 fft_dims[0].is = X * Y;
333 fft_dims[0].os = X * Y;
336 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
338 const int fft_howmany_rank = 2;
339 fftw_iodim fft_howmany_dims[2];
342 fft_howmany_dims[0].is = X;
343 fft_howmany_dims[0].n = Y;
344 fft_howmany_dims[0].os = X;
347 fft_howmany_dims[1].is = 1;
348 fft_howmany_dims[1].n = X;
349 fft_howmany_dims[1].os = 1;
353 #if (defined(__INTEL_COMPILER))
354 const int fft_howmany_rank = 1;
355 fftw_iodim fft_howmany_dims[1];
358 fft_howmany_dims[0].is = 1;
359 fft_howmany_dims[0].n = X;
360 fft_howmany_dims[0].os = 1;
375 char ErrorMessage[256];
377 throw runtime_error(ErrorMessage);
399 const int X_2 = ((X / 2) + 1);
402 const int fft_rank = 1;
403 fftw_iodim fft_dims[1];
410 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
412 const int fft_howmany_rank = 2;
413 fftw_iodim fft_howmany_dims[2];
416 fft_howmany_dims[0].is = X_2 * Y;
417 fft_howmany_dims[0].n = Z;
418 fft_howmany_dims[0].os = X * Y;
421 fft_howmany_dims[1].is = X_2;
422 fft_howmany_dims[1].n = Y;
423 fft_howmany_dims[1].os = X;
427 #if (defined(__INTEL_COMPILER))
428 const int fft_howmany_rank = 1;
429 fftw_iodim fft_howmany_dims[1];
432 fft_howmany_dims[0].is = X_2;
433 fft_howmany_dims[0].n = Y;
434 fft_howmany_dims[0].os = X;
449 char ErrorMessage[256];
451 throw runtime_error(ErrorMessage);
473 const int Y_2 = ((Y / 2) + 1);
476 const int fft_rank = 1;
478 fftw_iodim fft_dims[1];
484 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
486 const int fft_howmany_rank = 2;
487 fftw_iodim fft_howmany_dims[2];
490 fft_howmany_dims[0].is = X * Y_2;
491 fft_howmany_dims[0].n = Z;
492 fft_howmany_dims[0].os = X * Y;
495 fft_howmany_dims[1].is = 1;
496 fft_howmany_dims[1].n = X;
497 fft_howmany_dims[1].os = 1;
501 #if (defined(__INTEL_COMPILER))
502 const int fft_howmany_rank = 1;
503 fftw_iodim fft_howmany_dims[1];
506 fft_howmany_dims[0].is = 1;
507 fft_howmany_dims[0].n = X;
508 fft_howmany_dims[0].os = 1;
523 char ErrorMessage[256];
525 throw runtime_error(ErrorMessage);
548 const int fft_rank = 1;
549 fftw_iodim fft_dims[1];
551 fft_dims[0].is = X * Y;
553 fft_dims[0].os = X * Y;
556 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
558 const int fft_howmany_rank = 2;
559 fftw_iodim fft_howmany_dims[2];
562 fft_howmany_dims[0].is = X;
563 fft_howmany_dims[0].n = Y;
564 fft_howmany_dims[0].os = X;
567 fft_howmany_dims[1].is = 1;
568 fft_howmany_dims[1].n = X;
569 fft_howmany_dims[1].os = 1;
573 #if (defined(__INTEL_COMPILER))
574 const int fft_howmany_rank = 1;
575 fftw_iodim fft_howmany_dims[1];
578 fft_howmany_dims[0].is = 1;
579 fft_howmany_dims[0].n = X;
580 fft_howmany_dims[0].os = 1;
595 char ErrorMessage[256];
597 throw runtime_error(ErrorMessage);
616 char ErrorMessage[256];
618 throw runtime_error(ErrorMessage);
636 char ErrorMessage[256];
638 throw runtime_error(ErrorMessage);
657 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
664 #if (defined(__INTEL_COMPILER))
666 for (
size_t slab_id = 0; slab_id < Dims.
Z; slab_id++)
670 (fftwf_complex *) &
pMatrixData[slab_id * 2 * (Dims.
X/2 + 1) * Dims.
Y]);
676 char ErrorMessage[256];
678 throw runtime_error(ErrorMessage);
693 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
700 #if (defined(__INTEL_COMPILER))
702 for (
size_t slab_id = 0; slab_id < Dims.
Z; slab_id++)
706 (fftwf_complex *) &
pMatrixData[slab_id * Dims.
X * 2 * (Dims.
Y/2 + 1)]);
712 char ErrorMessage[256];
714 throw runtime_error(ErrorMessage);
729 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
736 #if (defined(__INTEL_COMPILER))
738 for (
size_t slab_id = 0; slab_id < Dims.
Y; slab_id++)
748 char ErrorMessage[256];
750 throw runtime_error(ErrorMessage);
766 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
773 #if (defined(__INTEL_COMPILER))
775 for (
size_t slab_id = 0; slab_id < Dims.Z; slab_id++)
778 (fftwf_complex *) &
pMatrixData[slab_id * 2 * (Dims.X/2 + 1) * Dims.Y],
779 &OutMatrix.
GetRawData()[slab_id * Dims.X * Dims.Y]);
785 char ErrorMessage[256];
787 throw runtime_error(ErrorMessage);
802 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
809 #if (defined(__INTEL_COMPILER))
811 for (
size_t slab_id = 0; slab_id < Dims.Z; slab_id++)
814 (fftwf_complex *) &
pMatrixData[slab_id * Dims.X * 2 * (Dims.Y/2 + 1) ],
815 &OutMatrix.
GetRawData()[slab_id * Dims.X * Dims.Y]);
821 char ErrorMessage[256];
823 throw runtime_error(ErrorMessage);
838 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
845 #if (defined(__INTEL_COMPILER))
847 for (
size_t slab_id = 0; slab_id < Dims.Y; slab_id++)
850 (fftwf_complex *) &
pMatrixData[slab_id * 2 * Dims.X ],
857 char ErrorMessage[256];
859 throw runtime_error(ErrorMessage);
871 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
890 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
930 #pragma omp parallel for schedule(static)
956 FileName.erase(FileName.find_last_of(
"."), string::npos);
958 FileName.append(
".");
size_t Z
Z dimension size.
virtual float * GetRawData()
Get raw data out of the class (for direct kernel access).
const char *const FFTWComplexMatrix_ERR_FMT_InvalidPlan
FFTW error message.
static void ExportWisdom()
Export wisdom to the file.
virtual void FreeMemory()
Free memory of the FFTW matrix.
fftwf_plan fftw_plan_1DY_R2C
FFTW plan for the 3D Real-to-Complex transform in the Y dimension.
void Compute_FFT_1DY_R2C(TRealMatrix &InMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the Y dimension.
static const unsigned TFFTWComplexMatrix_FFT_FLAG
FFTW plan flag.
void Create_FFT_Plan_1DZ_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real in the Z dimension.
void Compute_FFT_1DX_C2R(TRealMatrix &OutMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the X dimension.
void Create_FFT_Plan_1DY_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex in the Y dimension.
The header file containing the class for real matrices.
void Create_FFT_Plan_3D_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex.
void Compute_FFT_1DZ_C2R(TRealMatrix &OutMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the Z dimension.
fftwf_plan fftw_plan_1DZ_R2C
FFTW plan for the 3D Real-to-Complex transform in the Z dimension.
fftwf_plan fftw_plan_3D_R2C
FFTW plan for the 3D Real-to-Complex transform.
virtual void AllocateMemory()
Allocate memory for the FFTW matrix.
string GetCheckpointFileName() const
Get checkpoint filename.
virtual void InitDimensions(const TDimensionSizes &DimensionSizes)
Initialize dimension sizes and related structures.
fftwf_plan fftw_plan_3D_C2R
FFTW plan for the 3D Complex-to-Real transform.
size_t X
X dimension size.
The header file containing the parameters of the simulation.
TFFTWComplexMatrix()
Default constructor not allowed for public.
void Create_FFT_Plan_1DX_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex in the X dimension.
size_t pTotalAllocatedElementCount
Total number of allocated elements (in terms of floats).
virtual TDimensionSizes GetDimensionSizes() const
Get dimension sizes of the matrix.
const char *const FFTW_WARNING_FMT_WisdomNotImported
FFTW error message.
void Create_FFT_Plan_1DZ_R2C(TRealMatrix &InMatrix)
Create FFTW plan for Real-to-Complex in the Z dimension.
TDimensionSizes GetFullDimensionSizes() const
Full dimension sizes of the simulation (real classes).
void Compute_FFT_3D_C2R(TRealMatrix &OutMatrix)
Compute 3D out-of-place Complex-to-Real FFT.
void Compute_FFT_1DX_R2C(TRealMatrix &InMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the X dimension.
static void DeleteStoredWisdom()
Destroy wisdom in the file (delete it).
fftwf_plan fftw_plan_1DZ_C2R
FFTW plan for the 3Z Complex-to-Real transform in the Z dimension.
void Create_FFT_Plan_1DY_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real in the Y dimension.
void Compute_FFT_1DY_C2R(TRealMatrix &OutMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the Y dimension.
static string GetWisdomFileName()
Get Wisdom file name, base on the checkpoint filename.
The header file containing all error messages of the project.
static void ImportWisdom()
Import wisdom from the file.
const char *const FFTWComplexMatrix_ERR_FMT_PlanNotCreated
FFTW error message.
const char *const FFTW_WARNING_FMT_WisdomNotExported
FFTW error message.
The class for real matrices.
size_t Y
Y dimension size.
static const string FFTW_Wisdom_FileName_Extension
The file extension for FFTW wisdom.
void Compute_FFT_1DZ_R2C(TRealMatrix &InMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the Z dimension.
void Create_FFT_Plan_3D_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real.
void Compute_FFT_3D_R2C(TRealMatrix &InMatrix)
Compute 3D out-of-place Real-to-Complex FFT.
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_1DX_R2C
FFTW plan for the 1D Real-to-Complex transform in the X dimension.
The class for complex matrices.
float * pMatrixData
Raw matrix data.
const char *const Matrix_ERR_FMT_NotEnoughMemory
Matrix class error message.
void Create_FFT_Plan_1DX_C2R(TRealMatrix &OutMatrix)
Create FFTW plan for Complex-to-Real in the X dimension.
virtual ~TFFTWComplexMatrix()
Destructor.
Structure with 4D dimension sizes (3 in space and 1 in time).
The header file containing the class that implements 3D FFT using the FFTW interface.
static TParameters * GetInstance()
Get instance of the singleton class.