Commit 7ec03a56 authored by Tilman Steinweg's avatar Tilman Steinweg
Browse files

several changes on input reading and processing

defined optinal parameters
READREC is now the switch for 0-receiver line / 1-from file / 2-receiver array
using only one receiver specified in the input file is now possible.
if rec array is used checkfd_ssg was checking the wrong input parameters from the .inp files
etc.
parent 690bd3bf
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
"Source" : "comment", "Source" : "comment",
"SOURCE_SHAPE" : "4", "SOURCE_SHAPE" : "4",
"SOURCE_TYPE" : "4", "SOURCE_TYPE" : "4",
"SIGNAL_FILE" : "./STF/stf.su",
"SRCREC" : "1", "SRCREC" : "1",
"SOURCE_FILE" : "./sources/sources_toy.dat", "SOURCE_FILE" : "./sources/sources_toy.dat",
"RUN_MULTIPLE_SHOTS" : "1", "RUN_MULTIPLE_SHOTS" : "1",
...@@ -37,8 +36,6 @@ ...@@ -37,8 +36,6 @@
"Q-approximation" : "comment", "Q-approximation" : "comment",
"L" : "0", "L" : "0",
"FL1" : "1000.0",
"TAU" : "0.000001",
"Free Surface" : "comment", "Free Surface" : "comment",
"FREE_SURF" : "0", "FREE_SURF" : "0",
...@@ -49,26 +46,13 @@ ...@@ -49,26 +46,13 @@
"FW" : "10", "FW" : "10",
"VPPML" : "6200.0", "VPPML" : "6200.0",
"FPML" : "200.00", "FPML" : "200.00",
"BOUNDARY" : "0",
"Snapshots" : "comment", "Snapshots" : "comment",
"SNAP" : "0", "SNAP" : "0",
"TSNAP1" : "0.01",
"TSNAP2" : "0.24",
"TSNAPINC" : "0.0075",
"IDX, IDY, IDZ" : "1,1,1",
"SNAP_FORMAT" : "4",
"SNAP_FILE" : "./snap/back",
"SNAP_PLANE" : "1",
"Receiver" : "comment", "Receiver" : "comment",
"SEISMO" : "1", "SEISMO" : "1",
"READREC" : "0", "READREC" : "2",
"REC_FILE" : "./receiver/receiver.dat",
"REFRECX, REFRECY, REFRECZ" : "0.0 , 0.0, 0.0",
"XREC1, YREC1, ZREC1" : "90.0 , 90.0, 90.0",
"XREC2, YREC2, ZREC2" : "90.0 , 90.0, 90.0",
"NGEOPH" : "1",
"Receiver array" : "comment", "Receiver array" : "comment",
"REC_ARRAY" : "1", "REC_ARRAY" : "1",
...@@ -80,11 +64,12 @@ ...@@ -80,11 +64,12 @@
"Seismograms" : "comment", "Seismograms" : "comment",
"NDT" : "1", "NDT" : "1",
"NDTSHIFT" : "0",
"SEIS_FORMAT" : "1", "SEIS_FORMAT" : "1",
"SEIS_FILE" : "./su_obs/obs_toy", "SEIS_FILE" : "./su/cal_toy",
"VERBOSE" : "0",
"Method" : "comment", "Method" : "comment",
"METHOD" : "0", "METHOD" : "0",
...@@ -96,15 +81,14 @@ ...@@ -96,15 +81,14 @@
"SEIS_OBS_FILE" : "./su_obs/obs_toy", "SEIS_OBS_FILE" : "./su_obs/obs_toy",
"EXTOBS" : "0", "EXTOBS" : "0",
"INV_FILE" : "./in_and_out/workflow_toy.dat", "INV_FILE" : "./in_and_out/workflow_toy.dat",
"HESS_FILE" : "./hess/toy_hess",
"General" : "comment", "General" : "comment",
"ITMIN, ITMAX" : "1 , 60", "ITMIN, ITMAX" : "1 , 60",
"FILT" : "0", "FILT" : "1",
"NFMAX" : "5", "NFMAX" : "5",
"TAST" : "100", "TAST" : "100",
"VP0, VS0, RHO0" : "6200.0, 3600.0, 2800.0", "VP0, VS0, RHO0" : "6200.0, 3600.0, 2800.0",
"WEIGHT" : "1.0, 1.0, 0.0", "WEIGHT_VP,WEIGHT_VS,WEIGHT_RHO" : "1.0, 1.0, 0.0",
"Steplength estimation" : "comment", "Steplength estimation" : "comment",
"NSHOTS_STEP" : "4", "NSHOTS_STEP" : "4",
...@@ -115,12 +99,7 @@ ...@@ -115,12 +99,7 @@
"Hessian" : "comment", "Hessian" : "comment",
"HESS" : "0", "HESS" : "0",
"READ_HESS" : "0",
"REC_HESS" : "1",
"WATER_HESS_VP, WATER_HESS_VS, WATER_HESS_RHO" : "0.0192, 0.0192, 1.0e-14",
"L-BFGS" : "comment", "L-BFGS" : "comment",
"LBFGS" : "0", "LBFGS" : "0"
"NUMPAR" : "2",
"BFGSNUM" : "5"
} }
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
"Source" : "comment", "Source" : "comment",
"SOURCE_SHAPE" : "4", "SOURCE_SHAPE" : "4",
"SOURCE_TYPE" : "4", "SOURCE_TYPE" : "4",
"SIGNAL_FILE" : "./STF/stf.su",
"SRCREC" : "1", "SRCREC" : "1",
"SOURCE_FILE" : "./sources/sources_toy.dat", "SOURCE_FILE" : "./sources/sources_toy.dat",
"RUN_MULTIPLE_SHOTS" : "1", "RUN_MULTIPLE_SHOTS" : "1",
...@@ -37,38 +36,23 @@ ...@@ -37,38 +36,23 @@
"Q-approximation" : "comment", "Q-approximation" : "comment",
"L" : "0", "L" : "0",
"FL1" : "1000.0",
"TAU" : "0.000001",
"Free Surface" : "comment", "Free Surface" : "comment",
"FREE_SURF" : "0", "FREE_SURF" : "0",
"Absorbing Boundary" : "comment", "Absorbing Boundary" : "comment",
"ABS_TYPE" : "1", "ABS_TYPE" : "1",
"FW" : "10", "FW" : "10",
"VPPML" : "6200.0", "VPPML" : "6200.0",
"FPML" : "200.00", "FPML" : "200.00",
"BOUNDARY" : "0",
"Snapshots" : "comment", "Snapshots" : "comment",
"SNAP" : "0", "SNAP" : "0",
"TSNAP1" : "0.01",
"TSNAP2" : "0.24",
"TSNAPINC" : "0.0075",
"IDX, IDY, IDZ" : "1,1,1",
"SNAP_FORMAT" : "4",
"SNAP_FILE" : "./snap/back",
"SNAP_PLANE" : "1",
"Receiver" : "comment", "Receiver" : "comment",
"SEISMO" : "1", "SEISMO" : "1",
"READREC" : "0", "READREC" : "2",
"REC_FILE" : "./receiver/receiver.dat",
"REFRECX, REFRECY, REFRECZ" : "0.0 , 0.0, 0.0",
"XREC1, YREC1, ZREC1" : "90.0 , 90.0, 90.0",
"XREC2, YREC2, ZREC2" : "90.0 , 90.0, 90.0",
"NGEOPH" : "1",
"Receiver array" : "comment", "Receiver array" : "comment",
"REC_ARRAY" : "1", "REC_ARRAY" : "1",
...@@ -80,7 +64,6 @@ ...@@ -80,7 +64,6 @@
"Seismograms" : "comment", "Seismograms" : "comment",
"NDT" : "1", "NDT" : "1",
"NDTSHIFT" : "0",
"SEIS_FORMAT" : "1", "SEIS_FORMAT" : "1",
"SEIS_FILE" : "./su_obs/obs_toy", "SEIS_FILE" : "./su_obs/obs_toy",
......
...@@ -69,7 +69,7 @@ PARTMODEL_SCR = \ ...@@ -69,7 +69,7 @@ PARTMODEL_SCR = \
util.c util.c
FDMPI_UTIL = \ IFOS_UTIL = \
absorb.c \ absorb.c \
av_mat.c \ av_mat.c \
comm_ini.c \ comm_ini.c \
...@@ -99,7 +99,7 @@ FDMPI_UTIL = \ ...@@ -99,7 +99,7 @@ FDMPI_UTIL = \
writepar.c \ writepar.c \
rwsegy.c \ rwsegy.c \
FDMPI_SRC = \ IFOS_SRC = \
ifos3d.c \ ifos3d.c \
comm_ini_s.c \ comm_ini_s.c \
checkfd_ssg.c \ checkfd_ssg.c \
...@@ -146,12 +146,12 @@ FDMPI_SRC = \ ...@@ -146,12 +146,12 @@ FDMPI_SRC = \
lbfgs_save.c \ lbfgs_save.c \
constant_boundary.c \ constant_boundary.c \
$(MODEL_SCR) \ $(MODEL_SCR) \
$(FDMPI_UTIL) $(IFOS_UTIL)
# model_gauss.c \ # model_gauss.c \
FDMPI_OBJ = $(FDMPI_SRC:%.c=%.o) IFOS_OBJ = $(IFOS_SRC:%.c=%.o)
FDMPI_OBJ_RSG = $(FDMPI_SRC_RSG:%.c=%.o) IFOS_OBJ_RSG = $(IFOS_SRC_RSG:%.c=%.o)
# FDMPI_ACOUSTIC_OBJ = $(FDMPI_ACOUSTIC_SRC:%.c=%.o) # FDMPI_ACOUSTIC_OBJ = $(FDMPI_ACOUSTIC_SRC:%.c=%.o)
# SNAPMERGE_OBJ = $(SNAPMERGE_SCR:%.c=%.o) # SNAPMERGE_OBJ = $(SNAPMERGE_SCR:%.c=%.o)
# PARTMODEL_OBJ = $(PARTMODEL_SCR:%.c=%.o) # PARTMODEL_OBJ = $(PARTMODEL_SCR:%.c=%.o)
...@@ -166,8 +166,8 @@ snapmerge: $(SNAPMERGE_OBJ) ...@@ -166,8 +166,8 @@ snapmerge: $(SNAPMERGE_OBJ)
# part_model: $(PARTMODEL_OBJ) # part_model: $(PARTMODEL_OBJ)
# $(CC) $(LFLAGS) $(PARTMODEL_OBJ) -o ../bin/partmodel # $(CC) $(LFLAGS) $(PARTMODEL_OBJ) -o ../bin/partmodel
ifos3d: $(FDMPI_OBJ) ifos3d: $(IFOS_OBJ)
$(CC) $(SFLAGS) $(FDMPI_OBJ) $(LFLAGS) -o ../bin/ifos3d $(CC) $(SFLAGS) $(IFOS_OBJ) $(LFLAGS) -o ../bin/ifos3d
clean: clean:
......
...@@ -590,7 +590,7 @@ float *** ptaus, float *** ptaup, float *peta, float **srcpos, int nsrc, int **r ...@@ -590,7 +590,7 @@ float *** ptaus, float *** ptaup, float *peta, float **srcpos, int nsrc, int **r
srec_miny=ZREC1; srec_miny=ZREC1;
} }
} }
if (READREC==1) { if ((READREC==1) || (READREC=2)){
/* find maximum and minimum source positions coordinate ---- from receiver file*/ /* find maximum and minimum source positions coordinate ---- from receiver file*/
for (k=1;k<=ntr;k++){ for (k=1;k<=ntr;k++){
/* find maximum source positions coordinate*/ /* find maximum source positions coordinate*/
......
...@@ -145,7 +145,7 @@ int read_par(FILE *fp_in){ ...@@ -145,7 +145,7 @@ int read_par(FILE *fp_in){
} }
break; break;
case 21 : case 21 :
nvarin=sscanf(cline,"%s =%s , %i , %i , %i , %i , %i , %i",s,SIGNAL_FILE,&SIGNAL_FORMAT); nvarin=sscanf(cline,"%s =%s , %i ",s,SIGNAL_FILE,&SIGNAL_FORMAT);
switch(nvarin){ switch(nvarin){
case 0: case 0:
case 1: strcpy(SIGNAL_FILE,"\0"); case 1: strcpy(SIGNAL_FILE,"\0");
...@@ -192,7 +192,7 @@ int read_par(FILE *fp_in){ ...@@ -192,7 +192,7 @@ int read_par(FILE *fp_in){
} }
break; break;
case 25 : case 25 :
nvarin=sscanf(cline,"%s =%i , %i , %i , %i , %i , %i , %i",s,&READMOD,&MOD_FORMAT); nvarin=sscanf(cline,"%s =%i , %i ",s,&READMOD,&MOD_FORMAT);
switch(nvarin){ switch(nvarin){
case 0: case 0:
case 1: READMOD=0; case 1: READMOD=0;
......
This diff is collapsed.
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
* Copyright (C) 2015 For the list of authors, see file AUTHORS. * Copyright (C) 2015 For the list of authors, see file AUTHORS.
* *
* This file is part of IFOS3D. * This file is part of IFOS3D.
* *
* IFOS3D is free software: you can redistribute it and/or modify * IFOS3D is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only. * the Free Software Foundation, version 2.0 of the License only.
* *
* IFOS3D is distributed in the hope that it will be useful, * IFOS3D is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with IFOS3D. See file COPYING and/or * along with IFOS3D. See file COPYING and/or
* <http://www.gnu.org/licenses/gpl-2.0.html>. * <http://www.gnu.org/licenses/gpl-2.0.html>.
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "fd.h" #include "fd.h"
int **receiver(FILE *fp, int *ntr){ int **receiver(FILE *fp, int *ntr) {
/* declaration of extern variables */ /* declaration of extern variables */
extern char REC_FILE[STRING_SIZE]; extern char REC_FILE[STRING_SIZE];
...@@ -40,162 +40,196 @@ int **receiver(FILE *fp, int *ntr){ ...@@ -40,162 +40,196 @@ int **receiver(FILE *fp, int *ntr){
char bufferstring[10], buffer[STRING_SIZE]; char bufferstring[10], buffer[STRING_SIZE];
FILE *fpr; FILE *fpr;
if (MYID==0) {
switch (READREC) { /* read receiver positions from file */
case 1:
fprintf(fp,"\n Reading receiver positions from file: \n\t%s\n",REC_FILE);
fpr=fopen(REC_FILE,"r");
if (fpr==NULL) err(" Receiver file could not be opened !");
if (MYID==0){ *ntr=0;
if (READREC){ /* read receiver positions from file */
fprintf(fp,"\n Reading receiver positions from file: \n\t%s\n",REC_FILE); /* counts the number of receivers in the receiver file */
while (fgets(buffer, STRING_SIZE, fpr)) {
fpr=fopen(REC_FILE,"r"); sscanf(buffer,"%s",bufferstring);
if (fpr==NULL) err(" Receiver file could not be opened !"); /*testbuff=sscanf(buffer,"%s",bufferstring);
*ntr=0; fprintf(fp," bufferstring : _%s_with test=_%i_\n",bufferstring,testbuff); */
/* checks if the line contains a '%'character which indicates a comment line,
/* counts the number of receivers in the receiver file */
while(fgets(buffer, STRING_SIZE, fpr))
{
sscanf(buffer,"%s",bufferstring);
/*testbuff=sscanf(buffer,"%s",bufferstring);
fprintf(fp," bufferstring : _%s_with test=_%i_\n",bufferstring,testbuff); */
/* checks if the line contains a '%'character which indicates a comment line,
and if the reading of a string was successful, which is not the case for an empty line*/ and if the reading of a string was successful, which is not the case for an empty line*/
if ((strchr(buffer,'%')==0) && (sscanf(buffer,"%s",bufferstring)==1)) ++(*ntr); if ((strchr(buffer,'%')==0) && (sscanf(buffer,"%s",bufferstring)==1)) ++(*ntr);
}
rewind(fpr);
recpos1=imatrix(1,3,1,*ntr);
for (itr=1;itr<=*ntr;itr++){
fscanf(fpr,"%f%f%f\n",&xrec, &zrec, &yrec);
/*note that internally "y" is used for the vertical coordinate,
for usability reasons, we switch the "y" and "z" coordinate
so that "z" - as commonly used - denotes the depth (vertical direction),
the REF_REC variable is switched in read_par, the coordinates specified
in the receiver file are switched in this function*/
recpos1[1][itr]=iround((xrec+REFREC[1])/DX);
recpos1[2][itr]=iround((yrec+REFREC[2])/DZ);
recpos1[3][itr]=iround((zrec+REFREC[3])/DY);
}
fclose(fpr);
fprintf(fp," Message from function receiver (written by PE %d):\n",MYID);
fprintf(fp," Number of receiver positions found: %i\n",*ntr);
/* check if more than one receiver is located
at the same gridpoint */
for (itr=1;itr<=(*ntr-1);itr++)
for (itr1=itr+1;itr1<=*ntr;itr1++)
if ((recpos1[1][itr]==recpos1[1][itr1])
&& (recpos1[2][itr]==recpos1[2][itr1])
&& (recpos1[3][itr]==recpos1[3][itr1]))
recpos1[1][itr1]=-(++recflag);
recpos=imatrix(1,3,1,*ntr-recflag);
for (itr=1;itr<=*ntr;itr++)
if (recpos1[1][itr]>0){
recpos[1][++itr2]=recpos1[1][itr];
recpos[2][itr2]=recpos1[2][itr];
recpos[3][itr2]=recpos1[3][itr];
} }
*ntr=itr2;
if ((recflag>0)||(itr2<(itr-1))){
fprintf(fp,"\n\n");
fprintf(fp," Warning:\n");
fprintf(fp," Several receivers located at the same gridpoint !\n");
fprintf(fp," Number of receivers reduced to %i\n", *ntr);
fprintf(fp,"\n\n");
}
free_imatrix(recpos1,1,3,1,*ntr);
} rewind(fpr);
else if (REC_ARRAY>0){
ifw=FW+10; /* frame width in gridpoints */ recpos1=imatrix(1,3,1,*ntr);
if (BOUNDARY==1) ifw=0;
*ntr=((1+(NZG-2*ifw)/DRY)*(1+(NXG-2*ifw)/DRX))*REC_ARRAY; for (itr=1; itr<=*ntr; itr++) {
recpos=imatrix(1,3,1,*ntr); fscanf(fpr,"%f%f%f\n",&xrec, &zrec, &yrec);
itr=0; /*note that internally "y" is used for the vertical coordinate,
for (n=0;n<=REC_ARRAY-1;n++){ for usability reasons, we switch the "y" and "z" coordinate
j=iround((REC_ARRAY_DEPTH+REC_ARRAY_DIST*(float)n)/DY); so that "z" - as commonly used - denotes the depth (vertical direction),
for (k=ifw;k<=NZG-ifw;k+=DRY) the REF_REC variable is switched in read_par, the coordinates specified
for (i=ifw;i<=NXG-ifw;i+=DRX){ in the receiver file are switched in this function*/
itr++; recpos1[1][itr]=iround((xrec+REFREC[1])/DX);
recpos[1][itr]=i; recpos1[2][itr]=iround((yrec+REFREC[2])/DZ);
recpos[2][itr]=j; recpos1[3][itr]=iround((zrec+REFREC[3])/DY);
recpos[3][itr]=k;
} }
}
} fclose(fpr);
fprintf(fp," Message from function receiver (written by PE %d):\n",MYID);
else{ /* straight horizontal or vertical line of receivers */ fprintf(fp," Number of receiver positions found: %i\n",*ntr);
if ((XREC1>XREC2) || ((YREC1>YREC2) ||(ZREC1>ZREC2))){
fprintf(fp," Coordinates of first receiver specified in input file :\n"); /* check if more than one receiver is located
fprintf(fp," %5.2f (x) , %5.2f (y) , %5.2f (z) :\n", XREC1,YREC1,ZREC1); at the same gridpoint */
fprintf(fp," Coordinates of last receiver specified in input file :\n"); for (itr=1; itr<=(*ntr-1); itr++)
fprintf(fp," %5.2f (x) , %5.2f (y) , %5.2f (z) :\n", XREC2,YREC2,ZREC2); for (itr1=itr+1; itr1<=*ntr; itr1++)
err("\n\n Receiver coordinates of first receiver should be equal/smaller than last receiver coordinates!"); if ((recpos1[1][itr]==recpos1[1][itr1])
} && (recpos1[2][itr]==recpos1[2][itr1])
&& (recpos1[3][itr]==recpos1[3][itr1]))
nxrec1=iround(XREC1/DX); /* (nxrec1,nyrec1,nzrec1) and (nxrec2,nyrec2,nzrec2) */ recpos1[1][itr1]=-(++recflag);
nyrec1=iround(YREC1/DY); /* are the positions of the first and last receiver*/
nxrec2=iround(XREC2/DX); /* in gridpoints */ recpos=imatrix(1,3,1,*ntr-recflag);
nyrec2=iround(YREC2/DY);
nzrec1=iround(ZREC1/DZ); for (itr=1; itr<=*ntr; itr++)
nzrec2=iround(ZREC2/DZ); if (recpos1[1][itr]>0) {
if ((abs(nyrec2-nyrec1)<=abs(nxrec2-nxrec1))|| recpos[1][++itr2]=recpos1[1][itr];
(abs(nyrec2-nyrec1)<=abs(nzrec2-nzrec1))){ recpos[2][itr2]=recpos1[2][itr];
if (abs(nzrec2-nzrec1)<=abs(nxrec2-nxrec1)){ recpos[3][itr2]=recpos1[3][itr];
/* geophone-array horizontal x-dirextion */
*ntr=iround((nxrec2-nxrec1)/NGEOPH)+1;
recpos=imatrix(1,3,1,*ntr);
for (nxrec=nxrec1;nxrec<=nxrec2;nxrec+=NGEOPH){
nyrec=nyrec1+((nyrec2-nyrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1));
nzrec=nzrec1+((nzrec2-nzrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1));
itr=iround((nxrec-nxrec1)/NGEOPH)+1;
recpos[1][itr]=nxrec;
recpos[2][itr]=nyrec;
recpos[3][itr]=nzrec;
} }
*ntr=itr2;
if ((recflag>0)||(itr2<(itr-1))) {
fprintf(fp,"\n\n");
fprintf(fp," Warning:\n");
fprintf(fp," Several receivers located at the same gridpoint !\n");
fprintf(fp," Number of receivers reduced to %i\n", *ntr);
fprintf(fp,"\n\n");
}
free_imatrix(recpos1,1,3,1,*ntr);
break;
case 2 : /* REC ARRAY */
ifw=FW+10; /* frame width in gridpoints */
if (BOUNDARY==1) ifw=0;
*ntr=((1+(NZG-2*ifw)/DRY)*(1+(NXG-2*ifw)/DRX))*REC_ARRAY;
recpos=imatrix(1,3,1,*ntr);
itr=0;
for (n=0; n<=REC_ARRAY-1; n++) {
j=iround((REC_ARRAY_DEPTH+REC_ARRAY_DIST*(float)n)/DY);
for (k=ifw; k<=NZG-ifw; k+=DRY)
for (i=ifw; i<=NXG-ifw; i+=DRX) {
itr++;
recpos[1][itr]=i;
recpos[2][itr]=j;
recpos[3][itr]=k;
}
}
break;
case 0 : /* straight horizontal or vertical line of receivers */
if ((XREC1>XREC2) || ((YREC1>YREC2) ||(ZREC1>ZREC2))) {
fprintf(fp," Coordinates of first receiver specified in input file :\n");
fprintf(fp," %5.2f (x) , %5.2f (y) , %5.2f (z) :\n", XREC1,YREC1,ZREC1);
fprintf(fp," Coordinates of last receiver specified in input file :\n");
fprintf(fp," %5.2f (x) , %5.2f (y) , %5.2f (z) :\n", XREC2,YREC2,ZREC2);
err("\n\n Receiver coordinates of first receiver should be equal/smaller than last receiver coordinates!");
} }
else{ /* geophone-array horizontal z-direction */
*ntr=iround((nzrec2-nzrec1)/NGEOPH)+1; nxrec1=iround(XREC1/DX); /* (nxrec1,nyrec1,nzrec1) and (nxrec2,nyrec2,nzrec2) */
/*fprintf(fp,"ntr=%d,nzrec2=%d, nzrec1=%d",ntr,nzrec2, nzrec1);*/ nyrec1=iround(YREC1/DY); /* are the positions of the first and last receiver*/
nxrec2=iround(XREC2/DX); /* in gridpoints */
nyrec2=iround(YREC2/DY);
nzrec1=iround(ZREC1/DZ);
nzrec2=iround(ZREC2/DZ);
if ((abs(nyrec2-nyrec1)<=abs(nxrec2-nxrec1))||
(abs(nyrec2-nyrec1)<=abs(nzrec2-nzrec1))) {
if (abs(nzrec2-nzrec1)<=abs(nxrec2-nxrec1)) {
/* geophone-array horizontal x-dirextion */
*ntr=iround((nxrec2-nxrec1)/NGEOPH)+1;
recpos=imatrix(1,3,1,*ntr);
for (nxrec=nxrec1; nxrec<=nxrec2; nxrec+=NGEOPH) {
if ((nyrec2-nyrec1==0) && (nzrec2-nzrec1==0)) {
nyrec=nyrec1;
nzrec=nzrec1;
} else {
nyrec=nyrec1+((nyrec2-nyrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1));
nzrec=nzrec1+((nzrec2-nzrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1));
}
itr=iround((nxrec-nxrec1)/NGEOPH)+1;
recpos[1][itr]=nxrec;
recpos[2][itr]=nyrec;