      Subroutine cntdpls( sizes, scnts, sdpls, rcnts, rdpls )
! --------------------------------------------------------------------
! --- Fills the arrays describing the various sizes of the blocks
!     that are sent trough alltoallv and reordered afterwards.
! --------------------------------------------------------------------
      Use        dist_module ! Contains #procs and no.s
      Implicit   None

      Integer :: sizes(0:nodes-1,2),
     &           scnts(0:nodes-1), sdpls(0:nodes-1),
     &           rcnts(0:nodes-1), rdpls(0:nodes-1)

      Integer :: k
! --------------------------------------------------------------------
      scnts = sizes(me,2)*sizes(:,1)
      sdpls(0) = 0
      Do k = 1, nodes - 1
         sdpls(k) = sdpls(k-1) + scnts(k-1)
      End Do
      rcnts = sizes(me,1)*sizes(:,2)
      rdpls(0) = 0
      Do k = 1, nodes - 1
         rdpls(k) = rdpls(k-1) + rcnts(k-1)
      End Do
! --------------------------------------------------------------------
      End Subroutine cntdpls
