/************************************************************************* * This function is the entry point of refinement **************************************************************************/ void MocRefine2Way2(CtrlType *ctrl, GraphType *orggraph, GraphType *graph, float *tpwgts, float *ubvec) { IFSET(ctrl->dbglvl, DBG_TIME, starttimer(ctrl->UncoarsenTmr)); /* Compute the parameters of the coarsest graph */ MocCompute2WayPartitionParams(ctrl, graph); for (;;) { ASSERT(CheckBnd(graph)); IFSET(ctrl->dbglvl, DBG_TIME, starttimer(ctrl->RefTmr)); switch (ctrl->RType) { case RTYPE_FM: MocBalance2Way2(ctrl, graph, tpwgts, ubvec); MocFM_2WayEdgeRefine2(ctrl, graph, tpwgts, ubvec, 8); break; default: errexit("Unknown refinement type: %d\n", ctrl->RType); } IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->RefTmr)); if (graph == orggraph) break; graph = graph->finer; IFSET(ctrl->dbglvl, DBG_TIME, starttimer(ctrl->ProjectTmr)); MocProject2WayPartition(ctrl, graph); IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->ProjectTmr)); } IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->UncoarsenTmr)); }
/************************************************************************* * This function is the entry point of refinement **************************************************************************/ void MocRefine2Way(CtrlType *ctrl, GraphType *orggraph, GraphType *graph, float *tpwgts, float ubfactor) { int i; float tubvec[MAXNCON]; for (i=0; i<graph->ncon; i++) tubvec[i] = 1.0; IFSET(ctrl->dbglvl, DBG_TIME, starttimer(ctrl->UncoarsenTmr)); /* Compute the parameters of the coarsest graph */ MocCompute2WayPartitionParams(ctrl, graph); for (;;) { ASSERT(CheckBnd(graph)); IFSET(ctrl->dbglvl, DBG_TIME, starttimer(ctrl->RefTmr)); switch (ctrl->RType) { case RTYPE_FM: MocBalance2Way(ctrl, graph, tpwgts, 1.03); MocFM_2WayEdgeRefine(ctrl, graph, tpwgts, 8); break; case 2: MocBalance2Way(ctrl, graph, tpwgts, 1.03); MocFM_2WayEdgeRefine2(ctrl, graph, tpwgts, tubvec, 8); break; default: errexit("Unknown refinement type: %d\n", ctrl->RType); } IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->RefTmr)); if (graph == orggraph) break; graph = graph->finer; IFSET(ctrl->dbglvl, DBG_TIME, starttimer(ctrl->ProjectTmr)); MocProject2WayPartition(ctrl, graph); IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->ProjectTmr)); } MocBalance2Way(ctrl, graph, tpwgts, 1.01); MocFM_2WayEdgeRefine(ctrl, graph, tpwgts, 8); IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->UncoarsenTmr)); }