hp2FEM  0.1
src/metis-5.0/libmetis/proto.h
00001 /*
00002  * Copyright 1997, Regents of the University of Minnesota
00003  *
00004  * proto.h
00005  *
00006  * This file contains header files
00007  *
00008  * Started 10/19/95
00009  * George
00010  *
00011  * $Id: proto.h 10565 2011-07-13 16:07:36Z karypis $
00012  *
00013  */
00014 
00015 #ifndef _LIBMETIS_PROTO_H_
00016 #define _LIBMETIS_PROTO_H_
00017 
00018 /* auxapi.c */
00019 
00020 /* balance.c */
00021 void Balance2Way(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts);
00022 void Bnd2WayBalance(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts);
00023 void General2WayBalance(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts);
00024 void McGeneral2WayBalance(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts);
00025 
00026 
00027 /* bucketsort.c */
00028 void BucketSortKeysInc(ctrl_t *ctrl, idx_t n, idx_t max, idx_t *keys,
00029          idx_t *tperm, idx_t *perm);
00030 
00031 
00032 /* checkgraph.c */
00033 int CheckGraph(graph_t *graph, int numflag, int verbose);
00034 int CheckInputGraphWeights(idx_t nvtxs, idx_t ncon, idx_t *xadj, idx_t *adjncy,
00035         idx_t *vwgt, idx_t *vsize, idx_t *adjwgt);
00036 graph_t *FixGraph(graph_t *graph);
00037 
00038 
00039 /* coarsen.c */
00040 graph_t *CoarsenGraph(ctrl_t *ctrl, graph_t *graph);
00041 graph_t *CoarsenGraphNlevels(ctrl_t *ctrl, graph_t *graph, idx_t nlevels);
00042 idx_t Match_RM(ctrl_t *ctrl, graph_t *graph);
00043 idx_t Match_SHEM(ctrl_t *ctrl, graph_t *graph);
00044 void PrintCGraphStats(ctrl_t *ctrl, graph_t *graph);
00045 void CreateCoarseGraph(ctrl_t *ctrl, graph_t *graph, idx_t cnvtxs, 
00046          idx_t *match);
00047 void CreateCoarseGraphNoMask(ctrl_t *ctrl, graph_t *graph, idx_t cnvtxs, 
00048          idx_t *match);
00049 void CreateCoarseGraphPerm(ctrl_t *ctrl, graph_t *graph, idx_t cnvtxs, 
00050          idx_t *match, idx_t *perm);
00051 graph_t *SetupCoarseGraph(graph_t *graph, idx_t cnvtxs, idx_t dovsize);
00052 void ReAdjustMemory(ctrl_t *ctrl, graph_t *graph, graph_t *cgraph);
00053 
00054 
00055 
00056 /* compress.c */
00057 graph_t *CompressGraph(ctrl_t *ctrl, idx_t nvtxs, idx_t *xadj, idx_t *adjncy, 
00058              idx_t *vwgt, idx_t *cptr, idx_t *cind);
00059 graph_t *PruneGraph(ctrl_t *ctrl, idx_t nvtxs, idx_t *xadj, idx_t *adjncy, 
00060              idx_t *vwgt, idx_t *iperm, real_t factor);
00061 
00062 
00063 /* contig.c */
00064 idx_t FindPartitionInducedComponents(graph_t *graph, idx_t *where, 
00065           idx_t *cptr, idx_t *cind);
00066 void ComputeBFSOrdering(ctrl_t *ctrl, graph_t *graph, idx_t *bfsperm);
00067 idx_t IsConnected(graph_t *graph, idx_t report);
00068 idx_t IsConnectedSubdomain(ctrl_t *, graph_t *, idx_t, idx_t);
00069 idx_t FindSepInducedComponents(ctrl_t *, graph_t *, idx_t *, idx_t *);
00070 void EliminateComponents(ctrl_t *ctrl, graph_t *graph);
00071 void MoveGroupContigForCut(ctrl_t *ctrl, graph_t *graph, idx_t to, idx_t gid, 
00072          idx_t *ptr, idx_t *ind);
00073 void MoveGroupContigForVol(ctrl_t *ctrl, graph_t *graph, idx_t to, idx_t gid,
00074          idx_t *ptr, idx_t *ind, idx_t *vmarker, idx_t *pmarker,
00075          idx_t *modind);
00076 
00077 
00078 /* debug.c */
00079 idx_t ComputeCut(graph_t *graph, idx_t *where);
00080 idx_t ComputeVolume(graph_t *, idx_t *);
00081 idx_t ComputeMaxCut(graph_t *graph, idx_t nparts, idx_t *where);
00082 idx_t CheckBnd(graph_t *);
00083 idx_t CheckBnd2(graph_t *);
00084 idx_t CheckNodeBnd(graph_t *, idx_t);
00085 idx_t CheckRInfo(ctrl_t *ctrl, ckrinfo_t *rinfo);
00086 idx_t CheckNodePartitionParams(graph_t *);
00087 idx_t IsSeparable(graph_t *);
00088 void CheckKWayVolPartitionParams(ctrl_t *ctrl, graph_t *graph);
00089 
00090 
00091 /* fm.c */
00092 void FM_2WayRefine(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niter);
00093 void FM_2WayCutRefine(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niter);
00094 void FM_Mc2WayCutRefine(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niter);
00095 void SelectQueue(graph_t *graph, real_t *pijbm, real_t *ubfactors, rpq_t **queues, 
00096          idx_t *from, idx_t *cnum);
00097 void Print2WayRefineStats(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, 
00098          real_t deltabal, idx_t mincutorder);
00099 
00100 
00101 /* fortran.c */
00102 void Change2CNumbering(idx_t, idx_t *, idx_t *);
00103 void Change2FNumbering(idx_t, idx_t *, idx_t *, idx_t *);
00104 void Change2FNumbering2(idx_t, idx_t *, idx_t *);
00105 void Change2FNumberingOrder(idx_t, idx_t *, idx_t *, idx_t *, idx_t *);
00106 void ChangeMesh2CNumbering(idx_t n, idx_t *ptr, idx_t *ind);
00107 void ChangeMesh2FNumbering(idx_t n, idx_t *ptr, idx_t *ind, idx_t nvtxs,
00108          idx_t *xadj, idx_t *adjncy);
00109 void ChangeMesh2FNumbering2(idx_t ne, idx_t nn, idx_t *ptr, idx_t *ind,
00110          idx_t *epart, idx_t *npart);
00111 
00112 
00113 /* graph.c */
00114 graph_t *SetupGraph(ctrl_t *ctrl, idx_t nvtxs, idx_t ncon, idx_t *xadj, 
00115              idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt);
00116 void SetupGraph_tvwgt(graph_t *graph);
00117 void SetupGraph_label(graph_t *graph);
00118 graph_t *SetupSplitGraph(graph_t *graph, idx_t snvtxs, idx_t snedges);
00119 graph_t *CreateGraph(void);
00120 void InitGraph(graph_t *graph);
00121 void FreeRData(graph_t *graph);
00122 void FreeGraph(graph_t **graph);
00123 
00124 
00125 /* initpart.c */
00126 void Init2WayPartition(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niparts);
00127 void InitSeparator(ctrl_t *ctrl, graph_t *graph, idx_t niparts);
00128 void RandomBisection(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niparts);
00129 void GrowBisection(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niparts);
00130 void McRandomBisection(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niparts);
00131 void McGrowBisection(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niparts);
00132 void GrowBisectionNode(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niparts);
00133 void GrowBisectionNode2(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts, idx_t niparts);
00134 
00135 
00136 /* kmetis.c */
00137 idx_t MlevelKWayPartitioning(ctrl_t *ctrl, graph_t *graph, idx_t *part);
00138 void InitKWayPartitioning(ctrl_t *ctrl, graph_t *graph);
00139 
00140 
00141 /* kwayfm.c */
00142 void Greedy_KWayOptimize(ctrl_t *ctrl, graph_t *graph, idx_t niter, 
00143          real_t ffactor, idx_t omode);
00144 void Greedy_KWayCutOptimize(ctrl_t *ctrl, graph_t *graph, idx_t niter, 
00145          real_t ffactor, idx_t omode);
00146 void Greedy_KWayVolOptimize(ctrl_t *ctrl, graph_t *graph, idx_t niter, 
00147          real_t ffactor, idx_t omode);
00148 void Greedy_McKWayCutOptimize(ctrl_t *ctrl, graph_t *graph, idx_t niter, 
00149          real_t ffactor, idx_t omode);
00150 void Greedy_McKWayVolOptimize(ctrl_t *ctrl, graph_t *graph, idx_t niter, 
00151          real_t ffactor, idx_t omode);
00152 idx_t IsArticulationNode(idx_t i, idx_t *xadj, idx_t *adjncy, idx_t *where,
00153           idx_t *bfslvl, idx_t *bfsind, idx_t *bfsmrk);
00154 void KWayVolUpdate(ctrl_t *ctrl, graph_t *graph, idx_t v, idx_t from,
00155          idx_t to, ipq_t *queue, idx_t *vstatus, idx_t *r_nupd, idx_t *updptr,
00156          idx_t *updind, idx_t bndtype, idx_t *vmarker, idx_t *pmarker,
00157          idx_t *modind);
00158 
00159 
00160 /* kwayrefine.c */
00161 void RefineKWay(ctrl_t *ctrl, graph_t *orggraph, graph_t *graph);
00162 void AllocateKWayPartitionMemory(ctrl_t *ctrl, graph_t *graph);
00163 void ComputeKWayPartitionParams(ctrl_t *ctrl, graph_t *graph);
00164 void ProjectKWayPartition(ctrl_t *ctrl, graph_t *graph);
00165 void ComputeKWayBoundary(ctrl_t *ctrl, graph_t *graph, idx_t bndtype);
00166 void ComputeKWayVolGains(ctrl_t *ctrl, graph_t *graph);
00167 int IsBalanced(ctrl_t *ctrl, graph_t *graph, real_t ffactor);
00168 
00169 
00170 /* mcutil.c */
00171 int rvecle(idx_t n, real_t *x, real_t *y);
00172 int rvecge(idx_t n, real_t *x, real_t *y);
00173 int rvecsumle(idx_t n, real_t *x1, real_t *x2, real_t *y);
00174 real_t rvecmaxdiff(idx_t n, real_t *x, real_t *y);
00175 int ivecle(idx_t n, idx_t *x, idx_t *z);
00176 int ivecge(idx_t n, idx_t *x, idx_t *z);
00177 int ivecaxpylez(idx_t n, idx_t a, idx_t *x, idx_t *y, idx_t *z);
00178 int ivecaxpygez(idx_t n, idx_t a, idx_t *x, idx_t *y, idx_t *z);
00179 int BetterVBalance(idx_t ncon, real_t *itvwgt, idx_t *v_vwgt, idx_t *u1_vwgt,
00180             idx_t *u2_vwgt);
00181 int BetterBalance2Way(idx_t n, real_t *x, real_t *y);
00182 int BetterBalanceKWay(idx_t ncon, idx_t *vwgt, real_t *itvwgt, idx_t a1,
00183         idx_t *pt1, real_t *bm1, idx_t a2, idx_t *pt2, real_t *bm2);
00184 real_t ComputeLoadImbalance(graph_t *graph, idx_t nparts, real_t *pijbm);
00185 real_t ComputeLoadImbalanceDiff(graph_t *graph, idx_t nparts, real_t *pijbm, 
00186            real_t *ubvec);
00187 real_t ComputeLoadImbalanceDiffVec(graph_t *graph, idx_t nparts, real_t *pijbm, 
00188          real_t *ubfactors, real_t *diffvec);
00189 void ComputeLoadImbalanceVec(graph_t *graph, idx_t nparts, real_t *pijbm,
00190              real_t *lbvec);
00191 
00192 
00193 /* mesh.c */
00194 void CreateGraphDual(idx_t ne, idx_t nn, idx_t *eptr, idx_t *eind, idx_t ncommon,
00195           idx_t **r_xadj, idx_t **r_adjncy);
00196 void CreateGraphNodal(idx_t ne, idx_t nn, idx_t *eptr, idx_t *eind, idx_t **r_xadj, 
00197           idx_t **r_adjncy);
00198 idx_t FindCommonElements(idx_t qid, idx_t elen, idx_t *eind, idx_t *nptr,
00199           idx_t *nind, idx_t *eptr, idx_t ncommon, idx_t *marker, idx_t *nbrs);
00200 mesh_t *CreateMesh(void);
00201 void InitMesh(mesh_t *mesh);  
00202 void FreeMesh(mesh_t **mesh);
00203 
00204 
00205 /* meshpart.c */
00206 void InduceRowPartFromColumnPart(idx_t nrows, idx_t *rowptr, idx_t *rowind,
00207          idx_t *rpart, idx_t *cpart, idx_t nparts, real_t *tpwgts);
00208 
00209 
00210 /* minconn.c */
00211 void ComputeSubDomainGraph(ctrl_t *ctrl, graph_t *graph);
00212 void UpdateEdgeSubDomainGraph(ctrl_t *ctrl, idx_t u, idx_t v, idx_t ewgt, 
00213          idx_t *r_maxndoms);
00214 void PrintSubDomainGraph(graph_t *graph, idx_t nparts, idx_t *where);
00215 void EliminateSubDomainEdges(ctrl_t *ctrl, graph_t *graph);
00216 void MoveGroupMinConnForCut(ctrl_t *ctrl, graph_t *graph, idx_t to, idx_t nind, 
00217          idx_t *ind);
00218 void MoveGroupMinConnForVol(ctrl_t *ctrl, graph_t *graph, idx_t to, idx_t nind, 
00219          idx_t *ind, idx_t *vmarker, idx_t *pmarker, idx_t *modind);
00220 
00221 
00222 /* mincover.o */
00223 void MinCover(idx_t *, idx_t *, idx_t, idx_t, idx_t *, idx_t *);
00224 idx_t MinCover_Augment(idx_t *, idx_t *, idx_t, idx_t *, idx_t *, idx_t *, idx_t);
00225 void MinCover_Decompose(idx_t *, idx_t *, idx_t, idx_t, idx_t *, idx_t *, idx_t *);
00226 void MinCover_ColDFS(idx_t *, idx_t *, idx_t, idx_t *, idx_t *, idx_t);
00227 void MinCover_RowDFS(idx_t *, idx_t *, idx_t, idx_t *, idx_t *, idx_t);
00228 
00229 
00230 /* mmd.c */
00231 void genmmd(idx_t, idx_t *, idx_t *, idx_t *, idx_t *, idx_t , idx_t *, idx_t *, idx_t *, idx_t *, idx_t, idx_t *);
00232 void mmdelm(idx_t, idx_t *xadj, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t, idx_t);
00233 idx_t mmdint(idx_t, idx_t *xadj, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *);
00234 void mmdnum(idx_t, idx_t *, idx_t *, idx_t *);
00235 void mmdupd(idx_t, idx_t, idx_t *, idx_t *, idx_t, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t *, idx_t, idx_t *tag);
00236 
00237 
00238 /* ometis.c */
00239 void MlevelNestedDissection(ctrl_t *ctrl, graph_t *graph, idx_t *order,
00240          idx_t lastvtx);
00241 void MlevelNestedDissectionCC(ctrl_t *ctrl, graph_t *graph, idx_t *order,
00242          idx_t lastvtx);
00243 void MlevelNodeBisectionMultiple(ctrl_t *ctrl, graph_t *graph);
00244 void MlevelNodeBisectionL2(ctrl_t *ctrl, graph_t *graph, idx_t niparts);
00245 void MlevelNodeBisectionL1(ctrl_t *ctrl, graph_t *graph, idx_t niparts);
00246 void SplitGraphOrder(ctrl_t *ctrl, graph_t *graph, graph_t **r_lgraph, 
00247          graph_t **r_rgraph);
00248 graph_t **SplitGraphOrderCC(ctrl_t *ctrl, graph_t *graph, idx_t ncmps,
00249               idx_t *cptr, idx_t *cind);
00250 void MMDOrder(ctrl_t *ctrl, graph_t *graph, idx_t *order, idx_t lastvtx);
00251 
00252 
00253 /* options.c */
00254 ctrl_t *SetupCtrl(moptype_et optype, idx_t *options, idx_t ncon, idx_t nparts, 
00255             real_t *tpwgts, real_t *ubvec);
00256 void SetupKWayBalMultipliers(ctrl_t *ctrl, graph_t *graph);
00257 void Setup2WayBalMultipliers(ctrl_t *ctrl, graph_t *graph, real_t *tpwgts);
00258 void PrintCtrl(ctrl_t *ctrl);
00259 int CheckParams(ctrl_t *ctrl);
00260 void FreeCtrl(ctrl_t **r_ctrl);
00261 
00262 
00263 /* parmetis.c */
00264 void MlevelNestedDissectionP(ctrl_t *ctrl, graph_t *graph, idx_t *order,
00265          idx_t lastvtx, idx_t npes, idx_t cpos, idx_t *sizes);
00266 void FM_2WayNodeRefine1SidedP(ctrl_t *ctrl, graph_t *graph, idx_t *hmarker, 
00267          real_t ubfactor, idx_t npasses);
00268 void FM_2WayNodeRefine2SidedP(ctrl_t *ctrl, graph_t *graph, idx_t *hmarker, 
00269          real_t ubfactor, idx_t npasses);
00270 
00271 
00272 /* pmetis.c */
00273 idx_t MlevelRecursiveBisection(ctrl_t *ctrl, graph_t *graph, idx_t nparts, 
00274           idx_t *part, real_t *tpwgts, idx_t fpart);
00275 idx_t MultilevelBisect(ctrl_t *ctrl, graph_t *graph, real_t *tpwgts);
00276 void SplitGraphPart(ctrl_t *ctrl, graph_t *graph, graph_t **r_lgraph, graph_t **r_rgraph);
00277 
00278 
00279 /* refine.c */
00280 void Refine2Way(ctrl_t *ctrl, graph_t *orggraph, graph_t *graph, real_t *rtpwgts);
00281 void Allocate2WayPartitionMemory(ctrl_t *ctrl, graph_t *graph);
00282 void Compute2WayPartitionParams(ctrl_t *ctrl, graph_t *graph);
00283 void Project2WayPartition(ctrl_t *ctrl, graph_t *graph);
00284 
00285 
00286 /* separator.c */
00287 void ConstructSeparator(ctrl_t *ctrl, graph_t *graph);
00288 void ConstructMinCoverSeparator(ctrl_t *ctrl, graph_t *graph);
00289 
00290 
00291 /* sfm.c */
00292 void FM_2WayNodeRefine2Sided(ctrl_t *ctrl, graph_t *graph, idx_t niter);
00293 void FM_2WayNodeRefine1Sided(ctrl_t *ctrl, graph_t *graph, idx_t niter);
00294 void FM_2WayNodeBalance(ctrl_t *ctrl, graph_t *graph);
00295 
00296 
00297 /* srefine.c */
00298 void Refine2WayNode(ctrl_t *ctrl, graph_t *orggraph, graph_t *graph);
00299 void Allocate2WayNodePartitionMemory(ctrl_t *ctrl, graph_t *graph);
00300 void Compute2WayNodePartitionParams(ctrl_t *ctrl, graph_t *graph);
00301 void Project2WayNodePartition(ctrl_t *ctrl, graph_t *graph);
00302 
00303 
00304 /* stat.c */
00305 void ComputePartitionInfoBipartite(graph_t *, idx_t, idx_t *);
00306 void ComputePartitionBalance(graph_t *, idx_t, idx_t *, real_t *);
00307 real_t ComputeElementBalance(idx_t, idx_t, idx_t *);
00308 
00309 
00310 /* timing.c */
00311 void InitTimers(ctrl_t *);
00312 void PrintTimers(ctrl_t *);
00313 
00314 /* util.c */
00315 idx_t iargmax_strd(size_t, idx_t *, idx_t);
00316 idx_t iargmax_nrm(size_t n, idx_t *x, real_t *y);
00317 idx_t iargmax2_nrm(size_t n, idx_t *x, real_t *y);
00318 idx_t rargmax2(size_t, real_t *);
00319 void InitRandom(idx_t);
00320 int metis_rcode(int sigrval);
00321 
00322 
00323 
00324 /* wspace.c */
00325 void AllocateWorkSpace(ctrl_t *ctrl, graph_t *graph);
00326 void AllocateRefinementWorkSpace(ctrl_t *ctrl, idx_t nbrpoolsize);
00327 void FreeWorkSpace(ctrl_t *ctrl);
00328 void *wspacemalloc(ctrl_t *ctrl, size_t nbytes);
00329 void wspacepush(ctrl_t *ctrl);
00330 void wspacepop(ctrl_t *ctrl);
00331 idx_t *iwspacemalloc(ctrl_t *, idx_t);
00332 real_t *rwspacemalloc(ctrl_t *, idx_t);
00333 ikv_t *ikvwspacemalloc(ctrl_t *, idx_t);
00334 void cnbrpoolReset(ctrl_t *ctrl);
00335 idx_t cnbrpoolGetNext(ctrl_t *ctrl, idx_t nnbrs);
00336 void vnbrpoolReset(ctrl_t *ctrl);
00337 idx_t vnbrpoolGetNext(ctrl_t *ctrl, idx_t nnbrs);
00338 
00339 
00340 #endif
 All Classes Files Functions Variables Typedefs Friends Defines