realFFTData.H Source File

Main Page Compound List File List Compound Members Examples

# realFFTData.H

    00001 /* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
    00002    This file is part of the MFFM FFTw Wrapper library.
    00003
    00004    MFFM MFFM FFTw Wrapper library is free software; you can
    00005    redistribute it and/or modify
    00006    it under the terms of the GNU General Public License as published by
    00007    the Free Software Foundation; either version 2 of the License, or
    00008    (at your option) any later version.
    00009
    00010    MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
    00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013    GNU General Public License for more details.
    00014
    00015    You have received a copy of the GNU General Public License
    00016    along with the MFFM FFTw Wrapper library
    00017 */
    00018 #ifndef REALFFTDATA_H_
    00019 #define REALFFTDATA_H_
    00020
    00021 #include "realFFT.H"
    00022 #include <fftw3.h>
    00023
    00024 #include <iomanip.h>
    00025 using namespace std;
    00026
    00027 #ifndef fftw_real
    00028 #define fftw_real double
    00029 #endif
    00030
    00031 /// class realFFTData controls and manipulates fft data
    00032 class realFFTData {
    00033   /// Var used to specify if the memory was allocated by the realFFTData class
    00034   int deleteInOutMemory;
    00035 public:
    00036   /// Specifies the size of the data array
    00037   int size;
    00038   /// Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPowerSpec
    00039   int minPowerBin, maxPowerBin;
    00040   /// the input, output and power_spectrum arrays
    00041   fftw_real *in, *out, *power_spectrum; //, *powerDeriv; power deriv. removed for now
    00042   /// The total power (summed) of the power spectrum as used in the method compPowerSpec
    00043   double totalPower;
    00044
    00045   /// All memory to be allocated internally
    00046   realFFTData(int sz);
    00047   /// input and output data arrays are to be allocated by another process
    00048   realFFTData(int sz, fftw_real*inp, fftw_real*outp);
    00049   /// Deconstructor
    00050   ~realFFTData(void);
    00051
    00052   /// Limits the maximum to 'lim' and returns the last fft bin with max
    00053   int limitHalfPowerSpec(double lim);
    00054
    00055   /// Returns the number of elements in the input and output arrays
    00056   int getSize(void){return size;}
    00057   /// Returns the number of elements in the power spectrum array
    00058   int getHalfSize(void){ if (!(size%2)) return size/2; else return size/2+1;}
    00059
    00060   /// Returns the maximum input variable
    00061   fftw_real findMaxIn(void);
    00062   /// Fills the max and min power spectrum bins
    00063   void findMaxMinPowerBins(void);
    00064
    00065   /// This function computes the power spectrum and returns the max bin
    00066   int compPowerSpec();
    00067   /// This function computes the square root of the power spectrum and returns the max bin
    00068   int sqrtPowerSpec();
    00069
    00070   //  int powerSpecDeriv(); // Find the derivative of the power spectrum
    00071
    00072   /// This function zeros the output data array (out)
    00073   void zeroFFTData(void);
    00074 };
    00075 #endif // REALFFTDATA_H_