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++){
}
/* 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 */
if(NORMALIZE==1) normalize_data(intseis_sectiondata,ntr,ns);
......
......@@ -98,8 +98,8 @@ for(i=1;i<=ntr;i++){
/* TIME WINDOWING */
if(TIMEWIN==1){
time_window(intseis_section, picked_times, 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_section, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
time_window(intseis_sectiondata, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
}
/* NORMALIZE TRACES */
......
......@@ -111,8 +111,8 @@ for(i=1;i<=ntr;i++){
/* TIME WINDOWING */
if(TIMEWIN==1){
time_window(intseis_section, picked_times, 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_section, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
time_window(intseis_sectiondata, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
}
/* NORMALIZE TRACES */
......
......@@ -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_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,
float **puipjp, float **ppi, float **prho, float **ptaus, float **ptaup,
......
......@@ -23,26 +23,29 @@
* ----------------------------------------------------------------------*/
#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 */
extern float DT;
extern int REC1, REC2, MYID;
extern float GAMMA, TWLENGTH_PLUS, TWLENGTH_MINUS;
extern int TW_IND;
extern char PICKS_FILE[STRING_SIZE];
int READ_PICKED_TIMES;
char pickfile_char[STRING_SIZE];
float time, dump, dump1, taper, taper1;
float *pick_tmp;
float time, dump, dump1, dump2, dump3, taper, taper1;
float *pick_tmp, **pick_tmp_m;
int i, j, h;
FILE *fptime;
float *picked_times=NULL, **picked_times_m=NULL;
READ_PICKED_TIMES=1; /*other options?*/
FILE *fptime;
/* read picked first arrival times */
if(READ_PICKED_TIMES==1){
if(TW_IND){
picked_times_m = matrix(1,3,1,ntr_glob);
pick_tmp_m = matrix(1,3,1,ntr_glob);
}else{
picked_times = vector(1,ntr_glob);
pick_tmp = vector(1,ntr_glob);
}
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
......@@ -51,28 +54,69 @@ void time_window(float **sectiondata, float *picked_times, int iter, int ntr_glo
err(" picks_?.dat could not be opened !");
}
if(TW_IND){
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f%f%f",&dump,&dump2,&dump3);
pick_tmp_m[1][i] = dump;
pick_tmp_m[2][i] = dump2;
pick_tmp_m[3][i] = dump3;
}
}else{
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f",&dump);
pick_tmp[i] = dump;
}
}
fclose(fptime);
/* distribute picks on CPUs */
h=1;
if(TW_IND){
for(i=1;i<=ntr;i++){
picked_times[h] = pick_tmp[recpos_loc[3][i]];
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]];
picked_times_m[3][h] = pick_tmp_m[3][recpos_loc[3][i]];
/*printf("MYID IS: %i REC1 is= %i REC2 is %i\n",MYID, REC1, REC2);
printf("MYID= %i pick_tmp[%i]= %f\n",MYID, i,pick_tmp[i]);*/
h++;
}
}else{
for(i=1;i<=ntr;i++){
picked_times[h] = pick_tmp[recpos_loc[3][i]];
h++;
}
}
if(TW_IND)
free_matrix(pick_tmp_m,1,3,1,ntr_glob);
else
free_vector(pick_tmp,1,ntr_glob);
} /* end of if(READTIMES==1) */
if(TW_IND){
for(i=1;i<=ntr;i++){
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++){
......@@ -94,5 +138,11 @@ void time_window(float **sectiondata, float *picked_times, int iter, int ntr_glo
}
}
}
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