Changeset 1405 in Sophya for trunk/SophyaExt/IFFTW/fftwserver.cc


Ignore:
Timestamp:
Feb 15, 2001, 6:58:16 PM (25 years ago)
Author:
ansari
Message:

Ajout documentation - Reza 15/2/2001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/IFFTW/fftwserver.cc

    r1403 r1405  
    33#include "FFTW/rfftw.h"
    44
     5/*!
     6  \class SOPHYA::FFTWServer
     7  \ingroup IFFTW
     8  An implementation of FFTServerInterface based on FFTW, double
     9  precision arrays, using FFTW package, availabale from http://www.fftw.org.
     10  Refer to FFTServerInterface for details about FFTServer operations.
     11
     12  \code
     13  #include "fftwserver.h"
     14  // ...
     15  TMatrix<r_8> in(24,32);
     16  TMatrix< complex<r_8> > out;
     17  in = RandomSequence();
     18  FFTWServer ffts;
     19  ffts.setNormalize(true);  // To have normalized transforms
     20  cout << " FFTServer info string= " << ffts.getInfo() << endl;
     21  cout << "in= " << in << endl;
     22  cout << " Calling ffts.FFTForward(in, out) : " << endl;
     23  ffts.FFTForward(in, out);
     24  cout << "out= " << out << endl;
     25  \endcode
     26
     27*/
    528
    629#define MAXND_FFTW 5
     30
     31namespace SOPHYA {
    732
    833class FFTWServerPlan {
     
    2752   
    2853};
     54
     55} // Fin du namespace
    2956
    3057FFTWServerPlan::FFTWServerPlan(int n, fftw_direction dir, bool fgreal)
     
    4067  _n = n; 
    4168  _dir = dir;
    42   if (fgreal) rp = rfftw_create_plan(n, dir, FFTW_ESTIMATE);
    43   else p = fftw_create_plan(n, dir, FFTW_ESTIMATE);
     69  if (fgreal) {
     70    rp = rfftw_create_plan(n, dir, FFTW_ESTIMATE);
     71    if (rp == NULL)
     72      throw AllocationError("FFTWServerPlan: failed to create plan (rp) !");
     73  }
     74  else {
     75    p = fftw_create_plan(n, dir, FFTW_ESTIMATE);
     76    if (p == NULL)
     77      throw AllocationError("FFTWServerPlan: failed to create plan (p) !");
     78  }
     79   
    4480}
    4581
     
    6298  for(k=nd; k<MAXND_FFTW; k++) _nxyz[k] = -10;
    6399  _dir = dir;
    64   if (fgreal) rpnd = rfftwnd_create_plan(_nd, _nxyz, dir, FFTW_ESTIMATE);
    65   else pnd = fftwnd_create_plan(_nd, _nxyz, dir, FFTW_ESTIMATE);
     100  if (fgreal) {
     101    rpnd = rfftwnd_create_plan(_nd, _nxyz, dir, FFTW_ESTIMATE);
     102    if (rpnd == NULL)
     103      throw AllocationError("FFTWServerPlan: failed to create plan (rpnd) !");
     104  }
     105  else {
     106    pnd = fftwnd_create_plan(_nd, _nxyz, dir, FFTW_ESTIMATE);
     107    if (pnd == NULL)
     108      throw AllocationError("FFTWServerPlan: failed to create plan (pnd) !");
     109  }
     110
    66111}
    67112
     
    86131    fftw_destroy_plan(p);
    87132    p = fftw_create_plan(n, _dir, FFTW_ESTIMATE);
     133    if (p == NULL)
     134      throw AllocationError("FFTWServerPlan::Recreate failed to create plan (p) !");
    88135  }
    89136  else {
    90137    rfftw_destroy_plan(rp);
    91138    rp = rfftw_create_plan(n, _dir, FFTW_ESTIMATE);
    92   }
     139    if (rp == NULL)
     140      throw AllocationError("FFTWServerPlan::Recreate failed to create plan (rp) !");
     141  }
     142
    93143}
    94144
     
    117167    fftwnd_destroy_plan(pnd);
    118168    pnd = fftwnd_create_plan(_nd, _nxyz, _dir, FFTW_ESTIMATE);
     169    if (pnd == NULL)
     170      throw AllocationError("FFTWServerPlan::Recreate failed to create plan (pnd) !");
    119171  }
    120172  else {
    121173    rfftwnd_destroy_plan(rpnd);
    122174    rpnd = rfftwnd_create_plan(_nd, _nxyz, _dir, FFTW_ESTIMATE);
     175    if (rpnd == NULL)
     176      throw AllocationError("FFTWServerPlan::Recreate failed to create plan (rpnd) !");
    123177  }
    124178
Note: See TracChangeset for help on using the changeset viewer.