C
C Program GRDPTS to generate the file containing the coordinates of all
C gridpoints of the given grid.
C
C Version: 5.40
C Date: 2000, January 22
C
C Coded by: Ludek Klimes
C Department of Geophysics, Charles University Prague,
C Ke Karlovu 3, 121 16 Praha 2, Czech Republic,
C E-mail: klimes@seis.karlov.mff.cuni.cz
C
C.......................................................................
C
C Description of data files:
C
C Input data read from the standard input device (*):
C The data are read by the list directed input (free format) and
C consist of a single string 'SEP':
C 'SEP'...String in apostrophes containing the name of the input
C SEP parameter or history file with the input data.
C No default, 'SEP' must be specified and cannot be blank.
C
C
C Input data file 'SEP':
C File 'SEP' has the form of the SEP
C parameter file. The parameters, which do not differ from their
C defaults, need not be specified in file 'SEP'.
C Data specifying grid dimensions:
C N1=positive integer... Number of gridpoints along the X1 axis.
C Default: N1=1
C N2=positive integer... Number of gridpoints along the X2 axis.
C Default: N2=1
C N3=positive integer... Number of gridpoints along the X3 axis.
C Default: N3=1
C O1=real... First coordinate of the grid origin (first point of the
C grid).
C Default: O1=0.
C O2=real... Second coordinate of the grid origin.
C Default: O2=0.
C O3=real... Third coordinate of the grid origin.
C Default: O3=0.
C D1=real... Grid interval in the direction of the first coordinate
C axis.
C Default: D1=1.
C D2=real... Grid interval in the direction of the second coordinate
C axis.
C Default: D2=1.
C D3=real... Grid interval in the direction of the third coordinate
C axis.
C Default: D3=1.
C Name of the output file:
C PTS='string'...Name of the output file with the coordinates
C of the gridpoints.
C Default: PTS='pts.out'
C
C
C Output file PTS with the gridpoints:
C (1) /
C (2) For each gridpoint data (2.1):
C (2.1) 'NNNNNN',X1,X2,X3,/
C 'NNNNNN'... Name of the point - six-digit integer index of the
C gridpoint (larger grids than 999999 gridpoints are
C not expected to be converted into this form suitable
C for a reasonably small number of points).
C X1,X2,X3... Coordinates of the gridpoint.
C (3) /
C
C-----------------------------------------------------------------------
C
CHARACTER*80 FILSEP
INTEGER LU0
PARAMETER (LU0=1)
C
CHARACTER*80 FPTS
INTEGER LU
PARAMETER (LU=1)
C
CHARACTER*34 FORMAT
INTEGER I1,I2,I3,I
REAL X(3),X1,X2,X3,O1,O2,O3,D1,D2,D3
EQUIVALENCE (X(1),X1),(X(2),X2),(X(3),X3)
C
C-----------------------------------------------------------------------
C
C Reading name of SEP file with input data:
WRITE(*,'(A)') '+GRDPTS: Enter input filename: '
FILSEP=' '
READ(*,*) FILSEP
WRITE(*,'(A)') '+GRDPTS: Working ... '
C
C Reading all data from the SEP file into the memory:
IF (FILSEP.NE.' ') THEN
CALL RSEP1(LU0,FILSEP)
ELSE
C GRDPTS-01
CALL ERROR('GRDPTS-01: SEP file not given')
C Input file in the form of the SEP (Stanford Exploration Project)
C parameter or history file must be specified.
C There is no default filename.
ENDIF
C
C Reading input parameters from the SEP file:
CALL RSEP3T('PTS',FPTS,'pts.out')
C
C Recalling the data specifying grid dimensions
C (arguments: Name of value in input data, Variable, Default):
CALL RSEP3I('N1',N1,1)
CALL RSEP3I('N2',N2,1)
CALL RSEP3I('N3',N3,1)
CALL RSEP3R('O1',O1,0.)
CALL RSEP3R('O2',O2,0.)
CALL RSEP3R('O3',O3,0.)
CALL RSEP3R('D1',D1,1.)
CALL RSEP3R('D2',D2,1.)
CALL RSEP3R('D3',D3,1.)
C
C Writing output points:
OPEN(LU,FILE=FPTS)
WRITE(LU,'(A)') '/'
FORMAT(1:10)='(A,I6.6,A,'
I=0
DO 23 I3=0,N3-1
X3=O3+D3*FLOAT(I3)
DO 22 I2=0,N2-1
X2=O2+D2*FLOAT(I2)
DO 21 I1=0,N1-1
X1=O1+D1*FLOAT(I1)
I=I+1
C Writing:
CALL FORM2(3,X,X,FORMAT(11:34))
WRITE(LU,FORMAT) '''',I,''' ',X1,' ',X2,' ',X3,' /'
21 CONTINUE
22 CONTINUE
23 CONTINUE
WRITE(LU,'(A)') '/'
CLOSE(LU)
C
WRITE(*,'(A)') '+GRDPTS: Done. '
STOP
END
C
C=======================================================================
C
INCLUDE 'error.for'
C error.for
INCLUDE 'sep.for'
C sep.for
INCLUDE 'forms.for'
C forms.for
INCLUDE 'length.for'
C length.for
C
C=======================================================================
C