* This function is the entry point for PWMETIS that accepts exact weights * for the target partitions **************************************************************************/
| 43 | * for the target partitions |
| 44 | **************************************************************************/ |
| 45 | void METIS_WPartGraphRecursive(int *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, |
| 46 | idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, |
| 47 | float *tpwgts, int *options, int *edgecut, idxtype *part) |
| 48 | { |
| 49 | int i, j; |
| 50 | GraphType graph; |
| 51 | CtrlType ctrl; |
| 52 | float *mytpwgts; |
| 53 | |
| 54 | if (*numflag == 1) |
| 55 | Change2CNumbering(*nvtxs, xadj, adjncy); |
| 56 | |
| 57 | SetUpGraph(&graph, OP_PMETIS, *nvtxs, 1, xadj, adjncy, vwgt, adjwgt, *wgtflag); |
| 58 | |
| 59 | if (options[0] == 0) { /* Use the default parameters */ |
| 60 | ctrl.CType = PMETIS_CTYPE; |
| 61 | ctrl.IType = PMETIS_ITYPE; |
| 62 | ctrl.RType = PMETIS_RTYPE; |
| 63 | ctrl.dbglvl = PMETIS_DBGLVL; |
| 64 | } |
| 65 | else { |
| 66 | ctrl.CType = options[OPTION_CTYPE]; |
| 67 | ctrl.IType = options[OPTION_ITYPE]; |
| 68 | ctrl.RType = options[OPTION_RTYPE]; |
| 69 | ctrl.dbglvl = options[OPTION_DBGLVL]; |
| 70 | } |
| 71 | ctrl.optype = OP_PMETIS; |
| 72 | ctrl.CoarsenTo = 20; |
| 73 | ctrl.maxvwgt = 1.5*(idxsum(*nvtxs, graph.vwgt)/ctrl.CoarsenTo); |
| 74 | |
| 75 | mytpwgts = fmalloc(*nparts, "PWMETIS: mytpwgts"); |
| 76 | for (i=0; i<*nparts; i++) |
| 77 | mytpwgts[i] = tpwgts[i]; |
| 78 | |
| 79 | InitRandom(-1); |
| 80 | |
| 81 | AllocateWorkSpace(&ctrl, &graph, *nparts); |
| 82 | |
| 83 | IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl)); |
| 84 | IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr)); |
| 85 | |
| 86 | *edgecut = MlevelRecursiveBisection(&ctrl, &graph, *nparts, part, mytpwgts, 1.000, 0); |
| 87 | |
| 88 | IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.TotalTmr)); |
| 89 | IFSET(ctrl.dbglvl, DBG_TIME, PrintTimers(&ctrl)); |
| 90 | |
| 91 | FreeWorkSpace(&ctrl, &graph); |
| 92 | free(mytpwgts); |
| 93 | |
| 94 | if (*numflag == 1) |
| 95 | Change2FNumbering(*nvtxs, xadj, adjncy, part); |
| 96 | } |
| 97 | |
| 98 | |
| 99 |
no test coverage detected