Commit 72939d6b authored by laura.gassner's avatar laura.gassner

adaption of function smooth.c

parent ca959455
......@@ -84,7 +84,6 @@ void smooth(float ** mat, int sws, int filter, float Vs_avg, float F_LOW_PASS)
model_tmp = matrix(-hfs+1,NYG+hfs,-hfs+1,NXG+hfs);
break;
}
model_med = matrix(1,NYG,1,NXG);
/* load merged model */
for (i=1;i<=NXG;i++){
......@@ -114,30 +113,27 @@ void smooth(float ** mat, int sws, int filter, float Vs_avg, float F_LOW_PASS)
}
/* filter */
for (j=1;j<=NYG;j++){
for (i=1;i<=NXG;i++){
for (j=1;j<=NY;j++){
for (i=1;i<=NX;i++){
/* create a filtersize x filtersize matrix */
for (ii=-hfs;ii<=hfs;ii++){
for (jj=-hfs;jj<=hfs;jj++){
filterpart[ii+hfs+1][jj+hfs+1] = model_tmp[j+jj][i+ii];
filterpart[ii+hfs+1][jj+hfs+1] = model_tmp[j+POS[2]*NY+jj][i+POS[1]*NX+ii];
}
}
/* filter */
switch (filter){
case 1:
model_med[j][i] = median2d(filterpart,abs(FILT_SIZE_GRAD),abs(FILT_SIZE_GRAD));
mat[j][i] = median2d(filterpart,abs(FILT_SIZE_GRAD),abs(FILT_SIZE_GRAD));
break;
case 2:
model_med[j][i] = median2d(filterpart,abs(FILT_SIZE),abs(FILT_SIZE));
mat[j][i] = median2d(filterpart,abs(FILT_SIZE),abs(FILT_SIZE));
break;
}
}
}
get_local_from_global_matrix(model_med, mat);
switch (filter){
case 1:
free_matrix(model_tmp,-hfs+1,NYG+hfs,-hfs+1,NXG+hfs);
......@@ -148,8 +144,6 @@ void smooth(float ** mat, int sws, int filter, float Vs_avg, float F_LOW_PASS)
free_matrix(filterpart,1,abs(FILT_SIZE),1,abs(FILT_SIZE));
break;
}
free_matrix(model_med,1,NXG,1,NYG);
MPI_Barrier(MPI_COMM_WORLD);
......@@ -165,7 +159,4 @@ void smooth(float ** mat, int sws, int filter, float Vs_avg, float F_LOW_PASS)
break ;
}
if(VERBOSE) fprintf(FP,"\n Smoothed gradient / model is distributed on computational nodes.\n");
if(VERBOSE) fprintf(FP,"\n ----------------------------------------------------------------\n");
}/* end of smoothing */
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