/* * Copyright 1997, Regents of the University of Minnesota * * selectq.c * * This file contains the driving routines for multilevel k-way refinement * * Started 7/28/97 * George * * $Id: selectq.c,v 1.2 2003/07/21 17:18:53 karypis Exp $ */ #include /************************************************************************* * This stuff is hardcoded for up to four constraints **************************************************************************/ void Moc_DynamicSelectQueue(int nqueues, int ncon, int subdomain1, int subdomain2, idxtype *currentq, float *flows, int *from, int *qnum, int minval, float avgvwgt, float maxdiff) { int i, j; int hash, index = -1, current; int cand[MAXNCON], rank[MAXNCON], dont_cares[MAXNCON]; int nperms, perm[24][5]; float sign = 0.0; KVType array[MAXNCON]; int mype; MPI_Comm_rank(MPI_COMM_WORLD, &mype); *qnum = -1; if (*from == -1) { for (i=0; iavgvwgt*MOC_GD_GRANULARITY_FACTOR) { *from = subdomain1; sign = 1.0; index = 0; } if (flows[array[ncon-1].key]<-1.0*avgvwgt*MOC_GD_GRANULARITY_FACTOR) { *from = subdomain2; sign = -1.0; index = nqueues; } if (*from == -1) { return; } } else { ASSERTS(*from == subdomain1 || *from == subdomain2); if (*from == subdomain1) { sign = 1.0; index = 0; } else { sign = -1.0; index = nqueues; } } for (i=0; i 0) { *qnum = hash; return; } } return; } /************************************************************************* * This function sorts the nvwgts of a vertex and returns a hashed value **************************************************************************/ int Moc_HashVwgts(int ncon, float *nvwgt) { int i; int multiplier, retval; int rank[MAXNCON]; KVType array[MAXNCON]; for (i=0; i