C
C=======================================================================
C
C     INCLUDE 'rp3d.inc'
C
C----------------------------------------------------------------------
C
C Date: 2001, October 26
C Coded by Petr Bulant
C
C----------------------------------------------------------------------
C Common block /BOURA/:
      INTEGER MBR
      PARAMETER (MBR=5000)
      INTEGER NBR,KBR(MBR,3)
      REAL GBR(MBR,2)
      COMMON/BOURA/NBR,KBR,GBR
      SAVE/BOURA/
C
C     MBR...Dimension of arrays KBR,GBR.
C     NBR........Number of rays stored in KBR.
C     KBR...Array of boundary rays lying on the sides of basic triangles
C           and used only once. If a new triangle is to be divided,
C           boundary rays are used from KBR.
C     KBR(J+1,1)...Index of first vertex of the basic triangle.
C     KBR(J+2,1)...Index of second vertex of the basic triangle.
C     KBR(J+3,1)...Number of rays, lying on the side formed by
C                  these two rays.
C     KBR(I,1)...Array of indices of boundary rays.
C                  (I=J+4...J+3+KBR(J+3,1))
C     KBR(I,2)...Array of sheets of boundary rays.
C     KBR(I,3)...Array of types of boundary rays.
C     GBR(I,1)...Array of normalized ray parameters G1 of boundary rays.
C     GBR(I,2)...Array of normalized ray parameters G2 of boundary rays.
C----------------------------------------------------------------------
C     Common block /AUX/:
      INTEGER MARAY,NARAY
      PARAMETER (MARAY=20000)
      INTEGER KARAY(MARAY)
      COMMON/AUX/KARAY,NARAY
      SAVE/AUX/
C----------------------------------------------------------------------
C Common block /POLY/:
      INTEGER MPL
      PARAMETER (MPL=800)
      INTEGER NPL,KPL(MPL)
      COMMON /POLY/NPL,KPL
      SAVE/POLY/
C     MPL ... Maximum dimension of KPL.
C     NPL ... Number of points of polyline boundary of the region
C             covered by the basic triangles.
C     KPL ... Indices of rays forming the polyline.
C----------------------------------------------------------------------
C Common block /RAY/:
      INTEGER MRAY
      PARAMETER (MRAY=50000)
      INTEGER NRAY,KRAY(MRAY),ITRAY(MRAY),ISRAY(MRAY),IBRAY(MRAY)
      REAL G1RAY(MRAY),G2RAY(MRAY)
      REAL X1RAY(MRAY),X2RAY(MRAY)
      REAL G11RAY(MRAY),G12RAY(MRAY),G22RAY(MRAY)
      REAL S11RAY(MRAY),S12RAY(MRAY),S22RAY(MRAY)
      REAL G1X1RA(MRAY),G1X2RA(MRAY),G2X1RA(MRAY),G2X2RA(MRAY)
      COMMON/RAY/NRAY,KRAY,ITRAY,ISRAY,IBRAY,G1RAY,G2RAY,G11RAY,G12RAY,
     *           G22RAY,S11RAY,S12RAY,S22RAY,X1RAY,X2RAY,
     *           G1X1RA,G1X2RA,G2X1RA,G2X2RA
      SAVE/RAY/
C     MRAY... Maximum number of rays in memory (dimension of arrays
C             KRAY,ITRAY,ISRAY,G1RAY,G2RAY,...)
C     NRAY... Number of rays in memory - the last ray is the newest one.
C             NRAY=0 when starting the  computation of a new wave.
C     KRAY... Indices of rays stored in the memory.
C     ITRAY...Types of rays:
C             0:.............. Basic ray.
C             ITRAY(I).GT.0:.. Boundary ray, ITRAY(I) is the index
C                              of the boundary ray at the other side
C                              of the boundary.
C             -2:............. Auxiliary ray,not used.
C             -3:............. Auxiliary ray,used.
C             -1000-I:........ Two-point ray (to the I'th receiver).
C     ISRAY.. Sheets of the wave on which the rays lie.
C     IBRAY . Identifies, whether the ray has been written to the CRT
C             output file 'CRT-B':
C             0: ... The ray has not been written to 'CRT-B'.
C             1: ... The ray has already been written to 'CRT-B'.
C     G1RAY,G2RAY... Normalized parameters of rays.
C     X1RAY,X2RAY... Coordinates of the ray on the ref. surface.
C     G11RAY,G12RAY,G22RAY...  Ray-parameter metric tensor.
C     S11RAY,S12RAY,S22RAY ... Components of the ray-tube metric tensor,
C             describing thickness of the ray tubes.
C     G1X1RA,G1X2RA,G2X1RA,G2X2RA ...Derivations of ray parameters
C                                    according to surface coordinates.
C----------------------------------------------------------------------
C Common block /TRIAN/:
      INTEGER MTRI
      PARAMETER (MTRI=20000)
      INTEGER NTRI,KTRI(6,MTRI)
      COMMON/TRIAN/NTRI,KTRI
      SAVE/TRIAN/
C     MTRI... Maximum number of triangles in memory
C             (dimension of array KTRI).
C     NTRI... Number of triangles.
C     KTRI... List of triangles.
C             KTRI(1,I),KTRI(2,I),KTRI(3,I)...Indices of vertices of the
C                                             I-th triangle.
C             KTRI(4,I)... Index of the I-th triangle.
C             KTRI(5,I)... Index of the triangle containing the I-th
C                          triangle, zero for basic triangles.
C             KTRI(6,I)... Type of the I-th triangle.
C               0: new triangle.
C               1: triangle being processed.
C               2: divided triangle.
C               3: homogeneous triangle.
C               4: triangle with all two-point rays determined.
C----------------------------------------------------------------------
C Common block /GLIM/:
      REAL GLIMIT(4)
      COMMON/GLIM/GLIMIT
      SAVE/GLIM/
C     GLIMIT ... Limits of the normalized ray domain.
C----------------------------------------------------------------------
C Common block /AUXER/:
      INTEGER MAUAR
      PARAMETER (MAUAR=10000)
      INTEGER NAUAR,KAUAR(MAUAR)
      COMMON/AUXER/NAUAR,KAUAR
      SAVE/AUXER/
C     MAUAR...Maximum number of rays in KAUAR.
C     NAUAR...Number of rays in KAUAR.
C     KAUAR...Auxiliary array used in RPERAS (indices of triangles).
C----------------------------------------------------------------------
C Common block /DRAYS/:
      INTEGER MDRAYS
      PARAMETER (MDRAYS=2000)
      INTEGER KDRAYS(MDRAYS),NDRAYS
      COMMON/DRAYS/KDRAYS,NDRAYS
      SAVE/DRAYS/
C     KDRAYS ... Array of indices of the rays, that were used to divide
C                the side of the homogeneous triangle right once. New
C                rays are first searched for in this array.
C     NDRAYS ... Number of the rays in array KDRAYS.
C=======================================================================
C