TFFTComplexReal.h

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

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