ROOT logo
// @(#)root/fft:$Id: TFFTComplexReal.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Anna Kreshuk   07/4/2006

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TFFTComplexReal
#define ROOT_TFFTComplexReal

//////////////////////////////////////////////////////////////////////////
//                                                                      
// TFFTComplexReal                                                          
//                                                                      
// One of the interface classes to the FFTW package, can be used directly
// or via the TVirtualFFT class. Only the basic interface of FFTW is implemented.
//
// Computes the inverse of the real-to-complex transforms (class TFFTRealComplex)
// taking complex input (storing the non-redundant half of a logically Hermitian array)
// to real output (see FFTW manual for more details)
// 
// How to use it:
// 1) Create an instance of TFFTComplexReal - this will allocate input and output
//    arrays (unless an in-place transform is specified)
// 2) Run the Init() function with the desired flags and settings
// 3) Set the data (via SetPoints(), SetPoint() or SetPointComplex() functions)
// 4) Run the Transform() function
// 5) Get the output (via GetPoints(), GetPoint() or GetPointReal() functions)
// 6) Repeat steps 3)-5) as needed
//
// For a transform of the same size, but with different flags, rerun the Init()
// function and continue with steps 3)-5)
// NOTE: 1) running Init() function will overwrite the input array! Don't set any data
//          before running the Init() function
//       2) FFTW computes unnormalized transform, so doing a transform followed by 
//          its inverse will lead to the original array scaled by the transform size
//                                                                      
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TVirtualFFT
#include "TVirtualFFT.h"
#endif

class TComplex;

class TFFTComplexReal: public TVirtualFFT {

 protected:
   void     *fIn;        //input array
   void     *fOut;       //output array
   void     *fPlan;      //fftw plan (the plan how to compute the transform)
   Int_t     fNdim;      //number of dimensions
   Int_t     fTotalSize; //total size of the transform
   Int_t    *fN;         //transform sizes in each dimension
   Option_t *fFlags;     //transform flags

   UInt_t MapFlag(Option_t *flag);

 public:
   TFFTComplexReal();
   TFFTComplexReal(Int_t n, Bool_t inPlace);
   TFFTComplexReal(Int_t ndim, Int_t *n, Bool_t inPlace);
   virtual ~TFFTComplexReal();

   virtual void       Init( Option_t *flags, Int_t /*sign*/,const Int_t* /*kind*/);

   virtual Int_t      GetSize() const {return fTotalSize;}
   virtual Int_t     *GetN()    const {return fN;}
   virtual Int_t      GetNdim() const {return fNdim;}
   virtual Option_t  *GetType() const {return "C2R";}
   virtual Int_t      GetSign() const {return -1;}
   virtual Option_t  *GetTransformFlag() const {return fFlags;}
   virtual Bool_t     IsInplace() const {if (fOut) return kTRUE; else return kFALSE;};

