Logo ROOT   6.16/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
50class TComplex;
51
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
97};
98
99#endif
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
UInt_t MapFlag(Option_t *flag)
allowed options: "ES" "M" "P" "EX"
virtual Int_t * GetN() const
virtual void SetPoint(Int_t ipoint, Double_t re, Double_t im=0)
Set the point #ipoint.
virtual void SetPoints(const Double_t *data)
Set all input points.
virtual Int_t GetSize() const
virtual Int_t GetSign() const
virtual void Init(Option_t *flags, Int_t, const Int_t *)
Creates the fftw-plan.
virtual Bool_t IsInplace() const
virtual void GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const
Returns the point #ipoint.
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 Option_t * GetType() const
virtual void Transform()
Computes the transform, specified in Init() function.
virtual ~TFFTRealComplex()
Destroys the data arrays and the plan.
virtual void GetPoints(Double_t *data, Bool_t fromInput=kFALSE) const
Fills the array data with the computed transform.
virtual void SetPointComplex(Int_t ipoint, TComplex &c)
Sets the point #ipoint (only the real part of the argument is taken)
virtual Option_t * GetTransformFlag() const
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.
TFFTRealComplex()
default
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 SetPointsComplex(const Double_t *re, const Double_t *im)
Set all points. Only the real array is used.
virtual Int_t GetNdim() const
Basic string class.
Definition: TString.h:131
TVirtualFFT is an interface class for Fast Fourier Transforms.
Definition: TVirtualFFT.h:88
const Int_t n
Definition: legend1.C:16