#include "ft.h"

#define CFFTS_BARRIER(m)    barrier(m)

//---------------------------------------------------------------------
// evolve u0 -> u1 (t time steps) in fourier space
//---------------------------------------------------------------------
__kernel void evolve(__global dcomplex *u0,
                     __global dcomplex *u1,
                     __global const double *twiddle,
                     int d1,
                     int d2,
                     int d3)
{
  int k = get_global_id(2);
  int j = get_global_id(1);
  int i = get_global_id(0);
  if (k >= d3 || j >= d2 || i >= d1) return;

  int idx = k*d2*(d1+1) + j*(d1+1) + i;
  u0[idx] = dcmplx_mul2(u0[idx], twiddle[idx]);
  u1[idx].real = u0[idx].real;
  u1[idx].imag = u0[idx].imag;
}

