Logo ROOT   6.13/01
Reference Guide
TFFTRealComplex.h
Go to the documentation of this file.
1 // @(#)root/fft:$Id$
2 // Author: Anna Kreshuk 07/4/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TFFTRealComplex
13 #define ROOT_TFFTRealComplex
14 
15 //////////////////////////////////////////////////////////////////////////
16 //
17 // TFFTRealComplex
18 //
19 // One of the interface classes to the FFTW package, can be used directly
20 // or via the TVirtualFFT class. Only the basic interface of FFTW is implemented.
21 //
22 // Computes a real input/complex output discrete Fourier transform in 1 or more
23 // dimensions. However, only out-of-place transforms are now supported for transforms
24 // in more than 1 dimension. For detailed information about the computed transforms,
25 // please refer to the FFTW manual
26 //
27 // How to use it:
28 // 1) Create an instance of TFFTRealComplex - this will allocate input and output
29 // arrays (unless an in-place transform is specified)
30 // 2) Run the Init() function with the desired flags and settings (see function
31 // comments for possible kind parameters)
32 // 3) Set the data (via SetPoints()or SetPoint() functions)
33 // 4) Run the Transform() function
34 // 5) Get the output (via GetPoints() or GetPoint() functions)
35 // 6) Repeat steps 3)-5) as needed
36 // For a transform of the same size, but with different flags,
37 // rerun the Init() function and continue with steps 3)-5)
38 //
39 // NOTE: 1) running Init() function will overwrite the input array! Don't set any data
40 // before running the Init() function
41 // 2) FFTW computes unnormalized transform, so doing a transform followed by
42 // its inverse will lead to the original array scaled by the transform size
43 //
44 //
45 //////////////////////////////////////////////////////////////////////////
46 
47 #include "TVirtualFFT.h"
48 #include "TString.h"
49 
50 class TComplex;
51 
52 class TFFTRealComplex: public TVirtualFFT {
53  protected:
54  void *fIn; //input array
55  void *fOut; //output array
56  void *fPlan; //fftw plan (the plan how to compute the transform)
57  Int_t fNdim; //number of dimensions
58  Int_t fTotalSize; //total size of the transform
59  Int_t *fN; //transform sizes in each dimension
60  TString fFlags; //transform flags
61 
62  UInt_t MapFlag(Option_t *flag);
63 
64  public:
66  TFFTRealComplex(Int_t n, Bool_t inPlace);
67  TFFTRealComplex(Int_t ndim, Int_t *n, Bool_t inPlace);
68  virtual ~TFFTRealComplex();
69 
70  virtual void Init( Option_t *flags, Int_t /*sign*/,const Int_t* /*kind*/);
71 
72  virtual Int_t GetSize() const {return fTotalSize;}
73  virtual Int_t *GetN() const {return fN;}
74  virtual Int_t GetNdim() const {return fNdim;}
75  virtual Option_t *GetType() const {return "R2C";}
76  virtual Int_t GetSign() const {return 1;}
77  virtual Option_t *GetTransformFlag() const {return fFlags;}
78  virtual Bool_t IsInplace() const {if (fOut) return kTRUE; else return kFALSE;};
79 
80  virtual void GetPoints(Double_t *data, Bool_t fromInput = kFALSE) const;
81  virtual Double_t GetPointReal(Int_t ipoint, Bool_t fromInput = kFALSE) const;
82  virtual Double_t GetPointReal(const Int_t *ipoint, Bool_t fromInput = kFALSE) const;
83  virtual void GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
84  virtual void GetPointComplex(const Int_t *ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const;
85  virtual Double_t *GetPointsReal(Bool_t fromInput=kFALSE) const;
86  virtual void GetPointsComplex(Double_t *re, Double_t *im, Bool_t fromInput = kFALSE) const ;
87  virtual void GetPointsComplex(Double_t *data, Bool_t fromInput = kFALSE) const ;
88 
89  virtual void SetPoint(Int_t ipoint, Double_t re, Double_t im = 0);
90  virtual void SetPoint(const Int_t *ipoint, Double_t re, Double_t im = 0);
91  virtual void SetPoints(const Double_t *data);
92  virtual void SetPointComplex(Int_t ipoint, TComplex &c);
93  virtual void SetPointsComplex(const Double_t *re, const Double_t *im);
94  virtual void Transform();
95 
96  ClassDef(TFFTRealComplex,0);
97 };
98 
99 #endif
virtual Double_t * GetPointsReal(Bool_t fromInput=kFALSE) const
Returns the input array// One of the interface classes to the FFTW package, can be used directly or v...
virtual void GetPoints(Double_t *data, Bool_t fromInput=kFALSE) const
Fills the array data with the computed transform.
virtual ~TFFTRealComplex()
Destroys the data arrays and the plan.
virtual Double_t GetPointReal(Int_t ipoint, Bool_t fromInput=kFALSE) const
Returns the real part of the point #ipoint from the output or the point #ipoint from the input...
virtual void Transform()
Computes the transform, specified in Init() function.
virtual void GetPointsComplex(Double_t *re, Double_t *im, Bool_t fromInput=kFALSE) const
Fills the argument arrays with the real and imaginary parts of the computed transform.
virtual void SetPoint(Int_t ipoint, Double_t re, Double_t im=0)
Set the point #ipoint.
TFFTRealComplex()
default
virtual Option_t * GetType() const
virtual void Init(Option_t *flags, Int_t, const Int_t *)
Creates the fftw-plan.
virtual void SetPoints(const Double_t *data)
Set all input points.
virtual void GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const
Returns the point #ipoint.
virtual Int_t GetSize() const
UInt_t MapFlag(Option_t *flag)
allowed options: "ES" "M" "P" "EX"
virtual Option_t * GetTransformFlag() const
virtual Int_t GetNdim() const
virtual void SetPointsComplex(const Double_t *re, const Double_t *im)
Set all points. Only the real array is used.
virtual void SetPointComplex(Int_t ipoint, TComplex &c)
Sets the point #ipoint (only the real part of the argument is taken)
virtual Int_t GetSign() const
virtual Bool_t IsInplace() const
virtual Int_t * GetN() const