c
      xoo=0.0
      yoo=0.0
      zoo=0.0
      BOXX=600.0
      BOXY=600.0
      BOXZ=600.0
      NBOXX=3
      NBOXY=2
      NBOXZ=3
      write(*,*)'NBOXX,NBOXY,NBOXZ',NBOXX,NBOXY,NBOXZ
      write(*,*)'Total Number of BOX',NBOXX*NBOXY*NBOXZ
      x1=xoo
      x2=x1+BOXX*NBOXX
      y1=yoo
      y2=y2+BOXY*NBOXY
      z1=zoo
      z2=z1+BOXZ*NBOXZ
c
      write(*,*)'x1,x2',x1,x2
      write(*,*)'y1,y2',y1,y2
      write(*,*)'z1,z2',z1,z2
c
 10   write(*,*)'Enter Location (x,y,z):'
      read(*,*)x,y,z
      if((x.lt.x1).or.(x.gt.x2))then
        write(*,*)'x is not within the domain !!'
        write(*,*)'x1,x2,x =',x1,x2,x
        stop
      end if
      if((y.lt.y1).or.(y.gt.y2))then
        write(*,*)'y is not within the domain !!'
        write(*,*)'y1,y2,y =',y1,y2,y
        stop
      end if
      if((z.lt.z1).or.(z.gt.z2))then
        write(*,*)'z is not within the domain !!'
        write(*,*)'z1,z2,z =',z1,z2,z
        stop
      end if
c
      do i=1,NBOXX
        xx1=xoo+BOXX*(i-1)
        xx2=xoo+BOXX*i
        if((x.ge.xx1).and.(x.le.xx2))iBOXx=i
      end do
      do i=1,NBOXY
        yy1=yoo+BOXY*(i-1)
        yy2=yoo+BOXY*i
        if((y.ge.yy1).and.(y.le.yy2))iBOXy=i
      end do
      do i=1,NBOXZ
        zz1=zoo+BOXZ*(i-1)
        zz2=zoo+BOXZ*i
        if((z.ge.zz1).and.(z.le.zz2))iBOXz=i
      end do
      write(*,*)'iBOXx,y,z',iBOXx,iBOXy,iBOXz
      NBOX=(iBOXz-1)*NBOXX*NBOXY+(iBOXy-1)*NBOXX+iBOXx
      write(*,*)'NBOX',NBOX
c
      i=NBOX/(NBOXX*NBOXY)
      j=mod(NBOX,NBOXX*NBOXY)
      write(*,*)'i,j',i,j
      ii=i+1
      jj=j      
      if(j.eq.0)then
        ii=i
        jj=NBOXX*NBOXY
      end if
      write(*,*)'ii(row),jj(box)',ii,jj
c
      NODEx=NBOXX*2+1
      NODEy=NBOXY*2+1
      NODExy=NODEx*NODEy
      iNODE=(ii-1)*NODExy*2
      k=jj/NBOXX
      l=MOD(jj,NBOXX)
      kk=k
      ll=l
      if(l.eq.0)then
        kk=k-1
        ll=NBOXX
      end if
      write(*,*)'kk(xBOX),ll(+BOX)',iBOX,kk,ll
      jNODE=NODEx*2*kk+(ll*2-1)
      write(*,*)'iNODE(row),jNODE(+NODE)',iNODE,jNODE
c
      NODE1=iNODE+jNODE
      NODE2=NODE1+1
      NODE3=NODE2+1
      NODE4=NODE1+NODEx
      NODE5=NODE2+NODEx
      NODE6=NODE3+NODEx
      NODE7=NODE4+NODEx
      NODE8=NODE5+NODEx
      NODE9=NODE6+NODEx
      NODE10=NODE1+NODExy
      NODE11=NODE2+NODExy
      NODE12=NODE3+NODExy
      NODE13=NODE4+NODExy
      NODE14=NODE5+NODExy
      NODE15=NODE6+NODExy
      NODE16=NODE7+NODExy
      NODE17=NODE8+NODExy
      NODE18=NODE9+NODExy
      NODE19=NODE10+NODExy
      NODE20=NODE11+NODExy
      NODE21=NODE12+NODExy
      NODE22=NODE13+NODExy
      NODE23=NODE14+NODExy
      NODE24=NODE15+NODExy
      NODE25=NODE16+NODExy
      NODE26=NODE17+NODExy
      NODE27=NODE18+NODExy
      write(*,*)'NODE 1, 2, 3',NODE1,NODE2,NODE3
      write(*,*)'NODE 4, 5, 6',NODE4,NODE5,NODE6
      write(*,*)'NODE 7, 8, 9',NODE7,NODE8,NODE9
      write(*,*)'NODE10,11,12',NODE10,NODE11,NODE12
      write(*,*)'NODE13,14,15',NODE13,NODE14,NODE15
      write(*,*)'NODE16,17,18',NODE16,NODE17,NODE18
      write(*,*)'NODE19,20,21',NODE19,NODE20,NODE21
      write(*,*)'NODE22,23,24',NODE22,NODE23,NODE24
      write(*,*)'NODE25,26,27',NODE25,NODE26,NODE27
 
      goto 10
c
      stop
      end
