c********************************************************************** c Basic Distribution Function Library c c Fortran90 version c c 1996 9/8 c composed by T.Katagiri c c*********************************************************************** c All Rights Reserved, Copyright (C) 1998, T.Katagiri c/*- c * Copyright (c) 1998 Information Promotion Agency of Japan and T.Katagiri c * All rights reserved. c * c * Redistribution and non-commercial use in source and binary forms, c * with or without modification, are permitted provided that the following c * conditions are met: c * c * 1. Redistributions of source code must retain the above copyright c * notice, this list of conditions and the following disclaimer. c * c * 2. Redistributions in binary form must reproduce the above copyright c * notice, this list of conditions and the following disclaimer in the c * documentation and/or other materials provided with the distribution. c * c * 3. All advertising materials mentioning features or use of this c * software must display the following acknowledgement: c * c * This product includes software developed by Information Promotion c * Agency of Japan and T.Katagiri c * c * 4. The name "Information Promotion Agency" or "T.Katagiri" should not be c * used to endorse or promote products derived from this software c * without specific prior written permission. c * c * 5. Any use of the source code or the binary in a commercial product, c * whether may it be the origial representation or in some modified form, c * is not permitted without specific prior written permission. c * c * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND c * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE c * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE c * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE c * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL c * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS c * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) c * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT c * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY c * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF c * SUCH DAMAGE. c */ integer function BLOCK_OWNER(i, p, n) integer i, p, n real*8 np np = idceiling(dfloat(n)/dfloat(p)) BLOCK_OWNER = idfloor(dfloat(i)/np) return end integer function BLOCK_LOC(i, p, n) integer i, p, n, np np = idceiling(dfloat(n)/dfloat(p)) BLOCK_LOC = modulo(i,np) return end integer function CYCLIC_OWNER(i, p) integer i, p CYCLIC_OWNER = modulo(i, p) return end integer function CYCLIC_LOC(i, p) integer i, p real*8 ii, pp ii = i pp = p CYCLIC_LOC = idfloor(ii/pp) return end subroutine cid2xy(pe_num, ncelx, ncidx, ncidy) integer pe_num, ncelx, ncidx, ncidy ncidx = modulo(pe_num, ncelx) ncidy = (pe_num - modulo(pe_num, ncelx))/ncelx return end