C++ main module for emicrom Package  1.0
FFTW_MultiLevelsDFT.h
Go to the documentation of this file.
1 #ifndef FFTW_MultiLevelsDFT_H
2 #define FFTW_MultiLevelsDFT_H
3 
4 #include "FFTW_FFT.h"
5 #include "FFTW_ComplexArray.h"
6 #include "FFTW_Plan.h"
7 
66 class FFTW_MultiLevelsDFT : public FFTW_FFT {
68  // ATTRIBUTES
69 
70 public:
71 
72 
73 
74 
75 private:
76 
77  //the number of points by level
79 
80 
81  // ASSOCIATIONS
82 
83  //number of threads by levels
85 
86  //plan values
88 
89 
90 protected:
91  // METHODS
92 
93  // CONSTRUCTORS
94 
97 
98 
99 
100  // DESTRUCTORS
101 
102 
105  virtual ~FFTW_MultiLevelsDFT(void);
106 
107 private:
111  void allocatePlanValues(const tUIndex& n);
114  void desallocatePlanValues();
115 
116 public:
117 
118  //New constrctors
121  inline static SP::FFTW_MultiLevelsDFT New() {
122  SP::FFTW_MultiLevelsDFT p(new FFTW_MultiLevelsDFT(),FFTW_MultiLevelsDFT::Delete());
123  p->setThis(p);
124  return p;
125  }
126 
127 
131  virtual SP::FFTW_FFT NewInstance() const {
132  return FFTW_MultiLevelsDFT::New();
133  }
134 
135 public:
136  //accessor operators
137  //==================
138 
143  inline const tFFTWComplex& operator()(const tUSInt& k,const tUIndex& i) const {
144  return (*this)[i+getPointsNumber()*k];
145  }
150  inline tFFTWComplex& operator()(const tUSInt& k,const tUIndex& i) {
151  return (*this)[i+getPointsNumber()*k];
152  }
153 
154 
155 
156 
157  //copy operator
158  //============
159 
160 
161 
165  virtual void copy(const FFTW_FFT& c);
166 
167  // SET methods
168  //============
169 
172  virtual void clear();
173 
178  virtual void setSize(const CORE_UIndexArray& levels,
179  const tUSInt& dim) {
180  setLevels(levels.getSize(),&levels[0],dim);
181  }
182 
189  tUIndex setLevels(const tUInt& nLevels,
190  const tUIndex levels[],
191  const tUSInt& dim);
192 
193 
198  virtual tUIndex setLevels(const CORE_UIndexArray& levels,const tUSInt& dim) {
199  return setLevels(levels.getSize(),&levels[0],dim);
200  }
201 
207  virtual void setFFTsNumber(const tUInt& n) {
208  tUIndex sT=0;
209  const tUInteger *Tu=&mThreadsNumber[0];
210  const tUIndex *Nu=&mLevels[0];
211  for (tUIndex u=0;u<mLevels.getSize();u++) {
212  sT+=(*Tu);
213  Nu++;
214  Tu++;
215  }
216  //set the number of plans
218  }
219 
220 
221 
222 
229  virtual void setFFT(const tUInt& f,
230  const tSInt& dir,
231  const tBoolean& isInverse,
232  const tBoolean& optimize);
238  virtual void setFFT(const tUInt& f,const tSInt& dir,const tBoolean& isInverse) {
239  FFTW_FFT::setFFT(f,dir,isInverse);
240  }
241 
246  virtual void setFFT(const tUInt& f,const tBoolean& isInverse) {
247  FFTW_FFT::setFFT(f,isInverse);
248  }
249  //GET Methods
250 
251 
252 
253 public:
262  virtual tULLInt getMemorySize() const {
263  return FFTW_FFT::getMemorySize()+((mY==null)?0:mY->getMemorySize());
264  }
268  virtual tUInt getFFTsNumber() const {
269  tUIndex sT=0;
270  const tUInteger *Tu=&mThreadsNumber[0];
271  const tUIndex *Nu=&mLevels[0];
272  for (tUIndex u=0;u<mLevels.getSize();u++) {
273  sT+=(*Tu);
274  Nu++;
275  Tu++;
276  }
277  return FFTW_FFT::getPlansNumber()/(sT*getDimension());
278  }
283  virtual tUIndex getSize(CORE_UIndexArray& levels) const{
284  levels.copy(mLevels);
285  return getPointsNumber();
286  }
287 
288 
293  inline const tUIndex& getSize(const tUInt& l) const {
294  return mLevels[l];
295  }
296 
300  const CORE_UIndexArray& getLevels() const {
301  return mLevels;
302  }
303 
307  inline const tUIndex & getLevelsNumber() const {
308  return mLevels.getSize();
309  }
310 
311 
312 
313  // OTHERS methods
314 
315 
335  virtual void runFFT(const tUIndex& f);
336 
337 
338 
339  //FFT methods
340 
341 
342 private:
343 
349  inline tUIndex getProjectionsNumber(const tUInt& l) const {
350  return getPointsNumber()/mLevels[l];
351  }
352 
353  //methods 1 based on global projection index
354  //===========================================
371  tUIndex computeProjection(const tUIndex& nLevels,const tUIndex* levels,const tUIndex& l,const tUIndex p,tUIndex& index0,tUIndex& step) const;
372 
384  void project(const tUIndex& nLevels,const tUIndex* levels,const tUIndex& l,const tUIndex& p,const tFFTWComplex* V,tFFTWComplex* A) const;
385 
396  void recover(const tUIndex& nLevels,const tUIndex* levels,const tUIndex& l,const tUIndex& p,const tFFTWComplex* A,tFFTWComplex* V) const;
397 
398  //methods 2 based on projection indices
399  //======================================
418  void computeProjectionIndex(const tUIndex& nLevels,const tUIndex *levels,
419  const tUIndex& l,const tUIndex& p,
420  tUIndex* I) const;
421 
434  void nextIndices(const tUIndex& nLevels,const tUIndex* levels,const tUIndex& l,tUIndex* I) const;
435 
447  void project(const tUIndex& nLevels,const tUIndex* levels,const tUIndex* I,const tUIndex& step,const tUIndex& N,
448  const tFFTWComplex* V,tFFTWComplex *Y) const;
449 
461  void recover(const tUIndex& nLevels,const tUIndex* levels,const tUIndex* I,const tUIndex& step,const tUIndex& N,
462  const tFFTWComplex* Y,tFFTWComplex *V) const;
463 
464  //PLAN Managment methods
465  //======================
466 protected:
477  virtual void setPlan(const tUIndex& i,FFTW_Plan& p);
478 
479 };
480 
481 #endif
const tUIndex & getSize(const tUInt &l) const
get the size of the levels at index l
Definition: FFTW_MultiLevelsDFT.h:293
const tUIndex & getSize() const
return the size of the array for reading
Definition: CORE_Array.h:1018
void nextIndices(const tUIndex &nLevels, const tUIndex *levels, const tUIndex &l, tUIndex *I) const
compute the next indices of the next projection to level l
Definition: FFTW_MultiLevelsDFT.cpp:586
This class describes an FFT Plan.
Definition: FFTW_Plan.h:15
virtual tUIndex getSize(CORE_UIndexArray &levels) const
get the size of the FFT in multi-levels form
Definition: FFTW_MultiLevelsDFT.h:283
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: FFTW_MultiLevelsDFT.h:262
const tUSInt & getDimension() const
get the dimension of the FFT
Definition: FFTW_FFT.h:259
#define tUInteger
Definition: types.h:91
This class describes Multi Level DFT routines based on fftw library.
Definition: FFTW_MultiLevelsDFT.h:66
CORE_UIndexArray mLevels
Definition: FFTW_MultiLevelsDFT.h:78
const CORE_UIndexArray & getLevels() const
get the levels size
Definition: FFTW_MultiLevelsDFT.h:300
This class manages the execution of Fast Fourier Transform. several fast Fourier Transforms may be ap...
Definition: FFTW_FFT.h:28
virtual void copy(const FFTW_FFT &c)
copy the MultiLevelsDFT
Definition: FFTW_MultiLevelsDFT.cpp:49
virtual void setFFTsNumber(const tUInt &n)
set the number of FFTs
Definition: FFTW_MultiLevelsDFT.h:207
DEFINE_SPTR(FFTW_MultiLevelsDFT)
static SP::FFTW_MultiLevelsDFT New()
create an array of Discrete fast Fourier Transform of size dim
Definition: FFTW_MultiLevelsDFT.h:121
virtual void setFFT(const tUInt &f, const tSInt &dir, const tBoolean &isInverse, const tBoolean &optimize)
set the FFT at index f
Definition: FFTW_MultiLevelsDFT.cpp:217
virtual void setPlan(const tUIndex &i, FFTW_Plan &p)
create the values for the plan at index i
Definition: FFTW_MultiLevelsDFT.cpp:321
const tUIndex & getLevelsNumber() const
get the number of levels
Definition: FFTW_MultiLevelsDFT.h:307
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
#define tFFTWComplex
Definition: fftw_types.h:65
FFTW_ComplexArray * mY
Definition: FFTW_MultiLevelsDFT.h:87
virtual void clear()
clear the FFT
Definition: FFTW_MultiLevelsDFT.cpp:36
tUIndex computeProjection(const tUIndex &nLevels, const tUIndex *levels, const tUIndex &l, const tUIndex p, tUIndex &index0, tUIndex &step) const
compute the projection at level l for projection p
Definition: FFTW_MultiLevelsDFT.cpp:404
#define null
Definition: types.h:144
CORE_UIntegerArray mThreadsNumber
Definition: FFTW_MultiLevelsDFT.h:84
void project(const tUIndex &nLevels, const tUIndex *levels, const tUIndex &l, const tUIndex &p, const tFFTWComplex *V, tFFTWComplex *A) const
project the values mValues to the working array A for plan at level l and coordinate k ...
Definition: FFTW_MultiLevelsDFT.cpp:476
FFTW_MultiLevelsDFT()
create a FFT object
Definition: FFTW_MultiLevelsDFT.cpp:6
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: FFTW_ComplexArray.h:388
SP_OBJECT(FFTW_MultiLevelsDFT)
tUIndex getProjectionsNumber(const tUInt &l) const
return the number of projection for level l
Definition: FFTW_MultiLevelsDFT.h:349
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: FFTW_FFT.h:220
#define tSInt
Definition: types.h:30
virtual SP::FFTW_FFT NewInstance() const
retun a new instance of this
Definition: FFTW_MultiLevelsDFT.h:131
virtual void runFFT(const tUIndex &f)
run the plan
Definition: FFTW_MultiLevelsDFT.cpp:732
#define tUInt
Definition: types.h:33
void setPlansNumber(const tUIndex &n)
set the number of plans
Definition: FFTW_FFT.h:298
This class describes FFT complex array based on fft_complex structure.
Definition: FFTW_ComplexArray.h:17
#define tUIndex
Definition: types.h:126
virtual tUIndex setLevels(const CORE_UIndexArray &levels, const tUSInt &dim)
set the levels of the DFTs
Definition: FFTW_MultiLevelsDFT.h:198
void allocatePlanValues(const tUIndex &n)
allocate the values of plan
Definition: FFTW_MultiLevelsDFT.cpp:22
tFFTWComplex & operator()(const tUSInt &k, const tUIndex &i)
get the complex value at level index i for coordinate k
Definition: FFTW_MultiLevelsDFT.h:150
const tFFTWComplex & operator()(const tUSInt &k, const tUIndex &i) const
get the complex value at level index i for coordinate k
Definition: FFTW_MultiLevelsDFT.h:143
void desallocatePlanValues()
desallocation the values of plans
Definition: FFTW_MultiLevelsDFT.cpp:29
const tUIndex & getPointsNumber() const
get the number of points
Definition: FFTW_FFT.h:265
void recover(const tUIndex &nLevels, const tUIndex *levels, const tUIndex &l, const tUIndex &p, const tFFTWComplex *A, tFFTWComplex *V) const
recover the values V from the working array A for plan l and coordinate k
Definition: FFTW_MultiLevelsDFT.cpp:503
virtual void setSize(const CORE_UIndexArray &levels, const tUSInt &dim)
set the size of the FFT in multilevels form
Definition: FFTW_MultiLevelsDFT.h:178
virtual void setFFT(const tUInt &f, const tBoolean &isInverse)
set the FFT at index f
Definition: FFTW_MultiLevelsDFT.h:246
#define tULLInt
Definition: types.h:45
tUIndex getPlansNumber() const
get the number of plans
Definition: FFTW_FFT.h:305
void computeProjectionIndex(const tUIndex &nLevels, const tUIndex *levels, const tUIndex &l, const tUIndex &p, tUIndex *I) const
compoute the index of the point corresponding to global projection index
Definition: FFTW_MultiLevelsDFT.cpp:525
tUIndex setLevels(const tUInt &nLevels, const tUIndex levels[], const tUSInt &dim)
set the levels of the DFTs
Definition: FFTW_MultiLevelsDFT.cpp:60
virtual void setFFT(const tUInt &f, const tSInt &dir, const tBoolean &isInverse, const tBoolean &optimize)=0
set the FFT
virtual tUInt getFFTsNumber() const
get the number of FFTs
Definition: FFTW_MultiLevelsDFT.h:268
virtual ~FFTW_MultiLevelsDFT(void)
destroy an FFT Object.
Definition: FFTW_MultiLevelsDFT.cpp:19
void copy(const CORE_Array< Q > &f)
copy the array
Definition: CORE_Array.hpp:16
virtual void setFFT(const tUInt &f, const tSInt &dir, const tBoolean &isInverse)
set the FFT at index f
Definition: FFTW_MultiLevelsDFT.h:238
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141