      SUBROUTINE get_mesh

      INCLUDE 'irreg.h'

      integer total,i,comm_data,tempn(0:MaxDegree),l,j,k,index
      real temp(0:3),tempc(0:90)

      comm_data = (nm+1)/nprocs

CC    Get the number of neighbours for the nodes in proc_n

      status=kxread(proc_n,4*comm_data,IHOST,100)

      do i=0,(comm_data-1)
         total = total+proc_n(i)
      enddo

ccc
ccc	do i =0, (comm_data-1)
ccc	 print *,'i am neigh are',procnum,proc_n(i)
ccc	enddo


CC    Tell the host to continue
       status=kxwrit(temp,4,IHOST,99)
ccc       Print *, "Acknowledgement 1 sent from",procnum

CC    get the indices of neighbours
       
       index=0
       do i =0, (comm_data-1)  
       index = proc_n(i)
ccc       print *,'procnum and index is',procnum,index
	status=kxread(tempn,4*index,ihost,110)
	 do j=0, index-1
	  neigh(i,j)=tempn(j)
         enddo
       enddo  

CC    Tell the host to continue
       status=kxwrit(temp,4,IHOST,99)
ccc       Print *, "Acknowledgement 2 sent from",procnum

c$$$	do i=0, (comm_data-1)
c$$$	 index = proc_n(i)
c$$$	  do j=0, index-1
c$$$cc	   print *,'neigh(i,j)',procnum, neigh(i,j)
c$$$          enddo
c$$$        enddo

     
      return
      end