   virtual void       GetPoints(Double_t *data, Bool_t fromInput = kFALSE) const;
   virtual Double_t   GetPointReal(Int_t ipoint, Bool_t fromInput = kFALSE) const;
   virtual Double_t   GetPointReal(const Int_t *ipoint, Bool_t fromInput = kFALSE) const;
   virtual void       GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
   virtual void       GetPointComplex(const Int_t *ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
   virtual Double_t*  GetPointsReal(Bool_t fromInput=kFALSE) const;
   virtual void       GetPointsComplex(Double_t *re, Double_t *im, Bool_t fromInput = kFALSE) const ;
   virtual void       GetPointsComplex(Double_t *data, Bool_t fromInput = kFALSE) const ;
   
   virtual void       SetPoint(Int_t ipoint, Double_t re, Double_t im = 0);
   virtual void       SetPoint(const Int_t *ipoint, Double_t re, Double_t im = 0);
   virtual void       SetPoints(const Double_t *data);
   virtual void       SetPointComplex(Int_t ipoint, TComplex &c);
   virtual void       SetPointsComplex(const Double_t *re, const Double_t *im);
   virtual void       Transform();

   ClassDef(TFFTComplexReal,0);
};

#endif
 TFFTComplexReal.h:1
 TFFTComplexReal.h:2
 TFFTComplexReal.h:3
 TFFTComplexReal.h:4
 TFFTComplexReal.h:5
 TFFTComplexReal.h:6
 TFFTComplexReal.h:7
 TFFTComplexReal.h:8
 TFFTComplexReal.h:9
 TFFTComplexReal.h:10
 TFFTComplexReal.h:11
 TFFTComplexReal.h:12
 TFFTComplexReal.h:13
 TFFTComplexReal.h:14
 TFFTComplexReal.h:15
 TFFTComplexReal.h:16
 TFFTComplexReal.h:17
 TFFTComplexReal.h:18
 TFFTComplexReal.h:19
 TFFTComplexReal.h:20
 TFFTComplexReal.h:21
 TFFTComplexReal.h:22
 TFFTComplexReal.h:23
 TFFTComplexReal.h:24
 TFFTComplexReal.h:25
 TFFTComplexReal.h:26
 TFFTComplexReal.h:27
 TFFTComplexReal.h:28
 TFFTComplexReal.h:29
 TFFTComplexReal.h:30
 TFFTComplexReal.h:31
 TFFTComplexReal.h:32
 TFFTComplexReal.h:33
 TFFTComplexReal.h:34
 TFFTComplexReal.h:35
 TFFTComplexReal.h:36
 TFFTComplexReal.h:37
 TFFTComplexReal.h:38
 TFFTComplexReal.h:39
 TFFTComplexReal.h:40
 TFFTComplexReal.h:41
 TFFTComplexReal.h:42
 TFFTComplexReal.h:43
 TFFTComplexReal.h:44
 TFFTComplexReal.h:45
 TFFTComplexReal.h:46
 TFFTComplexReal.h:47
 TFFTComplexReal.h:48
 TFFTComplexReal.h:49
 TFFTComplexReal.h:50
 TFFTComplexReal.h:51
 TFFTComplexReal.h:52
 TFFTComplexReal.h:53
 TFFTComplexReal.h:54
 TFFTComplexReal.h:55
 TFFTComplexReal.h:56
 TFFTComplexReal.h:57
 TFFTComplexReal.h:58
 TFFTComplexReal.h:59
 TFFTComplexReal.h:60
 TFFTComplexReal.h:61
 TFFTComplexReal.h:62
 TFFTComplexReal.h:63
 TFFTComplexReal.h:64
 TFFTComplexReal.h:65
 TFFTComplexReal.h:66
 TFFTComplexReal.h:67
 TFFTComplexReal.h:68
 TFFTComplexReal.h:69
 TFFTComplexReal.h:70
 TFFTComplexReal.h:71
 TFFTComplexReal.h:72
 TFFTComplexReal.h:73
 TFFTComplexReal.h:74
 TFFTComplexReal.h:75
 TFFTComplexReal.h:76
 TFFTComplexReal.h:77
 TFFTComplexReal.h:78
 TFFTComplexReal.h:79
 TFFTComplexReal.h:80
 TFFTComplexReal.h:81
 TFFTComplexReal.h:82
 TFFTComplexReal.h:83
 TFFTComplexReal.h:84
 TFFTComplexReal.h:85
 TFFTComplexReal.h:86
 TFFTComplexReal.h:87
 TFFTComplexReal.h:88
 TFFTComplexReal.h:89
 TFFTComplexReal.h:90
 TFFTComplexReal.h:91
 TFFTComplexReal.h:92
 TFFTComplexReal.h:93
 TFFTComplexReal.h:94
 TFFTComplexReal.h:95
 TFFTComplexReal.h:96
 TFFTComplexReal.h:97
 TFFTComplexReal.h:98