// // written by Yue Zhao // #include #include #include #define PI 3.1415926535897932384626433 #define N 24 double maxval(double *x, double *y, int n); int main(int argc, char** argv) { // declare variables double *in, *out, *x, *u, *uprime, *fmx; double xlen, dx, t1; fftw_plan plan_r2hc, plan_hc2r; int i; // allocate memory spaces x = (double*) fftw_malloc(sizeof(double) * N); u = (double*) fftw_malloc(sizeof(double) * N); uprime = (double*) fftw_malloc(sizeof(double) * N); fmx = (double*) fftw_malloc(sizeof(double) * N); in = (double*) fftw_malloc(sizeof(double) * N); out = (double*) fftw_malloc(sizeof(double) * N); // make fftw plans printf("planning FFTW_R2HC with FFTW_PATIENT\n"); plan_r2hc = fftw_plan_r2r_1d(N, in, out, FFTW_R2HC, FFTW_PATIENT); printf("planning FFTW_HC2R with FFTW_PATIENT\n"); plan_hc2r = fftw_plan_r2r_1d(N, out, in, FFTW_HC2R, FFTW_PATIENT); // initialize data xlen = 2.0*PI; dx = xlen /(double)N; for (i=0; i