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 REALFFT_H_ 00019 #define REALFFT_H_ 00020 00021 #include "realFFTData.H" 00022 #include <fftw3.h> 00023 00024 #include <iomanip.h> 00025 using namespace std; 00026 00027 class realFFTData; 00028 00029 #define PLANTYPE FFTW_ESTIMATE 00030 00031 ///class realFFT controls fftw plans and executes fwd/inv transforms 00032 class realFFT { 00033 /// The fwd/inv plans 00034 fftw_plan fwdPlan, invPlan; 00035 00036 /// Method to create the plans 00037 void createPlan(void); 00038 /// Method to destroy the plans 00039 void destroyPlan(void); 00040 protected: 00041 /// The pointer to the relevant data 00042 realFFTData *data; 00043 public: 00044 /// fft init ... don't forget to associate data using switchData 00045 realFFT(void); 00046 /// fft init ... data pointed to by 'd' 00047 realFFT(realFFTData *d); 00048 /// fft deconstructor 00049 ~realFFT(void); 00050 00051 /// Use this to change associated fft data (for fft'ing) 00052 void switchData(realFFTData *d); 00053 00054 /// Forward transform the data (in to out) 00055 void fwdTransform(); // Forward fft 00056 /// Inverse transform the data (out to in) 00057 void invTransform(); // Inverse fft 00058 }; 00059 /** \example realFFTExample.cc 00060 * This is an example of how to use the class. 00061 * It transforms a sine tone stored in the .dat file and saves the 00062 * in, out, and power_spectrum results of using the class 00063 */ 00064 #endif // REALFFT_H_