FFTW.h

Go to the documentation of this file.
00001 //# Copyright (C) 1993,1994,1995,1997,1999,2000,2001
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 //# $Id$
00027 
00028 #ifndef SCIMATH_FFTW_H
00029 #define SCIMATH_FFTW_H
00030 
00031 #include <casacore/casa/aips.h>
00032 #include <casacore/casa/Arrays/Array.h>
00033 #include <casacore/casa/Arrays/ArrayLogical.h>
00034 #include <casacore/casa/Arrays/VectorIter.h>
00035 #include <casacore/casa/Arrays/Matrix.h>
00036 #include <casacore/casa/OS/Mutex.h>
00037 
00038 namespace casacore {
00039 
00040 //# Forward Declarations.
00041 class FFTWPlan;
00042 class FFTWPlanf;
00043 
00044 // <summary> C++ interface to the FFTWw library </summary>
00045 // <reviewed reviewer="NONE" date="" tests="" demos="">
00046 // </reviewed>
00047 // <synopsis>
00048 // This is a wrapper of FFTW3.
00049 // It is only active if FFTW3 was found during the build.
00050 // If not found, all functions won't do anything at all.
00051 // 
00052 // The interface is such that the presence of FFTW3 is only visible
00053 // in the implementation. The header file does not need to know.
00054 // In this way external code using this class does not need to set HAVE_FFTW.
00055 // </synopsis>
00056 
00057 class FFTW
00058 {
00059 public:
00060   FFTW() ;
00061   
00062   ~FFTW() ;
00063 
00064   // polymorphic interface to fftw[f]_plan...
00065   void plan_r2c(const IPosition &size, Float *in, Complex *out) ;
00066   void plan_r2c(const IPosition &size, Double *in, DComplex *out) ;
00067   void plan_c2r(const IPosition &size, Complex *in, Float *out) ;
00068   void plan_c2r(const IPosition &size, DComplex *in, Double *out) ;
00069   void plan_c2c_forward(const IPosition &size, DComplex *in) ;
00070   void plan_c2c_forward(const IPosition &size, Complex *in) ;
00071   void plan_c2c_backward(const IPosition &size, DComplex *in) ;
00072   void plan_c2c_backward(const IPosition &size, Complex *in) ;
00073   
00074   // polymorphic interface to fftw[f]_execute...
00075   void r2c(const IPosition &size, Float *in, Complex *out) ;
00076   void r2c(const IPosition &size, Double *in, DComplex *out) ;
00077   void c2r(const IPosition &size, Complex *in, Float *out);
00078   void c2r(const IPosition &size, DComplex *in, Double *out);
00079   void c2c(const IPosition &size, Complex *in, Bool forward);
00080   void c2c(const IPosition &size, DComplex *in, Bool forward);
00081 
00082 private:
00083   FFTWPlanf* itsPlanR2Cf;
00084   FFTWPlan*  itsPlanR2C;
00085   
00086   FFTWPlanf* itsPlanC2Rf;
00087   FFTWPlan*  itsPlanC2R;
00088   
00089   FFTWPlanf* itsPlanC2CFf;   // forward
00090   FFTWPlan*  itsPlanC2CF;
00091   
00092   FFTWPlanf* itsPlanC2CBf;   // backward
00093   FFTWPlan*  itsPlanC2CB;
00094   
00095   unsigned flags;
00096 
00097   static volatile Bool is_initialized_fftw;  // FFTW needs initialization
00098                                              // only once per process,
00099                                              // not once per object
00100   static Mutex theirMutex;          // Initialization mutex
00101 };    
00102     
00103 } //# NAMESPACE CASACORE - END
00104 
00105 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1