| 1 | #ifndef  FFTServ_H_SEEN | 
|---|
| 2 | #define  FFTServ_H_SEEN | 
|---|
| 3 |  | 
|---|
| 4 | #include <complex> | 
|---|
| 5 | #include "tvector.h" | 
|---|
| 6 |  | 
|---|
| 7 | class FFTServer{ | 
|---|
| 8 | public: | 
|---|
| 9 | FFTServer(); | 
|---|
| 10 | virtual ~FFTServer(); | 
|---|
| 11 | virtual void fftf(int l, float* inout); | 
|---|
| 12 | virtual void fftb(int l, float* inout); | 
|---|
| 13 | virtual void fftf(int l, double* inout); | 
|---|
| 14 | virtual void fftb(int l, double* inout); | 
|---|
| 15 | virtual void fftf(int l, complex<float>* inout); | 
|---|
| 16 | virtual void fftb(int l, complex<float>* inout); | 
|---|
| 17 | virtual void fftf(int l, complex<double>* inout); | 
|---|
| 18 | virtual void fftb(int l, complex<double>* inout); | 
|---|
| 19 | virtual void fftf(Vector& in, Vector& out); | 
|---|
| 20 | virtual void fftb(Vector& in, Vector& out); | 
|---|
| 21 |  | 
|---|
| 22 | protected: | 
|---|
| 23 | virtual void checkint_rfft(int l); | 
|---|
| 24 | virtual void checkint_dfft(int l); | 
|---|
| 25 | virtual void checkint_cfft(int l); | 
|---|
| 26 | virtual void checkint_cdfft(int l); | 
|---|
| 27 |  | 
|---|
| 28 | int sz_rfft; | 
|---|
| 29 | float* ws_rfft; | 
|---|
| 30 |  | 
|---|
| 31 | int sz_cfft; | 
|---|
| 32 | float* ws_cfft; | 
|---|
| 33 |  | 
|---|
| 34 | int sz_dfft; | 
|---|
| 35 | double* ws_dfft; | 
|---|
| 36 |  | 
|---|
| 37 | int sz_cdfft; | 
|---|
| 38 | double* ws_cdfft; | 
|---|
| 39 | }; | 
|---|
| 40 | #endif | 
|---|
| 41 |  | 
|---|
| 42 | /*! \class FFTServer | 
|---|
| 43 | \brief An FFT server | 
|---|
| 44 |  | 
|---|
| 45 | A class that calculates Fourier transforms forwards and backwards. | 
|---|
| 46 |  | 
|---|
| 47 | The class calls the c library ``fftpack'', which is accessible and documented | 
|---|
| 48 | at http://www.netlib.org/fftpack/.  However, the class functions do not | 
|---|
| 49 | necessarily correspond with the equivalent fftpack function.  For example, | 
|---|
| 50 | fftpack "forward" transformations are in fact inverse fourier transformations. | 
|---|
| 51 | Otherwise, the output is in the fftpack format. | 
|---|
| 52 |  | 
|---|
| 53 | Complex input must be entered using the <complex> template.  Otherwise, | 
|---|
| 54 | all input is assumed to be real. | 
|---|
| 55 |  | 
|---|
| 56 | Due to the way that fftpack manages | 
|---|
| 57 | its work arrays, an object can run faster if the length of the input arrays | 
|---|
| 58 | does not change.  For example, if you need to do a series of FFT's | 
|---|
| 59 | of differing length, it may be more efficient to create an fftserver object | 
|---|
| 60 | for each length. | 
|---|
| 61 | */ | 
|---|
| 62 |  | 
|---|
| 63 | /*! \fn virtual void FFTServer::fftf(int l, float* inout) | 
|---|
| 64 | \param l length of array | 
|---|
| 65 | \param inout input array /output forward FFT (original array destroyed) | 
|---|
| 66 | */ | 
|---|
| 67 | /*! \fn virtual void FFTServer::fftb(int l, float* inout) | 
|---|
| 68 | \param l length of array | 
|---|
| 69 | \param inout input array /output backward FFT (original array destroyed) | 
|---|
| 70 | */ | 
|---|
| 71 | /*! \fn virtual void FFTServer::fftf(int l, double* inout) | 
|---|
| 72 | \param l length of array | 
|---|
| 73 | \param inout input array /output forward FFT (original array destroyed) | 
|---|
| 74 | \param inout input/output array (original array destroyed) | 
|---|
| 75 | */ | 
|---|
| 76 | /*! \fn virtual void FFTServer::fftb(int l, double* inout) | 
|---|
| 77 | \param l length of array | 
|---|
| 78 | \param inout input array /output backward FFT(original array destroyed) | 
|---|
| 79 | */ | 
|---|
| 80 | /*!\fn  virtual void FFTServer::fftf(int l, complex<float>* inout) | 
|---|
| 81 | \param l length of array | 
|---|
| 82 | \param inout input array /output forward FFT (original array destroyed) | 
|---|
| 83 | */ | 
|---|
| 84 | /*! \fn virtual void FFTServer::fftb(int l, complex<float>* inout) | 
|---|
| 85 | \param l length of array | 
|---|
| 86 | \param inout input array /output backward FFT (original array destroyed) | 
|---|
| 87 | */ | 
|---|
| 88 | /*! \fn virtual void FFTServer::fftf(int l, complex<double>* inout) | 
|---|
| 89 | \param l length of array | 
|---|
| 90 | \param inout input array /output forward FFT (original array destroyed) | 
|---|
| 91 | */ | 
|---|
| 92 | /*! \fn virtual void FFTServer::fftb(int l, complex<double>* inout) | 
|---|
| 93 | \param l length of array | 
|---|
| 94 | \param inout input array /output backward FFT(original array destroyed) | 
|---|
| 95 | */ | 
|---|
| 96 | /*!\fn  virtual void FFTServer::fftf(Vector& in, Vector& out) | 
|---|
| 97 | \param in input array | 
|---|
| 98 | \param out forward FFT | 
|---|
| 99 | */ | 
|---|
| 100 | /*! \fn virtual void FFTServer::fftb(Vector& in, Vector& out) | 
|---|
| 101 | \param in input array | 
|---|
| 102 | \param out backward FFT | 
|---|
| 103 | */ | 
|---|