TFFTComplex.h

Go to the documentation of this file.
00001 // @(#)root/fft:$Id: TFFTComplex.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_TFFTComplex
00013 #define ROOT_TFFTComplex
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      
00017 // TFFTComplex                                                           
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 // Computes complex input/output discrete Fourier transforms (DFT) 
00021 // in one or more dimensions. For the detailed information on the computed
00022 // transforms please refer to the FFTW manual, chapter "What FFTW really computes".
00023 // 
00024 // How to use it:
00025 // 1) Create an instance of TFFTComplex - this will allocate input and output
00026 //    arrays (unless an in-place transform is specified)
00027 // 2) Run the Init() function with the desired flags and settings
00028 // 3) Set the data (via SetPoints(), SetPoint() or SetPointComplex() functions)
00029 // 4) Run the Transform() function
00030 // 5) Get the output (via GetPoints(), GetPoint() or GetPointComplex() functions)
00031 // 6) Repeat steps 3)-5) as needed
00032 // 
00033 // For a transform of the same size, but with different flags or sign, rerun the Init()
00034 // function and continue with steps 3)-5)
00035 // NOTE: 1) running Init() function will overwrite the input array! Don't set any data
00036 //          before running the Init() function
00037 //       2) FFTW computes unnormalized transform, so doing a transform followed by 
00038 //          its inverse will lead to the original array scaled by the transform size
00039 //                                                                     
00040 //////////////////////////////////////////////////////////////////////////
00041 
00042 #ifndef ROOT_TVirtualFFT
00043 #include "TVirtualFFT.h"
00044 #endif
00045 
00046 class TComplex;
00047 
00048 class TFFTComplex : public TVirtualFFT{
00049 protected:
00050    void     *fIn;        //input array
00051    void     *fOut;       //output array
00052    void     *fPlan;      //fftw plan (the plan how to compute the transform)
00053    Int_t     fNdim;      //number of dimensions
00054    Int_t     fTotalSize; //total size of the transform
00055    Int_t    *fN;         //transform sizes in each dimension
00056    Int_t     fSign;      //sign of the exponent of the transform (-1 is FFTW_FORWARD and +1 FFTW_BACKWARD)
00057    Option_t *fFlags;     //transform flags
00058 
00059    UInt_t MapFlag(Option_t *flag);
00060 
00061 public:
00062    TFFTComplex();
00063    TFFTComplex(Int_t n, Bool_t inPlace);
00064    TFFTComplex(Int_t ndim, Int_t *n, Bool_t inPlace = kFALSE);
00065    virtual ~TFFTComplex();
00066 
00067    virtual void       Init(Option_t *flags, Int_t sign, const Int_t* /*kind*/);
00068 
00069    virtual Int_t     *GetN()    const {return fN;}
00070    virtual Int_t      GetNdim() const {return fNdim;}
00071    virtual Int_t      GetSize() const {return fTotalSize;}
00072    virtual Option_t  *GetType() const {if (fSign==-1) return "C2CBackward"; else return "C2CForward";}
00073    virtual Int_t      GetSign() const {return fSign;}
00074    virtual Option_t  *GetTransformFlag() const {return fFlags;}
00075    virtual Bool_t     IsInplace() const {if (fOut) return kTRUE; else return kFALSE;};
00076 
00077    virtual void       GetPoints(Double_t *data, Bool_t fromInput = kFALSE) const;
00078    virtual Double_t   GetPointReal(Int_t /*ipoint*/, Bool_t /*fromInput = kFALSE*/) const {return 0;};
00079    virtual Double_t   GetPointReal(const Int_t* /*ipoint*/, Bool_t /*fromInput=kFALSE*/) const{return 0;}
00080    virtual void       GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
00081    virtual void       GetPointComplex(const Int_t *ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
00082    virtual Double_t*  GetPointsReal(Bool_t /*fromInput=kFALSE*/) const {return 0;};
00083    virtual void       GetPointsComplex(Double_t *re, Double_t *im, Bool_t fromInput = kFALSE) const ;
00084    virtual void       GetPointsComplex(Double_t *data, Bool_t fromInput = kFALSE) const ;
00085    
00086    virtual void       SetPoint(Int_t ipoint, Double_t re, Double_t im = 0);
00087    virtual void       SetPoint(const Int_t *ipoint, Double_t re, Double_t im = 0);
00088    virtual void       SetPoints(const Double_t *data);
00089    virtual void       SetPointComplex(Int_t ipoint, TComplex &c);
00090    virtual void       SetPointsComplex(const Double_t *re, const Double_t *im);
00091    virtual void       Transform();
00092 
00093    ClassDef(TFFTComplex,0);
00094 };
00095 
00096 #endif

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