Changeset 1405 in Sophya for trunk/SophyaExt/IFFTW/fftwserver.cc
- Timestamp:
- Feb 15, 2001, 6:58:16 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/IFFTW/fftwserver.cc
r1403 r1405 3 3 #include "FFTW/rfftw.h" 4 4 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 */ 5 28 6 29 #define MAXND_FFTW 5 30 31 namespace SOPHYA { 7 32 8 33 class FFTWServerPlan { … … 27 52 28 53 }; 54 55 } // Fin du namespace 29 56 30 57 FFTWServerPlan::FFTWServerPlan(int n, fftw_direction dir, bool fgreal) … … 40 67 _n = n; 41 68 _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 44 80 } 45 81 … … 62 98 for(k=nd; k<MAXND_FFTW; k++) _nxyz[k] = -10; 63 99 _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 66 111 } 67 112 … … 86 131 fftw_destroy_plan(p); 87 132 p = fftw_create_plan(n, _dir, FFTW_ESTIMATE); 133 if (p == NULL) 134 throw AllocationError("FFTWServerPlan::Recreate failed to create plan (p) !"); 88 135 } 89 136 else { 90 137 rfftw_destroy_plan(rp); 91 138 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 93 143 } 94 144 … … 117 167 fftwnd_destroy_plan(pnd); 118 168 pnd = fftwnd_create_plan(_nd, _nxyz, _dir, FFTW_ESTIMATE); 169 if (pnd == NULL) 170 throw AllocationError("FFTWServerPlan::Recreate failed to create plan (pnd) !"); 119 171 } 120 172 else { 121 173 rfftwnd_destroy_plan(rpnd); 122 174 rpnd = rfftwnd_create_plan(_nd, _nxyz, _dir, FFTW_ESTIMATE); 175 if (rpnd == NULL) 176 throw AllocationError("FFTWServerPlan::Recreate failed to create plan (rpnd) !"); 123 177 } 124 178
Note:
See TracChangeset
for help on using the changeset viewer.