Commit e7fc6d80 authored by laura.gassner's avatar laura.gassner

re-add changes that got lost during merging - 2nd part

parent 6f89f6bd
...@@ -93,7 +93,7 @@ for(i=1;i<=ntr;i++){ ...@@ -93,7 +93,7 @@ for(i=1;i<=ntr;i++){
} }
/* TIME WINDOWING */ /* TIME WINDOWING */
if(TIMEWIN==1) time_window(intseis_sectiondata, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot); if(TIMEWIN==1) time_window(intseis_sectiondata, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
/* NORMALIZE TRACES */ /* NORMALIZE TRACES */
if(NORMALIZE==1) normalize_data(intseis_sectiondata,ntr,ns); if(NORMALIZE==1) normalize_data(intseis_sectiondata,ntr,ns);
......
...@@ -98,8 +98,8 @@ for(i=1;i<=ntr;i++){ ...@@ -98,8 +98,8 @@ for(i=1;i<=ntr;i++){
/* TIME WINDOWING */ /* TIME WINDOWING */
if(TIMEWIN==1){ if(TIMEWIN==1){
time_window(intseis_section, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot); time_window(intseis_section, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
time_window(intseis_sectiondata, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot); time_window(intseis_sectiondata, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
} }
/* NORMALIZE TRACES */ /* NORMALIZE TRACES */
......
...@@ -111,8 +111,8 @@ for(i=1;i<=ntr;i++){ ...@@ -111,8 +111,8 @@ for(i=1;i<=ntr;i++){
/* TIME WINDOWING */ /* TIME WINDOWING */
if(TIMEWIN==1){ if(TIMEWIN==1){
time_window(intseis_section, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot); time_window(intseis_section, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
time_window(intseis_sectiondata, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot); time_window(intseis_sectiondata, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
} }
/* NORMALIZE TRACES */ /* NORMALIZE TRACES */
......
...@@ -290,7 +290,8 @@ void surface_PML(int ndepth, float ** vx, float ** vy, float ** sxx, float ** sy ...@@ -290,7 +290,8 @@ void surface_PML(int ndepth, float ** vx, float ** vy, float ** sxx, float ** sy
void timedomain_filt(float ** data, float fc, int order, int ntr, int ns, int method); void timedomain_filt(float ** data, float fc, int order, int ntr, int ns, int method);
void timedomain_filt_vector(float * data, float fc, int order, int ntr, int ns, int method); void timedomain_filt_vector(float * data, float fc, int order, int ntr, int ns, int method);
void time_window(float **sectiondata, float * picked_times, int iter, int ntr_glob, int **recpos_loc, int ntr, int ns, int ishot); void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc, int ntr, int ns, int ishot);
void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int ishot);
void prepare_update_s(float *etajm, float *etaip, float *peta, float **fipjp, float **pu, void prepare_update_s(float *etajm, float *etaip, float *peta, float **fipjp, float **pu,
float **puipjp, float **ppi, float **prho, float **ptaus, float **ptaup, float **puipjp, float **ppi, float **prho, float **ptaus, float **ptaup,
......
...@@ -23,76 +23,126 @@ ...@@ -23,76 +23,126 @@
* ----------------------------------------------------------------------*/ * ----------------------------------------------------------------------*/
#include "fd.h" #include "fd.h"
void time_window(float **sectiondata, float *picked_times, int iter, int ntr_glob, int **recpos_loc, int ntr, int ns, int ishot){ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc, int ntr, int ns, int ishot){
/* declaration of variables */ /* declaration of variables */
extern float DT; extern float DT;
extern int REC1, REC2, MYID; extern float GAMMA, TWLENGTH_PLUS, TWLENGTH_MINUS;
extern float GAMMA, TWLENGTH_PLUS, TWLENGTH_MINUS; extern int TW_IND;
extern char PICKS_FILE[STRING_SIZE]; extern char PICKS_FILE[STRING_SIZE];
int READ_PICKED_TIMES; char pickfile_char[STRING_SIZE];
char pickfile_char[STRING_SIZE]; float time, dump, dump1, dump2, dump3, taper, taper1;
float time, dump, dump1, taper, taper1; float *pick_tmp, **pick_tmp_m;
float *pick_tmp; int i, j, h;
int i, j, h;
FILE *fptime; float *picked_times=NULL, **picked_times_m=NULL;
FILE *fptime;
READ_PICKED_TIMES=1; /*other options?*/ if(TW_IND){
picked_times_m = matrix(1,3,1,ntr_glob);
/* read picked first arrival times */ pick_tmp_m = matrix(1,3,1,ntr_glob);
if(READ_PICKED_TIMES==1){ }else{
pick_tmp = vector(1,ntr_glob); picked_times = vector(1,ntr_glob);
pick_tmp = vector(1,ntr_glob);
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot); }
fptime=fopen(pickfile_char,"r"); sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
if (fptime == NULL) {
err(" picks_?.dat could not be opened !"); fptime=fopen(pickfile_char,"r");
} if (fptime == NULL) {
err(" picks_?.dat could not be opened !");
for(i=1;i<=ntr_glob;i++){ }
fscanf(fptime,"%f",&dump);
pick_tmp[i] = dump;
} if(TW_IND){
for(i=1;i<=ntr_glob;i++){
fclose(fptime); fscanf(fptime,"%f%f%f",&dump,&dump2,&dump3);
pick_tmp_m[1][i] = dump;
/* distribute picks on CPUs */ pick_tmp_m[2][i] = dump2;
h=1; pick_tmp_m[3][i] = dump3;
for(i=1;i<=ntr;i++){ }
picked_times[h] = pick_tmp[recpos_loc[3][i]]; }else{
for(i=1;i<=ntr_glob;i++){
/*printf("MYID IS: %i REC1 is= %i REC2 is %i\n",MYID, REC1, REC2); fscanf(fptime,"%f",&dump);
printf("MYID= %i pick_tmp[%i]= %f\n",MYID, i,pick_tmp[i]);*/ pick_tmp[i] = dump;
}
h++; }
}
fclose(fptime);
free_vector(pick_tmp,1,ntr_glob);
/* distribute picks on CPUs */
} /* end of if(READTIMES==1) */ h=1;
if(TW_IND){
for(i=1;i<=ntr;i++){ for(i=1;i<=ntr;i++){
for(j=2;j<=ns;j++){ picked_times_m[1][h] = pick_tmp_m[1][recpos_loc[3][i]];
picked_times_m[2][h] = pick_tmp_m[2][recpos_loc[3][i]];
time = (float)(j * DT); picked_times_m[3][h] = pick_tmp_m[3][recpos_loc[3][i]];
dump = (time-picked_times[i]-TWLENGTH_PLUS); h++;
taper = exp(-GAMMA*dump*dump); }
}else{
dump1 = (time-picked_times[i]+TWLENGTH_MINUS); for(i=1;i<=ntr;i++){
taper1 = exp(-GAMMA*dump1*dump1); picked_times[h] = pick_tmp[recpos_loc[3][i]];
if(time>=picked_times[i]+TWLENGTH_PLUS){ h++;
sectiondata[i][j] = sectiondata[i][j] * taper;} }
}
if(time<=picked_times[i]-TWLENGTH_MINUS){
sectiondata[i][j] = sectiondata[i][j] * taper1;} if(TW_IND)
free_matrix(pick_tmp_m,1,3,1,ntr_glob);
sectiondata[i][j] = sectiondata[i][j]; else
free_vector(pick_tmp,1,ntr_glob);
}
} if(TW_IND){
for(i=1;i<=ntr;i++){
} /* end of function time_window.c */ for(j=2;j<=ns;j++){
time = (float)(j * DT);
dump = (time-picked_times_m[1][i]-picked_times_m[2][i]);
taper = exp(-GAMMA*dump*dump);
dump1 = (time-picked_times_m[1][i]+picked_times_m[3][i]);
taper1 = exp(-GAMMA*dump1*dump1);
if(time>=picked_times_m[1][i]+picked_times_m[2][i]){
sectiondata[i][j] = sectiondata[i][j] * taper;}
if(time<=picked_times_m[1][i]-picked_times_m[3][i]){
sectiondata[i][j] = sectiondata[i][j] * taper1;}
sectiondata[i][j] = sectiondata[i][j];
}
}
}else{
for(i=1;i<=ntr;i++){
for(j=2;j<=ns;j++){
time = (float)(j * DT);
dump = (time-picked_times[i]-TWLENGTH_PLUS);
taper = exp(-GAMMA*dump*dump);
dump1 = (time-picked_times[i]+TWLENGTH_MINUS);
taper1 = exp(-GAMMA*dump1*dump1);
if(time>=picked_times[i]+TWLENGTH_PLUS){
sectiondata[i][j] = sectiondata[i][j] * taper;}
if(time<=picked_times[i]-TWLENGTH_MINUS){
sectiondata[i][j] = sectiondata[i][j] * taper1;}
sectiondata[i][j] = sectiondata[i][j];
}
}
}
if(TW_IND)
free_matrix(picked_times_m,1,3,1,ntr_glob);
else
free_vector(picked_times,1,ntr_glob);
} /* end of function time_window.c */
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment