TFFTRealComplex.h

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

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