NASA - Jet Propulsion Laboratory
    + View the NASA Portal
Search JPL
Jet Propulsion Laboratory Home Earth Solar System Stars & Galaxies Technology
Introduction Background Software Links

fftpack_support.h

00001 /*
00002  *  This file is part of Healpix_cxx.
00003  *
00004  *  Healpix_cxx is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  Healpix_cxx is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with Healpix_cxx; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017  *
00018  *  For more information about HEALPix, see http://healpix.jpl.nasa.gov
00019  */
00020 
00021 /*
00022  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
00023  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
00024  *  (DLR).
00025  */
00026 
00027 /*
00028  *  Copyright (C) 2004 Max-Planck-Society
00029  *  \author Martin Reinecke
00030  */
00031 
00032 #ifndef PLANCK_FFTPACK_SUPPORT_H
00033 #define PLANCK_FFTPACK_SUPPORT_H
00034 
00035 #include "ls_fft.h"
00036 #include "arr.h"
00037 #include "xcomplex.h"
00038 
00039 class cfft
00040   {
00041   private:
00042     int n;
00043     complex_plan plan;
00044 
00045   public:
00046     cfft () : n(-1), plan(0) {}
00047     cfft (int size_)
00048       : n(size_), plan(make_complex_plan(size_)) {}
00049     ~cfft ()
00050       { if (plan!=0) kill_complex_plan (plan); }
00051     void Set (int size_)
00052       {
00053       if (plan!=0) kill_complex_plan (plan);
00054       n=size_;
00055       plan=make_complex_plan(size_);
00056       }
00057 
00058     int size() const
00059       { return n; }
00060 
00061     void forward (double *data)
00062       { complex_plan_forward(plan,data); }
00063     void backward (double *data)
00064       { complex_plan_backward(plan,data); }
00065     void forward (arr<xcomplex<double> >&data)
00066       { forward(&(data[0].re)); }
00067     void backward (arr<xcomplex<double> >&data)
00068       { backward(&(data[0].re)); }
00069   };
00070 
00071 class rfft
00072   {
00073   private:
00074     int n;
00075     real_plan plan;
00076 
00077   public:
00078     rfft () : n(-1), plan(0) {}
00079     rfft (int size_)
00080       : n(size_), plan(make_real_plan(size_)) {}
00081     ~rfft ()
00082       { if (plan!=0) kill_real_plan (plan); }
00083     void Set (int size_)
00084       {
00085       if (plan!=0) kill_real_plan (plan);
00086       n=size_;
00087       plan=make_real_plan(size_);
00088       }
00089 
00090     int size() const
00091       { return n; }
00092 
00093     void forward_fftpack (double *data)
00094       { real_plan_forward_fftpack(plan,data); }
00095     void backward_fftpack (double *data)
00096       { real_plan_backward_fftpack(plan,data); }
00097     void forward_fftpack (arr<double> &data)
00098       { forward_fftpack(&(data[0])); }
00099     void backward_fftpack (arr<double> &data)
00100       { backward_fftpack(&(data[0])); }
00101     void forward_c (arr<xcomplex<double> >&data)
00102       { real_plan_forward_c(plan,&(data[0].re)); }
00103     void backward_c (arr<xcomplex<double> >&data)
00104       { real_plan_backward_c(plan,&(data[0].re)); }
00105   };
00106 
00107 #endif

Generated on Fri Jun 18 16:12:29 2010 for LevelS C++ support library
Privacy / Copyright
FIRST GOV Contact: NASA Home Page Site Manager:
Webmaster:

CL 03-2650