MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / partitionGraph

Method partitionGraph

SRC/graph/partitioner/MetisWrapper.cpp:348–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348int
349Metis::partitionGraph(int *nvtxs, int *xadj, int *adjncy, int *vwgt,
350 int *adjwgt, int *wgtflag, int *numflag, int *nparts,
351 int *options, int *edgecut, int *part, bool whichToUse)
352{
353 // which to use -> if true use edge cut partitioning, else uses communication
354 // based partition, standard applications, uniformly mesh regions need use the edge-cut
355 // first one works fine second is weird
356 if (whichToUse) {
357#ifdef _USE_METIS_5p1
358 opserr << "METIS_PartGraphRecursive not implemented for METIS 5.1\n";
359 return -1;
360#else
361 METIS_PartGraphRecursive(nvtxs, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, nparts, options, edgecut, part);
362#endif
363 }
364 else {
365
366#ifdef _USE_METIS_5p1
367 int ncon = 1;
368 idx_t * null_vsize = NULL;
369 idx_t * null_adjwgt = NULL;
370 real_t * null_tpwgts = NULL;
371 real_t * null_ubvec = NULL;
372 int errorflag = METIS_PartGraphKway( nvtxs, &ncon, xadj, adjncy, vwgt, null_vsize, null_adjwgt, nparts, null_tpwgts, null_ubvec, NULL, edgecut, part);
373
374 if(errorflag != METIS_OK)
375 {
376 opserr << "METIS_PartGraphKway failed with flag: " << errorflag << endln;
377 if(errorflag == METIS_ERROR_INPUT) opserr << "Indicates an input error." << endln;
378 else if(errorflag == METIS_ERROR_MEMORY) opserr << "Indicates that it could not allocate the required memory." << endln;
379 else if(errorflag == METIS_ERROR) opserr << "Indicates some other type of error." << endln;
380 return -1;
381 }
382#else
383 METIS_PartGraphKway(nvtxs, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, nparts, options, edgecut, part);
384#endif
385 }
386 return 0;
387}
388
389
390

Callers

nothing calls this directly

Calls 2

METIS_PartGraphRecursiveFunction · 0.85
METIS_PartGraphKwayFunction · 0.85

Tested by

no test coverage detected