56 mR2CFftPlan3D(nullptr), mC2RFftPlan3D(nullptr),
57 mR2CFftPlan1DX(nullptr), mR2CFftPlan1DY(nullptr), mR2CFftPlan1DZ(nullptr),
58 mC2RFftPlan1DX(nullptr), mC2RFftPlan1DY(nullptr), mC2RFftPlan1DZ(nullptr)
107 reinterpret_cast<fftwf_complex*
>(
mData),
125 reinterpret_cast<fftwf_complex*
>(
mData),
146 const int nxR = ((nx / 2) + 1);
157 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 159 const int howManyRank = 2;
160 fftw_iodim howManyDims[2];
163 howManyDims[0].is = nx * ny;
164 howManyDims[0].n = nz;
165 howManyDims[0].os = nxR * ny;
168 howManyDims[1].is = nx;
169 howManyDims[1].n = ny;
170 howManyDims[1].os = nxR;
174 #if (defined(__INTEL_COMPILER)) 175 const int howManyRank = 1;
176 fftw_iodim howManyDims[1];
179 howManyDims[0].is = nx;
180 howManyDims[0].n = ny;
181 howManyDims[0].os = nxR;
189 reinterpret_cast<fftwf_complex*
>(
mData),
210 const int nyR = ((ny / 2) + 1);
221 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 223 const int howManyRank = 2;
224 fftw_iodim howManyDims[2];
227 howManyDims[0].is = nx * ny;
228 howManyDims[0].n = nz;
229 howManyDims[0].os = nx * nyR ;
232 howManyDims[1].is = 1;
233 howManyDims[1].n = nx;
234 howManyDims[1].os = 1;
238 #if (defined(__INTEL_COMPILER)) 239 const int howManyRank = 1;
240 fftw_iodim howManyDims[1];
243 howManyDims[0].is = 1;
244 howManyDims[0].n = nx;
245 howManyDims[0].os = 1;
253 reinterpret_cast<fftwf_complex*
>(
mData),
278 dims[0].is = nx * ny;
280 dims[0].os = nx * ny;
283 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 285 const int howManyRank = 2;
286 fftw_iodim howManyDims[2];
289 howManyDims[0].is = nx;
290 howManyDims[0].n = ny;
291 howManyDims[0].os = nx;
294 howManyDims[1].is = 1;
295 howManyDims[1].n = nx;
296 howManyDims[1].os = 1;
300 #if (defined(__INTEL_COMPILER)) 301 const int howManyRank = 1;
302 fftw_iodim howManyDims[1];
305 howManyDims[0].is = 1;
306 howManyDims[0].n = nx;
307 howManyDims[0].os = 1;
315 reinterpret_cast<fftwf_complex*
>(
mData),
335 const int nxR = ((nx / 2) + 1);
346 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 348 const int howManyRank = 2;
349 fftw_iodim howManyDims[2];
352 howManyDims[0].is = nxR * ny;
353 howManyDims[0].n = nz;
354 howManyDims[0].os = nx * ny;
357 howManyDims[1].is = nxR;
358 howManyDims[1].n = ny;
359 howManyDims[1].os = nx;
363 #if (defined(__INTEL_COMPILER)) 364 const int howManyRank = 1;
365 fftw_iodim howManyDims[1];
368 howManyDims[0].is = nxR;
369 howManyDims[0].n = ny;
370 howManyDims[0].os = nx;
377 reinterpret_cast<fftwf_complex*>(
mData),
398 const int nyR = ((ny / 2) + 1);
409 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 411 const int howManyRank = 2;
412 fftw_iodim howManyDims[2];
415 howManyDims[0].is = nx * nyR;
416 howManyDims[0].n = nz;
417 howManyDims[0].os = nx * ny;
420 howManyDims[1].is = 1;
421 howManyDims[1].n = nx;
422 howManyDims[1].os = 1;
426 #if (defined(__INTEL_COMPILER)) 427 const int howManyRank = 1;
428 fftw_iodim howManyDims[1];
431 howManyDims[0].is = 1;
432 howManyDims[0].n = nx;
433 howManyDims[0].os = 1;
440 reinterpret_cast<fftwf_complex*>(
mData),
466 dims[0].is = nx * ny;
468 dims[0].os = nx * ny;
471 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 473 const int howManyRank = 2;
474 fftw_iodim howManyDims[2];
477 howManyDims[0].is = nx;
478 howManyDims[0].n = ny;
479 howManyDims[0].os = nx;
482 howManyDims[1].is = 1;
483 howManyDims[1].n = nx;
484 howManyDims[1].os = 1;
488 #if (defined(__INTEL_COMPILER)) 489 const int howManyRank = 1;
490 fftw_iodim howManyDims[1];
493 howManyDims[0].is = 1;
494 howManyDims[0].n = nx;
495 howManyDims[0].os = 1;
502 reinterpret_cast<fftwf_complex*>(
mData),
553 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 556 reinterpret_cast<fftwf_complex*
>(
mData));
560 #if (defined(__INTEL_COMPILER)) 562 for (
size_t slab_id = 0; slab_id < dims.
nz; slab_id++)
566 (fftwf_complex *) &
mData[slab_id * 2 * (dims.
nx / 2 + 1) * dims.
ny]);
585 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 588 reinterpret_cast<fftwf_complex*
>(
mData));
592 #if (defined(__INTEL_COMPILER)) 594 for (
size_t slab_id = 0; slab_id < dims.
nz; slab_id++)
598 (fftwf_complex *) &
mData[slab_id * dims.
nx * 2 * (dims.
ny / 2 + 1)]);
617 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 620 reinterpret_cast<fftwf_complex*
>(
mData));
624 #if (defined(__INTEL_COMPILER)) 626 for (
size_t slab_id = 0; slab_id < dims.
ny; slab_id++)
630 (fftwf_complex *) &
mData[slab_id * 2 * dims.
nx]);
649 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 651 reinterpret_cast<fftwf_complex*>(
mData),
656 #if (defined(__INTEL_COMPILER)) 658 for (
size_t slab_id = 0; slab_id < dims.nz; slab_id++)
661 (fftwf_complex *) &
mData[slab_id * 2 * (dims.nx / 2 + 1) * dims.ny],
662 &outMatrix.
getData()[slab_id * dims.nx * dims.ny]);
681 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 683 reinterpret_cast<fftwf_complex*>(
mData),
688 #if (defined(__INTEL_COMPILER)) 690 for (
size_t slab_id = 0; slab_id < dims.nz; slab_id++)
693 (fftwf_complex *) &
mData[slab_id * dims.nx * 2 * (dims.ny / 2 + 1)],
694 &outMatrix.
getData()[slab_id * dims.nx * dims.ny]);
713 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 715 reinterpret_cast<fftwf_complex*>(
mData),
720 #if (defined(__INTEL_COMPILER)) 722 for (
size_t slab_id = 0; slab_id < dims.ny; slab_id++)
725 (fftwf_complex *) &
mData[slab_id * 2 * dims.nx ],
726 &outMatrix.
getData()[slab_id * dims.nx]);
742 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 757 #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER)) 792 throw std::bad_alloc();
796 #pragma omp parallel for simd schedule(static) 820 fileName.erase(fileName.find_last_of(
"."), std::string::npos);
822 fileName.append(
".");
The class for real matrices.
void createC2RFftPlan1DY(RealMatrix &outMatrix)
Create FFTW plan for Complex-to-Real in the y dimension.
void createC2RFftPlan3D(RealMatrix &outMatrix)
Create FFTW plan for 3D Complex-to-Real.
ErrorMessage kErrFmtCreateR2CFftPlan1DZ
FFTW error message.
ErrorMessage kErrFmtExecuteC2RFftPlan1DX
FFTW error message.
ErrorMessage kErrFmtExecuteR2CFftPlan3D
FFTW error message.
size_t nz
Number of elements in the z direction.
void computeC2RFft1DX(RealMatrix &outMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the x dimension.
ErrorMessage kErrFmtExecuteC2RFftPlan3D
FFTW error message.
std::string getCheckpointFileName() const
Get checkpoint file name.
ErrorMessage kErrFmtExecuteR2CFftPlan1DX
FFTW error message.
ErrorMessage kErrFmtCreateR2CFftPlan1DX
FFTW error message.
virtual ~FftwComplexMatrix()
Destructor.
static const unsigned kFftMeasureFlag
FFTW plan flag.
ErrorMessage kErrFmtCreateC2RFftPlan3D
FFTW error message.
The header file containing the class for real matrices.
void createC2RFftPlan1DX(RealMatrix &outMatrix)
Create FFTW plan for Complex-to-Real 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.
DimensionSizes getFullDimensionSizes() const
Get full dimension sizes of the simulation (real classes).
void computeC2RFft1DZ(RealMatrix &outMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the z dimension.
fftwf_plan mR2CFftPlan1DY
FFTW plan for the 3D Real-to-Complex transform in the y dimension.
fftwf_plan mC2RFftPlan1DX
FFTW plan for the 3D Complex-to-Real transform in the x dimension.
void createR2CFftPlan1DY(RealMatrix &inMatrix)
Create an FFTW plan for 1D Real-to-Complex in the y dimension.
fftwf_plan mC2RFftPlan3D
FFTW plan for the 3D Complex-to-Real transform.
static void exportWisdom()
Export wisdom to the file.
ErrorMessage kErrFmtExecuteC2RFftPlan1DY
FFTW error message.
The header file containing the parameters of the simulation.
ErrorMessage kErrFmtFftWisdomNotExported
FFTW error message.
void computeC2RFft3D(RealMatrix &outMatrix)
Compute forward out-of-place 3D Complex-to-Real FFT.
fftwf_plan mR2CFftPlan1DX
FFTW plan for the 1D Real-to-Complex transform in the x dimension.
float * mData
Raw matrix data.
ErrorMessage kErrFmtExecuteR2CFftPlan1DY
FFTW error message.
static void deleteStoredWisdom()
Destroy wisdom in the file (delete it).
virtual void freeMemory()
Free memory of the FFTW matrix.
void computeR2CFft3D(RealMatrix &inMatrix)
Compute forward out-of-place 3D Real-to-Complex FFT.
The header file containing a class responsible for printing out info and error messages (stdout...
The class for complex matrices.
fftwf_plan mR2CFftPlan3D
FFTW plan for the 3D Real-to-Complex transform.
ErrorMessage kErrFmtExecuteR2CFftPlan1DZ
FFTW error message.
fftwf_plan mR2CFftPlan1DZ
FFTW plan for the 3D Real-to-Complex transform in the z dimension.
ErrorMessage kErrFmtCreateC2RFftPlan1DX
FFTW error message.
Structure with 4D dimension sizes (3 in space and 1 in time).
void createC2RFftPlan1DZ(RealMatrix &outMatrix)
Create FFTW plan for Complex-to-Real in the z dimension.
size_t ny
Number of elements in the y direction.
static std::string getWisdomFileName()
void computeR2CFft1DX(RealMatrix &inMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the x dimension.
virtual float * getData()
Get raw data out of the class (for direct kernel access).
void computeR2CFft1DZ(RealMatrix &inMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the z dimension.
void createR2CFftPlan1DX(RealMatrix &inMatrix)
Create an FFTW plan for 1D Real-to-Complex in the x dimension.
size_t nx
Number of elements in the x direction.
ErrorMessage kErrFmtCreateR2CFftPlan3D
FFTW error message.
ErrorMessage kErrFmtExecuteC2RFftPlan1DZ
FFTW error message.
The header file containing the class that implements 3D FFT using the FFTW interface.
static Parameters & getInstance()
Get instance of the singleton class.
void computeC2RFft1DY(RealMatrix &outMatrix)
Compute 1D out-of-place Complex-to-Real FFT in the y dimension.
static void importWisdom()
Import wisdom from the file.
ErrorMessage kErrFmtCreateC2RFftPlan1DY
FFTW error message.
virtual const DimensionSizes & getDimensionSizes() const
Get dimension sizes of the matrix.
void createR2CFftPlan3D(RealMatrix &inMatrix)
Create FFTW plan for 3D Real-to-Complex.
static const std::string kFftWisdomFileExtension
The file extension for FFTW wisdom.
ErrorMessage ErrFmtFftWisdomNotImported
FFTW error message.
FftwComplexMatrix()=delete
Default constructor not allowed for public.
void createR2CFftPlan1DZ(RealMatrix &inMatrix)
Create an FFTW plan for 1D Real-to-Complex in the z dimension.
virtual void allocateMemory()
Allocate memory for the FFTW matrix.
ErrorMessage kErrFmtCreateR2CFftPlan1DY
FFTW error message.
void computeR2CFft1DY(RealMatrix &inMatrix)
Compute 1D out-of-place Real-to-Complex FFT in the y dimension.
size_t mCapacity
Total number of allocated elements (in terms of floats).