casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FFT2D.h
Go to the documentation of this file.
1 //# FFT2D.h
2 //# Copyright (C) 2016
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be adressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $kgolap$
28 #ifndef SYNTHESIS_FFT2D_H
29 #define SYNTHESIS_FFT2D_H
32 #include <fftw3.h>
33 namespace casa{
34  class FFT2D
35  {
37  //This is optimized with minimal memcopies for 2D FFTs
38  //Assumes 2D x, y array to be even numbers (e.g (100, 200)...will not work for (101, 200))
39  //IMPORTANT: do not use the same FFT2D object for different sizes of x,y. Create
40  //another one if necessary as the plan or butterfly in fftpack, for x,y shape is kept
41  //and reused so may give wrong result if the FFT2D is used for x',y' shape !!
42  //
43  typedef unsigned long long ooLong;
44  public:
45  FFT2D(casacore::Bool useFFTW=true);
46  ~FFT2D();
47  FFT2D& operator=(const FFT2D& other);
48  //out has to be a pointer to an array [(x/2+1), y] shape
51  //the remainder of of the X part is untouched of out lattice is larger than
52  //X/2+1 on the x-axis
57  //This will return the 2D FFT of each x-y planes back into the lattice.
60  //Same as above EXCEPT
61  //will do the FFT in DComplex but input and output are Complex
63  //The toFreq=false in FFTShift does the normalization of 1/N_sample expected of ifft
70  //C style element conversion avoiding overhead of iterators etc...
71  static void complexConvert(casacore::DComplex*& srcD, casacore::Complex*& scr, const ooLong len, const casacore::Bool down=false);
72  private:
73  //casacore::FFTW stuff
74  fftwf_plan planC2C_forw_p;
75  fftwf_plan planC2C_back_p;
76  fftwf_plan planR2C_p;
77  fftw_plan planC2CD_forw_p;
78  fftw_plan planC2CD_back_p;
80  //casacore::FFTPack stuff
81  std::vector<casacore::Float> wsave_p;
83  //casacore::FFTW fft1_p;
85  };
86 };// end of namespace casa
87 #endif
void doFFT(casacore::Complex *&out, casacore::Long x, casacore::Long y, casacore::Bool toFreq)
fftwf_plan planC2C_back_p
Definition: FFT2D.h:75
int Int
Definition: aipstype.h:50
FFT2D(casacore::Bool useFFTW=true)
void c2cFFT(casacore::Complex *&out, casacore::Long x, casacore::Long y, casacore::Bool toFreq=true)
In place 2D FFT; out has to be of shape x,y
void r2cFFT(casacore::Complex *&out, casacore::Float *&in, casacore::Long x, casacore::Long y)
out has to be a pointer to an array [(x/2+1), y] shape
fftwf_plan planR2C_p
Definition: FFT2D.h:76
long Long
Definition: aipstype.h:52
fftw_plan planC2CD_forw_p
Definition: FFT2D.h:77
void c2cFFTInDouble(casacore::Lattice< casacore::Complex > &inout, casacore::Bool toFreq=true)
Same as above EXCEPT will do the FFT in DComplex but input and output are Complex.
void fftShift(casacore::Complex *&scr, casacore::Long x, casacore::Long y, casacore::Bool toFreq=false)
The toFreq=false in FFTShift does the normalization of 1/N_sample expected of ifft.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
std::vector< casacore::Float > wsave_p
casacore::FFTPack stuff
Definition: FFT2D.h:81
fftwf_plan planC2C_forw_p
casacore::FFTW stuff
Definition: FFT2D.h:74
casacore::Int lsav_p
Definition: FFT2D.h:82
unsigned long long ooLong
This is a not a full generic fft class...use casacore::FFTServer or casacore::LatticeFFT for that...
Definition: FFT2D.h:43
casacore::Long nx_p
casacore::FFTW fft1_p;
Definition: FFT2D.h:84
casacore::Bool useFFTW_p
Definition: FFT2D.h:79
casacore::Long ny_p
Definition: FFT2D.h:84
fftw_plan planC2CD_back_p
Definition: FFT2D.h:78
FFT2D & operator=(const FFT2D &other)
static void complexConvert(casacore::DComplex *&srcD, casacore::Complex *&scr, const ooLong len, const casacore::Bool down=false)
C style element conversion avoiding overhead of iterators etc...