/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * This file is distributed subject to a Software License Agreement found * in the file LICENSE that is included with this distribution. \*************************************************************************/ /* file: contour_interp.c * contents: fft_interpolation_index1(), fft_interpolation_index2() * purpose: interpolation, low-pass filtering, and other operations on * each dimension of a 2D array. * Michael Borland, 1993. $Log: fft_interp.c,v $ Revision 1.4 2002/08/14 17:35:27 soliday Added Open License Revision 1.3 1999/06/03 20:42:29 soliday Removed compiler warnings under Linux. Revision 1.2 1995/09/05 21:08:48 saunders First test release of the SDDS1.5 package. */ #include "mdb.h" #include "contour.h" #include "fftpackC.h" double **fft_interpolation_index1(double **data, long nx, long ny, long nx_mult, long lowpass, long flags) { long ix, iy, nx1, ix1, nfreq; double **newdata; static double *buffer; static long bufsize = 0; /* if (!power_of_2(nx)) bomb("old number of grid points must be 2^n", NULL); */ nx1 = nx*nx_mult; /* if (!power_of_2(nx1)) bomb("new number of grid points must be 2^n", NULL); */ nfreq = nx/2+1; if (lowpass>nfreq) bomb("lowpass cutoff frequency is invalid", NULL); if (bufsize<(nx1+2)) { bufsize = nx1+2; buffer = trealloc(buffer, sizeof(*buffer)*bufsize); } newdata = (double **) zarray_2d(sizeof(**newdata), nx1, ny); for (iy=0; iy0) { for (ix=nfreq-lowpass; ixmax) max = data[ix][iy]; for (ix=0; ixmax) newdata[ix][iy] = max; } if (flags&CONTOUR_ANTIRIPPLE) { for (iy=0; iynfreq) bomb("lowpass cutoff frequency is invalid", NULL); if (bufsize<(ny1+2)) { bufsize = ny1+2; buffer = trealloc(buffer, sizeof(*buffer)*bufsize); } newdata = (double **) zarray_2d(sizeof(**newdata), nx, ny1); for (ix=0; ix0) { for (iy=nfreq-lowpass; iymax) max = data[ix][iy]; for (ix=0; ixmax) newdata[ix][iy] = max; } if (flags&CONTOUR_ANTIRIPPLE) { for (ix=0; ix