MFFM FFTw Wrapper
realFFTData.H
1 /* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
2  This file is part of the MFFM FFTw Wrapper library.
3 
4  MFFM MFFM FFTw Wrapper library is free software; you can
5  redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You have received a copy of the GNU General Public License
16  along with the MFFM FFTw Wrapper library
17 */
18 #ifndef REALFFTDATA_H_
19 #define REALFFTDATA_H_
20 
21 #include "realFFT.H"
22 #include <fftw3.h>
23 
24 #include <iostream>
25 using namespace std;
26 
27 #ifndef fftw_real
28 #define fftw_real double
29 #endif
30 
31 /// class realFFTData controls and manipulates fft data
32 class realFFTData {
33  /// Var used to specify if the memory was allocated by the realFFTData class
34  int deleteInOutMemory;
35 public:
36  /// Specifies the size of the data array
37  int size;
38  /// Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPowerSpec
39  int minPowerBin, maxPowerBin;
40  /// the input, output and power_spectrum arrays
41  fftw_real *in, *out, *power_spectrum; //, *powerDeriv; power deriv. removed for now
42  /// The total power (summed) of the power spectrum as used in the method compPowerSpec
43  double totalPower;
44 
45  /// All memory to be allocated internally
46  realFFTData(int sz);
47  /// input and output data arrays are to be allocated by another process
48  realFFTData(int sz, fftw_real*inp, fftw_real*outp);
49  /// Deconstructor
50  ~realFFTData(void);
51 
52  /// Limits the maximum to 'lim' and returns the last fft bin with max
53  int limitHalfPowerSpec(double lim);
54 
55  /// Returns the number of elements in the input and output arrays
56  int getSize(void){return size;}
57  /// Returns the number of elements in the power spectrum array
58  int getHalfSize(void){ if (!(size%2)) return size/2; else return size/2+1;}
59 
60  /// Returns the maximum input variable
61  fftw_real findMaxIn(void);
62  /// Fills the max and min power spectrum bins
63  void findMaxMinPowerBins(void);
64 
65  /// This function computes the power spectrum and returns the max bin
67  /// This function computes the square root of the power spectrum and returns the max bin
69 
70  // int powerSpecDeriv(); // Find the derivative of the power spectrum
71 
72  /// This function zeros the output data array (out)
73  void zeroFFTData(void);
74 };
75 #endif // REALFFTDATA_H_
class realFFTData controls and manipulates fft data
Definition: realFFTData.H:32
fftw_real findMaxIn(void)
Returns the maximum input variable.
fftw_real * in
the input, output and power_spectrum arrays
Definition: realFFTData.H:41
int compPowerSpec()
This function computes the power spectrum and returns the max bin.
realFFTData(int sz, fftw_real *inp, fftw_real *outp)
input and output data arrays are to be allocated by another process
void zeroFFTData(void)
This function zeros the output data array (out)
realFFTData(int sz)
All memory to be allocated internally.
int limitHalfPowerSpec(double lim)
Limits the maximum to 'lim' and returns the last fft bin with max.
int minPowerBin
Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPower...
Definition: realFFTData.H:39
int sqrtPowerSpec()
This function computes the square root of the power spectrum and returns the max bin.
~realFFTData(void)
Deconstructor.
int getHalfSize(void)
Returns the number of elements in the power spectrum array.
Definition: realFFTData.H:58
double totalPower
The total power (summed) of the power spectrum as used in the method compPowerSpec.
Definition: realFFTData.H:43
int getSize(void)
Returns the number of elements in the input and output arrays.
Definition: realFFTData.H:56
void findMaxMinPowerBins(void)
Fills the max and min power spectrum bins.
int size
Specifies the size of the data array.
Definition: realFFTData.H:37