Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

fft_manager.h

Go to the documentation of this file.
00001 /*
00002 Arroyo - software for the simulation of electromagnetic wave propagation
00003 through turbulence and optics.
00004 
00005 Copyright (c) 2000-2004 California Institute of Technology.  Written by
00006 Dr. Matthew Britton.  For comments or questions about this software,
00007 please contact the author at mbritton@astro.caltech.edu.
00008 
00009 This program is free software; you can redistribute it and/or modify it
00010 under the terms of the GNU General Public License as  published by the
00011 Free Software Foundation; either version 2 of the License, or (at your
00012 option) any later version.
00013 
00014 This program is provided "as is" and distributed in the hope that it
00015 will be useful, but WITHOUT ANY WARRANTY; without even the implied
00016 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  In no
00017 event shall California Institute of Technology be liable to any party
00018 for direct, indirect, special, incidental or consequential damages,
00019 including lost profits, arising out of the use of this software and its
00020 documentation, even if the California Institute of Technology has been
00021 advised of the possibility of such damage.   The California Institute of
00022 Technology has no obligation to provide maintenance, support, updates,
00023 enhancements or modifications.  See the GNU General Public License for
00024 more details.
00025 
00026 You should have received a copy of the GNU General Public License along
00027 with this program; if not, write to the Free Software
00028 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00029 */
00030 
00031 #ifndef FFT_MANAGER_H
00032 #define FFT_MANAGER_H
00033 
00034 #ifndef FFTW_REAL_TO_COMPLEX
00035 #define FFTW_REAL_TO_COMPLEX FFTW_FORWARD
00036 #define FFTW_COMPLEX_TO_REAL FFTW_BACKWARD
00037 #endif
00038 
00039 #include <fftw3.h>
00040 #include <iostream>
00041 #include <vector>
00042 #include <string>
00043 #include "AO_cpp.h"
00044 
00045 
00046 namespace Arroyo {
00047 
00048   using std::string;
00049   using std::vector;
00050   using std::ostream;
00051 
00059 
00060   template<class T>
00061     class fft_manager {
00062 
00063     private:
00064   
00065 
00066     protected:
00067 
00068 
00069     public:
00070 
00073     fft_manager();
00074 
00077     fft_manager(const fft_manager<T> & fft_mgr);
00078 
00081     ~fft_manager();
00082 
00085     fft_manager<T> & operator=(const fft_manager<T> & fft_mgr);
00086 
00093     void forward_fft(const vector<long> & in_array_dimens,
00094                         bool estimate, bool in_place,
00095                         T * in, T * out = NULL);
00096   
00105     void forward_fft(const vector<long> & in_array_dimens,
00106                         bool estimate, bool in_place,
00107                         int howmany, T * in, int istride, int idist, 
00108                         T * out=NULL, int ostride=1, int odist=1);
00109   
00116     void backward_fft(const vector<long> & in_array_dimens,
00117                         bool estimate, bool in_place,
00118                         T * in, T * out = NULL);
00119 
00128     void backward_fft(const vector<long> & in_array_dimens,
00129                         bool estimate, bool in_place,
00130                         int howmany, T * in, int istride, int idist, 
00131                         T * out=NULL, int ostride=1, int odist=1);
00132 
00134     static int verbose_level;
00135 
00136   };
00137 
00138   template<class T>
00139     int fft_manager<T>::verbose_level = 0;
00140 
00141   template<class T>
00142     fft_manager<T>::fft_manager(const fft_manager<T> & fft_mgr){
00143 
00144     this->operator=(fft_mgr);
00145   }
00146 
00147   template<class T>
00148     fft_manager<T>::~fft_manager(){
00149   }
00150 
00151   template<class T>
00152     fft_manager<T> & fft_manager<T>::operator=(const fft_manager<T> & fft_mgr){
00153     if(this==&fft_mgr) 
00154       return(*this);
00155 
00156     return(*this);
00157   }
00158 
00159   template<class T>
00160     void fft_manager<T>::forward_fft(const vector<long> & in_array_dimens,
00161                         bool estimate, bool in_place,
00162                         T * in, T * out) {
00163       this->forward_fft(in_array_dimens, estimate, in_place, 1, in, 1, 1, out, 1, 1);
00164   }
00165 
00166   template<class T>
00167     void fft_manager<T>::backward_fft(const vector<long> & in_array_dimens,
00168                         bool estimate, bool in_place,
00169                         T * in, T * out) {
00170     this->backward_fft(in_array_dimens, estimate, in_place, 1, in, 1, 1, out, 1, 1);
00171   }
00172 
00173 
00178 
00179   template<class T>
00180     class rfft_manager {
00181 
00182     private:
00183   
00184  
00185     protected:
00186 
00187 
00188     public:
00189 
00192     rfft_manager();
00193 
00196     rfft_manager(const rfft_manager<T> & rfft_mgr);
00197 
00200     ~rfft_manager();
00201 
00204     rfft_manager<T> & operator=(const rfft_manager<T> & rfft_mgr);
00205 
00215     void real_to_complex_fft(const vector<long> & in_array_dimens,
00216                         bool estimate, bool in_place,
00217                         T * in, T * out = NULL) ;
00218 
00227     void real_to_complex_fft(const vector<long> & in_array_dimens,
00228                         bool estimate, bool in_place,
00229                         int howmany, T * in, int istride, int idist, 
00230                         T * out=NULL, int ostride=1, int odist=1) ;
00231  
00238     void complex_to_real_fft(const vector<long> & in_array_dimens,
00239                         bool estimate, bool in_place,
00240                         T * in, T * out = NULL) ;
00241 
00250     void complex_to_real_fft(const vector<long> & in_array_dimens,
00251                         bool estimate, bool in_place,
00252                         int howmany, T * in, int istride, int idist, 
00253                         T * out=NULL, int ostride=1, int odist=1) ;
00254  
00256     static int verbose_level;
00257 
00258   };
00259 
00260   template<class T>
00261     int rfft_manager<T>::verbose_level = 0;
00262 
00263 
00264   template<class T>
00265     rfft_manager<T>::rfft_manager(const rfft_manager<T> & rfft_mgr){
00266 
00267     this->operator=(rfft_mgr);
00268   }
00269 
00270   template<class T>
00271     rfft_manager<T>::~rfft_manager(){
00272 
00273   }
00274 
00275   template<class T>
00276     rfft_manager<T> & rfft_manager<T>::operator=(const rfft_manager<T> & rfft_mgr){
00277     if(this==&rfft_mgr) 
00278       return(*this);
00279 
00280     return(*this);
00281   }
00282 
00283   template<class T>
00284     void rfft_manager<T>::real_to_complex_fft(
00285                 const vector<long> & in_array_dimens,
00286                 bool estimate, bool in_place,
00287                 T * in, T * out) {
00288       this->real_to_complex_fft(in_array_dimens, estimate, in_place,
00289                                 1, in, 1, 1, out, 1, 1);
00290   }
00291 
00292   template<class T>
00293     void rfft_manager<T>::complex_to_real_fft(
00294                 const vector<long> & in_array_dimens,
00295                 bool estimate, bool in_place,
00296                 T * in, T * out) {
00297       this->complex_to_real_fft(in_array_dimens, estimate, in_place,
00298                                 1, in, 1, 1, out, 1, 1);
00299   }
00300 
00301 }
00302 
00303 #endif

Generated on Thu Nov 29 17:16:29 2007 for arroyo by  doxygen 1.3.9.1