/* Migmovie.c Migration in the (z, x, omega)-domain at a range of velocities to produce a movie of the migration process. Altered from wmig.c . From Claerbout (1985) p. 111. Usage: migmovie >outfile Compile: cc migmovie.c ctris.c colmft.c -fswitch -lm -o migmovie */ /* The usual includes */ #include #include /* Define complex multiplication and conjugate for declared struct complex */ #define rmul(x,y) (x.re * y.re - x.im * y.im) #define imul(x,y) (x.im * y.re + x.re * y.im) #define rcmul(x,y) (x.re * y.re + x.im * y.im) #define icmul(x,y) (x.im * y.re - x.re * y.im) /* Define complex division -- x/y for declared struct complex */ #define rdiv(x,y) ((x.re * y.re + x.im * y.im)/(y.re * y.re + y.im * y.im)) #define idiv(x,y) ((x.im * y.re - x.re * y.im)/(y.re * y.re + y.im * y.im)) /* Declare the structure to hold complex numbers */ struct complex { float re; float im; }; main() { /* Declare all variables */ int ix, nx, iz, nz, iw, nw, it, nt, iv, nv; float q[64][48], pi2, alpha, dt, dtau, dw, v, dv; struct complex cq[64][48], cd[48], ce[48], cf[48], aa, a, b, c, cshift; struct complex num, den, cq0[64][48]; /* Initialize constants */ nt = 64; nz = nt; nx = 48; pi2 = 2.0*3.141592; dt = 1; dtau = 1; dw = pi2/(dt*nt); nw = nt/2; /* alpha = v*v*dtau/(4*dx*dx) */ alpha = 0.25; nv = 11; dv = 1.0/(nv-1); /* Zero out data volume */ for (iz=0; iz