       SUBROUTINE SMFY

       USE BLKMAP
       USE BLK1MOD
       USE BLK2MOD
       DATA SPAC/0.0/
!       INCLUDE 'BLK1.COM'
!       INCLUDE 'BLK2.COM'
 
!      First delete selected elements and create list of nodes

       do n=1,np
         list(n)=0
         ninc(n)=0
       enddo

       do n=1,nefl
         j=neflag(n)
         do k=1,8,2
           if(nop(j,k) .gt. 0) list(nop(j,k))=1
         enddo
         call deltel(j) 
       enddo

!      All corner nodes connected to elements now have LIST=1

!      Remove nodes that are still connected from list
!      But keep list of nodes that are dropped
!      Now form list of nodes to be refined
       do n=1,ne
         if(imat(n) .gt. 0) then
           do k=1,8,2
             if(nop(n,k) .gt. 0) then
               if(list(nop(n,k)) .eq. 1) then
                 ninc(nop(n,k))=1
               endif
               list(nop(n,k))=0               
             endif
           enddo
         endif
       enddo


!      Get simplification options

       CALL TRIANOPT(NINTV,SPAC)

!     Sort points into ascending x order

       CALL SORTDB(XUSR,NKEY,NP) 

!     Drop points based on spacing

       IF(NINTV .GT. 1  .OR.  SPAC .GT. 0.) THEN
         CALL DROPPTS(NP,NINTV,SPAC)
       ENDIF

!      Add back in the edge nodes

       DO N=1,NP
         IF(NINC(N) .EQ. 1) LIST(N)=1
       ENDDO

!      Form new triangles

       call deln2(np,2)

!      
       RETURN
       END