Commit 2c142a3d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

fft_set(): changed interface (return error code),

parent c1cd060d
......@@ -22,7 +22,6 @@
#include "dmemory.h"
#endif
#include "array.h"
#include "process_int.h"
#include "cdo_options.h"
......@@ -49,7 +48,7 @@
#define D60 (S60 + S60)
void
int
fft_set(double *trigs, long *ifax, long n)
{
const long len = n;
......@@ -104,8 +103,10 @@ fft_set(double *trigs, long *ifax, long n)
if (n > 8 || n == 7)
{
fprintf(stderr, "FFT does not work with len=%ld (n=%ld)!\n", len, n);
exit(1);
return -1;
}
return 0;
}
static int
......
......@@ -262,7 +262,8 @@ after_GP2FC(double *gp, double *fc, long nlat, long nlon, long nlev, long nfc)
{
if (trig) Free(trig);
trig = (double *) Malloc(nlon * sizeof(double));
fft_set(trig, ifax, nlon);
int status = fft_set(trig, ifax, nlon);
if (status < 0) exit(1);
}
gp2fc(trig, ifax, gp, fc, nlat, nlon, nlev, nfc);
......@@ -278,7 +279,8 @@ after_FC2GP(double *fc, double *gp, long nlat, long nlon, long nlev, long nfc)
{
if (trig) Free(trig);
trig = (double *) Malloc(nlon * sizeof(double));
fft_set(trig, ifax, nlon);
int status = fft_set(trig, ifax, nlon);
if (status < 0) exit(1);
}
fc2gp(trig, ifax, fc, gp, nlat, nlon, nlev, nfc);
......
......@@ -21,7 +21,7 @@ void after_legini_full(long ntr, long nlat, double *poli, double *pold, double *
void after_legini(long ntr, long nlat, double *poli, double *pold, double *coslat);
/* FFT */
void fft_set(double *trigs, long *ifax, long n);
int fft_set(double *trigs, long *ifax, long n);
void fc2gp(double *trig, const long *ifax, double *fc, double *gp, long nlat, long nlon, long nlev, long nfc);
void gp2fc(double *trig, const long *ifax, const double *gp, double *fc, long nlat, long nlon, long nlev, long nfc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment