| 1 |
/* |
| 2 |
* Copyright 1997, Regents of the University of Minnesota |
| 3 |
* |
| 4 |
* macros.h |
| 5 |
* |
| 6 |
* This file contains macros used in multilevel |
| 7 |
* |
| 8 |
* Started 9/25/94 |
| 9 |
* George |
| 10 |
* |
| 11 |
* $Id: macros.h 10060 2011-06-02 18:56:30Z karypis $ |
| 12 |
* |
| 13 |
*/ |
| 14 |
|
| 15 |
#ifndef _LIBMETIS_MACROS_H_ |
| 16 |
#define _LIBMETIS_MACROS_H_ |
| 17 |
|
| 18 |
#define SWAP gk_SWAP |
| 19 |
|
| 20 |
/* gets the appropriate option value */ |
| 21 |
#define GETOPTION(options, idx, defval) \ |
| 22 |
((options) == NULL || (options)[idx] == -1 ? defval : (options)[idx]) |
| 23 |
|
| 24 |
/* converts a user provided ufactor into a real ubfactor */ |
| 25 |
#define I2RUBFACTOR(ufactor) (1.0+0.001*(ufactor)) |
| 26 |
|
| 27 |
/* set/reset the current workspace core */ |
| 28 |
#define WCOREPUSH wspacepush(ctrl) |
| 29 |
#define WCOREPOP wspacepop(ctrl) |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
/************************************************************************* |
| 34 |
* These macros insert and remove nodes from a Direct Access list |
| 35 |
**************************************************************************/ |
| 36 |
#define ListInsert(n, lind, lptr, i) \ |
| 37 |
do { \ |
| 38 |
lind[n] = i; \ |
| 39 |
lptr[i] = (n)++;\ |
| 40 |
} while(0) |
| 41 |
|
| 42 |
#define ListDelete(n, lind, lptr, i) \ |
| 43 |
do { \ |
| 44 |
lind[lptr[i]] = lind[--(n)]; \ |
| 45 |
lptr[lind[n]] = lptr[i]; \ |
| 46 |
lptr[i] = -1; \ |
| 47 |
} while(0) |
| 48 |
|
| 49 |
|
| 50 |
/************************************************************************* |
| 51 |
* These macros insert and remove nodes from the boundary list |
| 52 |
**************************************************************************/ |
| 53 |
#define BNDInsert(nbnd, bndind, bndptr, vtx) \ |
| 54 |
ListInsert(nbnd, bndind, bndptr, vtx) |
| 55 |
|
| 56 |
#define BNDDelete(nbnd, bndind, bndptr, vtx) \ |
| 57 |
ListDelete(nbnd, bndind, bndptr, vtx) |
| 58 |
|
| 59 |
#endif |