*     D06ABF Example Program Text
*     Mark 20 Release. NAG Copyright 2001.
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        (NIN=5,NOUT=6)
      INTEGER          NBEDMX, NVMAX, NVIMX, LRWORK, LIWORK
      PARAMETER        (NBEDMX=300,NVMAX=6000,NVIMX=40,
     +                 LRWORK=12*NVMAX+15,LIWORK=6*NBEDMX+34*NVMAX+78)
*     .. Local Scalars ..
      DOUBLE PRECISION DNVINT
      INTEGER          I, I1, IFAIL, ITRACE, J, K, NEDGE, NELT, NPROPA,
     +                 NV, NVB, NVINT, REFTK
      CHARACTER        PMESH
*     .. Local Arrays ..
      DOUBLE PRECISION COOR(2,NVMAX), RWORK(LRWORK), WEIGHT(NVIMX)
      INTEGER          CONN(3,2*NVMAX+5), EDGE(3,NBEDMX), IWORK(LIWORK)
*     .. External Subroutines ..
      EXTERNAL         D06ABF
*     .. Intrinsic Functions ..
*
      INTRINSIC        DBLE
*     .. Executable Statements ..
      WRITE (NOUT,*) 'D06ABF Example Program Results'
      WRITE (NOUT,*)
*
*     Skip heading in data file
*
      READ (NIN,*)
*
*     Reading of the geometry
*     Coordinates of the boundary mesh vertices and
*     edges references.
*
      READ (NIN,*) NVB, NEDGE
*
      IF (NVB.GT.NVMAX .OR. NEDGE.GT.NBEDMX) THEN
         WRITE (NOUT,*) 'Problem with the array dimensions '
         WRITE (NOUT,99999) ' NVB MAX ', NVB, NVMAX
         WRITE (NOUT,99999) ' NEDGE MAX ', NEDGE, NBEDMX
         STOP
      END IF
*
      DO 20 I = 1, NVB
         READ (NIN,*) I1, COOR(1,I), COOR(2,I)
   20 CONTINUE
*
*     Boundary edges
*
      DO 40 I = 1, NEDGE
         READ (NIN,*) I1, EDGE(1,I), EDGE(2,I), EDGE(3,I)
   40 CONTINUE
*
      READ (NIN,*) PMESH
*
*     Initialise mesh control parameters
*
      ITRACE = 0
*
*     Generation of interior vertices on the
*     RAE airfoils wake
*
      NVINT = 40
      DNVINT = 2.5D0/DBLE(NVINT+1)
      DO 60 I = 1, NVINT
         I1 = NVB + I
         COOR(1,I1) = 1.38D0 + DBLE(I)*DNVINT
         COOR(2,I1) = -0.27D0*COOR(1,I1) + 0.2D0
         WEIGHT(I) = 0.01D0
   60 CONTINUE
*
*     Loop on the propagation coef
*
      DO 120 J = 1, 4
         IF (J.EQ.1) THEN
            NPROPA = -5
         ELSE IF (J.EQ.2) THEN
            NPROPA = -1
         ELSE IF (J.EQ.3) THEN
            NPROPA = 1
         ELSE
            NPROPA = 5
         END IF
*
*     Call to the 2D Delaunay-Voronoi mesh generator
*
         IFAIL = 0
*
         CALL D06ABF(NVB,NVINT,NVMAX,NEDGE,EDGE,NV,NELT,COOR,CONN,
     +               WEIGHT,NPROPA,ITRACE,RWORK,LRWORK,IWORK,LIWORK,
     +               IFAIL)
*
         IF (PMESH.EQ.'N') THEN
            WRITE (NOUT,99998) 'Mesh characteristics with NPROPA =',
     +        NPROPA
            WRITE (NOUT,99998) 'NV   =', NV
            WRITE (NOUT,99998) 'NELT =', NELT
         ELSE IF (PMESH.EQ.'Y') THEN
*
*     Output the mesh to view it using the NAG Graphics Library
*
            WRITE (NOUT,99997) NV, NELT
            DO 80 I = 1, NV
               WRITE (NOUT,99996) COOR(1,I), COOR(2,I)
   80       CONTINUE
*
            REFTK = 0
            DO 100 K = 1, NELT
               WRITE (NOUT,99995) CONN(1,K), CONN(2,K), CONN(3,K), REFTK
  100       CONTINUE
         ELSE
            WRITE (NOUT,*) 'Problem with the printing option Y or N'
            STOP
         END IF
  120 CONTINUE
*
      STOP
*
99999 FORMAT (1X,A,2I6)
99998 FORMAT (1X,A,I6)
99997 FORMAT (1X,2I10)
99996 FORMAT (2(2X,E12.6))
99995 FORMAT (1X,4I10)
      END
