77
77
/************************************/
79
/*+ This routine parses the given
80
*** mesh ordering strategy.
82
*** - 0 : if string successfully scanned.
87
SCOTCH_stratMeshOrder (
88
SCOTCH_Strat * const stratptr,
89
const char * const string)
91
if (*((Strat **) stratptr) != NULL)
92
stratExit (*((Strat **) stratptr));
94
if ((*((Strat **) stratptr) = stratInit (&hmeshorderststratab, string)) == NULL) {
95
errorPrint ("SCOTCH_stratMeshOrder: error in ordering strategy");
102
79
/*+ This routine initializes an API ordering
103
80
*** with respect to the given source graph
104
81
*** and the locations of output parameters.
213
190
SCOTCH_meshOrderCompute (
214
const SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
191
SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
215
192
SCOTCH_Ordering * const ordeptr, /*+ Ordering to compute +*/
216
193
SCOTCH_Strat * const stratptr) /*+ Ordering strategy +*/
231
208
SCOTCH_meshOrderComputeList (
232
const SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
209
SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
233
210
SCOTCH_Ordering * const ordeptr, /*+ Ordering to compute +*/
234
211
const SCOTCH_Num listnbr, /*+ Number of vertices in list +*/
235
212
const SCOTCH_Num * const listtab, /*+ List of vertex indices to order +*/
242
219
VertList * srclistptr; /* Pointer to subgraph vertex list */
243
220
const Strat * ordstratptr; /* Pointer to ordering strategy */
222
srcmeshptr = (Mesh *) meshptr;
224
#ifdef SCOTCH_DEBUG_MESH2
225
if (meshCheck (srcmeshptr) != 0) {
226
errorPrint ("SCOTCH_meshOrderComputeList: invalid input mesh");
229
#endif /* SCOTCH_DEBUG_MESH2 */
245
231
if (*((Strat **) stratptr) == NULL) /* Set default ordering strategy if necessary */
246
*((Strat **) stratptr) = stratInit (&hmeshorderststratab, "c{rat=0.7,cpr=n{sep=/(vnod>120)?m{vnod=100,low=h{pass=10},asc=f{bal=0.1}}:;,ole=v{strat=d{cmin=0,cmax=10000000,frat=0}},ose=g},unc=n{sep=/(vnod>120)?m{vnod=100,low=h{pass=10},asc=f{bal=0.1}}:;,ole=v{strat=d{cmin=0,cmax=10000000,frat=0}},ose=g}}");
232
SCOTCH_stratMeshOrderBuild (stratptr, SCOTCH_STRATQUALITY, 0.1);
247
234
ordstratptr = *((Strat **) stratptr);
248
235
if (ordstratptr->tabl != &hmeshorderststratab) {
249
236
errorPrint ("SCOTCH_meshOrderComputeList: not a mesh ordering strategy");
253
srcmeshptr = (Mesh *) meshptr;
254
240
memCpy (&srcmeshdat.m, srcmeshptr, sizeof (Mesh)); /* Copy non-halo mesh data */
255
241
srcmeshdat.m.flagval &= ~MESHFREETABS; /* Do not allow to free arrays */
256
242
srcmeshdat.vehdtax = srcmeshdat.m.vendtax; /* End of non-halo vertices */
304
290
SCOTCH_meshOrder (
305
const SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
291
SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
306
292
SCOTCH_Strat * const stratptr, /*+ Ordering strategy +*/
307
293
SCOTCH_Num * const permtab, /*+ Ordering permutation +*/
308
294
SCOTCH_Num * const peritab, /*+ Inverse permutation array +*/
334
320
SCOTCH_meshOrderList (
335
const SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
321
SCOTCH_Mesh * const meshptr, /*+ Mesh to order +*/
336
322
const SCOTCH_Num listnbr, /*+ Number of vertices in list +*/
337
323
const SCOTCH_Num * const listtab, /*+ List of vertex indices to order +*/
338
324
SCOTCH_Strat * const stratptr, /*+ Ordering strategy +*/
367
353
return (orderCheck (&((LibOrder *) ordeptr)->o));
356
/*+ This routine parses the given
357
*** mesh ordering strategy.
359
*** - 0 : if string successfully scanned.
364
SCOTCH_stratMeshOrder (
365
SCOTCH_Strat * const stratptr,
366
const char * const string)
368
if (*((Strat **) stratptr) != NULL)
369
stratExit (*((Strat **) stratptr));
371
if ((*((Strat **) stratptr) = stratInit (&hmeshorderststratab, string)) == NULL) {
372
errorPrint ("SCOTCH_stratMeshOrder: error in ordering strategy");
379
/*+ This routine provides predefined
380
*** ordering strategies.
382
*** - 0 : if string successfully initialized.
387
SCOTCH_stratMeshOrderBuild (
388
SCOTCH_Strat * const stratptr, /*+ Strategy to create +*/
389
const SCOTCH_Num flagval, /*+ Desired characteristics +*/
390
const double balrat) /*+ Desired imbalance ratio +*/
392
char bufftab[8192]; /* Should be enough */
395
strcpy (bufftab, "c{rat=0.7,cpr=n{sep=/(vnod>120)?m{vnod=100,low=h{pass=10},asc=f{bal=<BBAL>}}:;,ole=v{strat=d{cmin=0,cmax=10000000,frat=0}},ose=g},unc=n{sep=/(vnod>120)?m{vnod=100,low=h{pass=10},asc=f{bal=<BBAL>}}:;,ole=v{strat=d{cmin=0,cmax=10000000,frat=0}},ose=g}}");
397
sprintf (bbaltab, "%lf", balrat);
398
stringSubst (bufftab, "<BBAL>", bbaltab);
400
if (SCOTCH_stratMeshOrder (stratptr, bufftab) != 0) {
401
errorPrint ("SCOTCH_stratMeshOrderBuild: error in sequential ordering strategy");