From 3de1f15919c4fe19bc3ea48379de572fd4d2613c Mon Sep 17 00:00:00 2001 From: JBrackenhoff <J.A.Brackenhoff@tudelft.nl> Date: Thu, 7 Jun 2018 14:12:21 +0200 Subject: [PATCH] applyMute --- marchenko_applications/applyMute.c | 30 +++++++++++++++--------------- marchenko_applications/imaging.c | 6 ++++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/marchenko_applications/applyMute.c b/marchenko_applications/applyMute.c index eb6e325..a30309a 100644 --- a/marchenko_applications/applyMute.c +++ b/marchenko_applications/applyMute.c @@ -31,10 +31,10 @@ void applyMute( float *data, int *mute, int smooth, int above, int Nfoc, int nxs for (i = 0; i < npos; i++) { imute = ixpos[i]; tmute = mute[isyn*nxs+imute]; - for (j = 0; j < tmute-shift-smooth; j++) { + for (j = 0; j < MAX(0,tmute-shift-smooth); j++) { data[isyn*nxs*nt+i*nt+j] = 0.0; } - for (j = tmute-shift-smooth,l=0; j < tmute-shift; j++,l++) { + for (j = MAX(0,tmute-shift-smooth),l=0; j < MAX(0,tmute-shift); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[smooth-l-1]; } } @@ -47,13 +47,13 @@ void applyMute( float *data, int *mute, int smooth, int above, int Nfoc, int nxs memset(&data[isyn*nxs*nt+i*nt],0, sizeof(float)*nt); continue; } - for (j = tmute-shift,l=0; j < tmute-shift+smooth; j++,l++) { + for (j = MAX(0,tmute-shift),l=0; j < MAX(0,tmute-shift+smooth); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[l]; } - for (j = tmute-shift+smooth+1; j < nt+1-tmute+shift-smooth; j++) { + for (j = MAX(0,tmute-shift+smooth)+1; j < MIN(nt,nt+1-tmute+shift-smooth); j++) { data[isyn*nxs*nt+i*nt+j] = 0.0; } - for (j = nt-tmute+shift-smooth,l=0; j < nt-tmute+shift; j++,l++) { + for (j = MIN(nt,nt-tmute+shift-smooth),l=0; j < MIN(nt,nt-tmute+shift); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[smooth-l-1]; } } @@ -62,10 +62,10 @@ void applyMute( float *data, int *mute, int smooth, int above, int Nfoc, int nxs for (i = 0; i < npos; i++) { imute = ixpos[i]; tmute = mute[isyn*nxs+imute]; - for (j = tmute-shift,l=0; j < tmute-shift+smooth; j++,l++) { + for (j = MAX(0,tmute-shift),l=0; j < MAX(0,tmute-shift+smooth); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[l]; } - for (j = tmute-shift+smooth; j < nt; j++) { + for (j = MAX(0,tmute-shift+smooth); j < nt; j++) { data[isyn*nxs*nt+i*nt+j] = 0.0; } } @@ -74,16 +74,16 @@ void applyMute( float *data, int *mute, int smooth, int above, int Nfoc, int nxs for (i = 0; i < npos; i++) { imute = ixpos[i]; tmute = mute[isyn*nxs+imute]; - for (j = tmute-shift-smooth,l=0; j < tmute-shift; j++,l++) { + for (j = MAX(0,tmute-shift-smooth),l=0; j < MAX(0,tmute-shift); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[smooth-l-1]; } - for (j = 0; j < tmute-shift-smooth-1; j++) { + for (j = 0; j < MAX(0,tmute-shift-smooth-1); j++) { data[isyn*nxs*nt+i*nt+j] = 0.0; } - for (j = nt+1-tmute+shift+smooth; j < nt; j++) { + for (j = MIN(nt,nt+1-tmute+shift+smooth); j < nt; j++) { data[isyn*nxs*nt+i*nt+j] = 0.0; } - for (j = nt-tmute+shift,l=0; j < nt-tmute+shift+smooth; j++,l++) { + for (j = MIN(nt,nt-tmute+shift),l=0; j < MIN(nt,nt-tmute+shift+smooth); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[l]; } } @@ -92,16 +92,16 @@ void applyMute( float *data, int *mute, int smooth, int above, int Nfoc, int nxs for (i = 0; i < npos; i++) { imute = ixpos[i]; tmute = mute[isyn*nxs+imute]; - for (j = 0; j < tmute-shift-smooth; j++) { + for (j = 0; j < MAX(0,tmute-shift-smooth); j++) { data[isyn*nxs*nt+i*nt+j] = 0.0; } - for (j = tmute-shift-smooth,l=0; j < tmute-shift; j++,l++) { + for (j = MAX(0,tmute-shift-smooth),l=0; j < MAX(0,tmute-shift); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[smooth-l-1]; } - for (j = tmute+shift,l=0; j < tmute+shift+smooth; j++,l++) { + for (j = MAX(0,tmute+shift),l=0; j < MAX(0,tmute+shift+smooth); j++,l++) { data[isyn*nxs*nt+i*nt+j] *= costaper[l]; } - for (j = tmute+shift+smooth; j < nt; j++) { + for (j = MAX(0,tmute+shift+smooth); j < nt; j++) { data[isyn*nxs*nt+i*nt+j] = 0.0; } } diff --git a/marchenko_applications/imaging.c b/marchenko_applications/imaging.c index 194b753..664097d 100644 --- a/marchenko_applications/imaging.c +++ b/marchenko_applications/imaging.c @@ -27,7 +27,7 @@ void synthesis(complex *Refl, complex *Fop, float *Top, float *iRN, int nx, int void imaging(float *Image, WavePar WP, complex *Refl, int nx, int nt, int nxs, int nts, float dt, float *xsyn, int Nsyn, float *xrcv, float *xsrc, float fxs2, float fxs, float dxs, float dxsrc, float dx, int ixa, int ixb, int ntfft, int nw, int nw_low, int nw_high, int mode, int reci, int nshots, int *ixpossyn, int npossyn, float *pmin, float *f1min, float *f1plus, float *f2p, float *G_d, int *muteW, int smooth, int shift, int above, int pad, int nt0, int *synpos, int verbose) { FILE *fp, *fp_out; - int i, j, l, ret; + int i, j, l, ret, count=0; int iter, ix, nfreq, first=0; float *iRN, *conv, *Gmin, *wavelet, *wav; complex *Fop; @@ -91,7 +91,9 @@ void imaging(float *Image, WavePar WP, complex *Refl, int nx, int nt, int nxs, i #pragma omp for for (l = 0; l < Nsyn; l++) { - if (verbose > 2) vmess("Imaging location %d out of %d",l+1,Nsyn); + count+=1; + + if (verbose > 2) vmess("Imaging location %d out of %d",count,Nsyn); if (WP.wav) { for (i=0; i<npossyn; i++) { -- GitLab