PROGRAM d06aafe ! D06AAF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : d06aaf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: coef, power INTEGER :: i, i1, ifail, itrace, k, liwork, & lrwork, nedge, nelt, nv, nvb, nvmax, & reftk LOGICAL :: smooth CHARACTER (1) :: pmesh ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: bspace(:), coor(:,:), rwork(:) INTEGER, ALLOCATABLE :: conn(:,:), edge(:,:), iwork(:) ! .. Intrinsic Functions .. INTRINSIC max ! .. Executable Statements .. WRITE (nout,*) 'D06AAF Example Program Results' ! Skip heading in data file READ (nin,*) ! Reading of the geometry ! Coordinates of the boundary mesh vertices and ! edges references. READ (nin,*) nvb, nvmax, nedge lrwork = nvmax liwork = 16*nvmax + 2*nedge + max(4*nvmax+2,nedge-14) ALLOCATE (bspace(nvb),coor(2,nvmax),rwork(lrwork),conn(3,2*(nvmax- & 1)),edge(3,nedge),iwork(liwork)) DO i = 1, nvb READ (nin,*) i1, coor(1,i1), coor(2,i1) END DO ! Boundary edges DO i = 1, nedge READ (nin,*) i1, edge(1,i1), edge(2,i1), edge(3,i1) END DO ! Initialise mesh control parameters bspace(1:nvb) = 0.05E0_nag_wp smooth = .TRUE. itrace = 0 coef = 0.75E0_nag_wp power = 0.25E0_nag_wp ! Call to the mesh generator ifail = 0 CALL d06aaf(nvb,nvmax,nedge,edge,nv,nelt,coor,conn,bspace,smooth,coef, & power,itrace,rwork,lrwork,iwork,liwork,ifail) WRITE (nout,*) READ (nin,*) pmesh SELECT CASE (pmesh) CASE ('N') WRITE (nout,99999) 'NV =', nv WRITE (nout,99999) 'NELT =', nelt CASE ('Y') ! Output the mesh WRITE (nout,99998) nv, nelt DO i = 1, nv WRITE (nout,99997) coor(1,i), coor(2,i) END DO reftk = 0 DO k = 1, nelt WRITE (nout,99996) conn(1,k), conn(2,k), conn(3,k), reftk END DO CASE DEFAULT WRITE (nout,*) 'Problem with the printing option Y or N' END SELECT 99999 FORMAT (1X,A,I6) 99998 FORMAT (1X,2I10) 99997 FORMAT (2(2X,E13.6)) 99996 FORMAT (1X,4I10) END PROGRAM d06aafe