subroutine partx (minblk, remblk, k, base, top) c integer minblk, remblk, k, base, top c ***----------------------------------------------------------*** c * 'partx' calculates the index of the base and top block * c * of the k-th partition. The indexing scheme assumes that * c * nbloks >= 2*nparts, so minblk >= 2 and remblk >= 0. * c * * c * on entry * c * * c * minblk [integer] * c * minimum number of blocks/partition * c * (minblk = nbloks/nparts) * c * * c * remblk [integer] * c * first remblk partitions have minblk+1 blocks * c * (remblk = nbloks - minblk*nparts) * c * * c * k [integer] * c * * c * on return * c * * c * base [integer] * c * index of base block of k-th partition * c * * c * top [integer] * c * index of top block of k-th partition * c ***----------------------------------------------------------*** integer khigh, klow c if (k .le. remblk) then khigh = k klow = 0 else khigh = remblk klow = k - khigh endif base = khigh*(minblk+1) + klow*minblk top = base - minblk + 1 if (k .le. remblk) then top = top - 1 endif return end