TFFTReal.h

Go to the documentation of this file.
00001 // @(#)root/fft:$Id: TFFTReal.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Anna Kreshuk   07/4/2006
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TFFTReal
00013 #define ROOT_TFFTReal
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      
00017 // TFFTReal                                                       
00018 // One of the interface classes to the FFTW package, can be used directly
00019 // or via the TVirtualFFT class. Only the basic interface of FFTW is implemented.
00020 //
00021 // Computes transforms called r2r in FFTW manual: 
00022 // - transforms of real input and output in "halfcomplex" format i.e. 
00023 //   real and imaginary parts for a transform of size n stored as 
00024 //   (r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1)
00025 // - discrete Hartley transform
00026 // - sine and cosine transforms (DCT-I,II,III,IV and DST-I,II,III,IV)
00027 // For the detailed information on the computed
00028 // transforms please refer to the FFTW manual, chapter "What FFTW really computes".
00029 //
00030 // How to use it:
00031 // 1) Create an instance of TFFTReal - this will allocate input and output
00032 //    arrays (unless an in-place transform is specified)
00033 // 2) Run the Init() function with the desired flags and settings (see function
00034 //    comments for possible kind parameters)
00035 // 3) Set the data (via SetPoints()or SetPoint() functions)
00036 // 4) Run the Transform() function
00037 // 5) Get the output (via GetPoints() or GetPoint() functions)
00038 // 6) Repeat steps 3)-5) as needed
00039 // For a transform of the same size, but of different kind (or with different flags), 
00040 // rerun the Init() function and continue with steps 3)-5)
00041 //
00042 // NOTE: 1) running Init() function will overwrite the input array! Don't set any data
00043 //          before running the Init() function!
00044 //       2) FFTW computes unnormalized transform, so doing a transform followed by 
00045 //          its inverse will lead to the original array scaled BY:
00046 //          - transform size (N) for R2HC, HC2R, DHT transforms
00047 //          - 2*(N-1) for DCT-I (REDFT00)
00048 //          - 2*(N+1) for DST-I (RODFT00)
00049 //          - 2*N for the remaining transforms
00050 // Transform inverses:
00051 // R2HC<-->HC2R
00052 // DHT<-->DHT
00053 // DCT-I<-->DCT-I
00054 // DCT-II<-->DCT-III
00055 // DCT-IV<-->DCT-IV
00056 // DST-I<-->DST-I
00057 // DST-II<-->DST-III
00058 // DST-IV<-->DST-IV
00059 // 
00060 //////////////////////////////////////////////////////////////////////////
00061 
00062 #ifndef ROOT_TVirtualFFT
00063 #include "TVirtualFFT.h"
00064 #endif
00065 
00066 class TComplex;
00067 
00068 class TFFTReal: public TVirtualFFT{
00069  protected:
00070    void     *fIn;         //input array
00071    void     *fOut;        //output array
00072    void     *fPlan;       //fftw plan (the plan how to compute the transform)
00073    Int_t     fNdim;       //number of dimensions
00074    Int_t     fTotalSize;  //total size of the transform
00075    Int_t    *fN;          //transform sizes in each dimension
00076    void     *fKind;       //transform kinds in each dimension
00077    Option_t *fFlags;      //transform flags
00078 
00079    Int_t  MapOptions(const Int_t *kind);
00080    UInt_t MapFlag(Option_t *flag);
00081 
00082  public:
00083    TFFTReal();
00084    TFFTReal(Int_t n, Bool_t inPlace=kFALSE);
00085    TFFTReal(Int_t ndim, Int_t *n, Bool_t inPlace=kFALSE);
00086    virtual ~TFFTReal();
00087 
00088    virtual void      Init( Option_t *flags,Int_t sign, const Int_t *kind);
00089 
00090    virtual Int_t     GetSize() const {return fTotalSize;}
00091    virtual Int_t    *GetN()    const {return fN;}
00092    virtual Int_t     GetNdim() const {return fNdim;}
00093    virtual Option_t *GetType() const;
00094    virtual Int_t     GetSign() const {return 0;}
00095    virtual Option_t *GetTransformFlag() const {return fFlags;}
00096    virtual Bool_t    IsInplace() const {if (fOut) return kTRUE; else return kFALSE;}
00097 
00098    virtual void      GetPoints(Double_t *data, Bool_t fromInput = kFALSE) const;
00099    virtual Double_t  GetPointReal(Int_t ipoint, Bool_t fromInput = kFALSE) const;
00100    virtual Double_t  GetPointReal(const Int_t *ipoint, Bool_t fromInput = kFALSE) const;
00101    virtual void      GetPointComplex(const Int_t *ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
00102 
00103    virtual void      GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
00104 
00105    virtual Double_t *GetPointsReal(Bool_t fromInput=kFALSE) const;
00106    virtual void      GetPointsComplex(Double_t* /*re*/, Double_t* /*im*/, Bool_t /*fromInput = kFALSE*/) const{};
00107    virtual  void     GetPointsComplex(Double_t* /*data*/, Bool_t /*fromInput = kFALSE*/) const {};
00108 
00109    virtual void      SetPoint(Int_t ipoint, Double_t re, Double_t im = 0);
00110    virtual void      SetPoint(const Int_t *ipoint, Double_t re, Double_t /*im=0*/);
00111    virtual void      SetPoints(const Double_t *data);
00112    virtual void      SetPointComplex(Int_t /*ipoint*/, TComplex &/*c*/){};
00113    virtual void      SetPointsComplex(const Double_t* /*re*/, const Double_t* /*im*/){};
00114    virtual void      Transform();
00115 
00116 
00117    ClassDef(TFFTReal,0);
00118 };
00119       
00120 #endif

Generated on Tue Jul 5 14:26:47 2011 for ROOT_528-00b_version by  doxygen 1.5.1