00001
00014 #ifndef _METIS_H_
00015 #define _METIS_H_
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #define IDXTYPEWIDTH 32
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define REALTYPEWIDTH 32
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #if defined(_MSC_VER)
00058 #define COMPILER_MSC
00059 #endif
00060 #if defined(__ICC)
00061 #define COMPILER_ICC
00062 #endif
00063 #if defined(__GNUC__)
00064 #define COMPILER_GCC
00065 #endif
00066
00067
00068
00069 #ifndef _GKLIB_H_
00070 #ifdef COMPILER_MSC
00071 #include <limits.h>
00072
00073 typedef __int32 int32_t;
00074 typedef __int64 int64_t;
00075 #define PRId32 "I32d"
00076 #define PRId64 "I64d"
00077 #define SCNd32 "ld"
00078 #define SCNd64 "I64d"
00079 #define INT32_MIN ((int32_t)_I32_MIN)
00080 #define INT32_MAX _I32_MAX
00081 #define INT64_MIN ((int64_t)_I64_MIN)
00082 #define INT64_MAX _I64_MAX
00083 #else
00084 #include <inttypes.h>
00085 #endif
00086 #endif
00087
00088
00089
00090
00091
00092 #if IDXTYPEWIDTH == 32
00093 typedef int32_t idx_t;
00094
00095 #define IDX_MAX INT32_MAX
00096 #define IDX_MIN INT32_MIN
00097
00098 #define SCIDX SCNd32
00099 #define PRIDX PRId32
00100
00101 #define strtoidx strtol
00102 #define iabs abs
00103 #elif IDXTYPEWIDTH == 64
00104 typedef int64_t idx_t;
00105
00106 #define IDX_MAX INT64_MAX
00107 #define IDX_MIN INT64_MIN
00108
00109 #define SCIDX SCNd64
00110 #define PRIDX PRId64
00111
00112 #ifdef COMPILER_MSC
00113 #define strtoidx _strtoi64
00114 #else
00115 #define strtoidx strtoll
00116 #endif
00117 #define iabs labs
00118 #else
00119 #error "Incorrect user-supplied value fo IDXTYPEWIDTH"
00120 #endif
00121
00122
00123 #if REALTYPEWIDTH == 32
00124 typedef float real_t;
00125
00126 #define SCREAL "f"
00127 #define PRREAL "f"
00128 #define REAL_MAX FLT_MAX
00129 #define REAL_MIN FLT_MIN
00130 #define REAL_EPSILON FLT_EPSILON
00131
00132 #define rabs fabsf
00133 #define REALEQ(x,y) ((rabs((x)-(y)) <= FLT_EPSILON))
00134
00135 #ifdef COMPILER_MSC
00136 #define strtoreal (float)strtod
00137 #else
00138 #define strtoreal strtof
00139 #endif
00140 #elif REALTYPEWIDTH == 64
00141 typedef double real_t;
00142
00143 #define SCREAL "lf"
00144 #define PRREAL "lf"
00145 #define REAL_MAX DBL_MAX
00146 #define REAL_MIN DBL_MIN
00147 #define REAL_EPSILON DBL_EPSILON
00148
00149 #define rabs fabs
00150 #define REALEQ(x,y) ((rabs((x)-(y)) <= DBL_EPSILON))
00151
00152 #define strtoreal strtod
00153 #else
00154 #error "Incorrect user-supplied value for REALTYPEWIDTH"
00155 #endif
00156
00157
00158
00159
00160
00161
00162 #define METIS_VER_MAJOR 5
00163 #define METIS_VER_MINOR 1
00164 #define METIS_VER_SUBMINOR 0
00165
00166
00167 #define METIS_NOPTIONS 40
00168
00169
00170
00171
00172
00173
00174
00175 #ifdef _WINDLL
00176 #define METIS_API(type) __declspec(dllexport) type __cdecl
00177 #elif defined(__cdecl)
00178 #define METIS_API(type) type __cdecl
00179 #else
00180 #define METIS_API(type) type
00181 #endif
00182
00183
00184
00185 #ifdef __cplusplus
00186 extern "C" {
00187 #endif
00188
00189 METIS_API(int) METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,
00190 idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,
00191 idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,
00192 idx_t *edgecut, idx_t *part);
00193
00194 METIS_API(int) METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,
00195 idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,
00196 idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,
00197 idx_t *edgecut, idx_t *part);
00198
00199 METIS_API(int) METIS_MeshToDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
00200 idx_t *ncommon, idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);
00201
00202 METIS_API(int) METIS_MeshToNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
00203 idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);
00204
00205 METIS_API(int) METIS_PartMeshNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
00206 idx_t *vwgt, idx_t *vsize, idx_t *nparts, real_t *tpwgts,
00207 idx_t *options, idx_t *objval, idx_t *epart, idx_t *npart);
00208
00209 METIS_API(int) METIS_PartMeshDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
00210 idx_t *vwgt, idx_t *vsize, idx_t *ncommon, idx_t *nparts,
00211 real_t *tpwgts, idx_t *options, idx_t *objval, idx_t *epart,
00212 idx_t *npart);
00213
00214 METIS_API(int) METIS_NodeND(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
00215 idx_t *options, idx_t *perm, idx_t *iperm);
00216
00217 METIS_API(int) METIS_Free(void *ptr);
00218
00219 METIS_API(int) METIS_SetDefaultOptions(idx_t *options);
00220
00221
00222
00223
00224 METIS_API(int) METIS_NodeNDP(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
00225 idx_t npes, idx_t *options, idx_t *perm, idx_t *iperm,
00226 idx_t *sizes);
00227
00228 METIS_API(int) METIS_ComputeVertexSeparator(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy,
00229 idx_t *vwgt, idx_t *options, idx_t *sepsize, idx_t *part);
00230
00231 METIS_API(int) METIS_NodeRefine(idx_t nvtxs, idx_t *xadj, idx_t *vwgt, idx_t *adjncy,
00232 idx_t *where, idx_t *hmarker, real_t ubfactor);
00233
00234
00235 #ifdef __cplusplus
00236 }
00237 #endif
00238
00239
00240
00241
00242
00243
00245 typedef enum {
00246 METIS_OK = 1,
00247 METIS_ERROR_INPUT = -2,
00248 METIS_ERROR_MEMORY = -3,
00249 METIS_ERROR = -4
00250 } rstatus_et;
00251
00252
00254 typedef enum {
00255 METIS_OP_PMETIS,
00256 METIS_OP_KMETIS,
00257 METIS_OP_OMETIS
00258 } moptype_et;
00259
00260
00262 typedef enum {
00263 METIS_OPTION_PTYPE,
00264 METIS_OPTION_OBJTYPE,
00265 METIS_OPTION_CTYPE,
00266 METIS_OPTION_IPTYPE,
00267 METIS_OPTION_RTYPE,
00268 METIS_OPTION_DBGLVL,
00269 METIS_OPTION_NITER,
00270 METIS_OPTION_NCUTS,
00271 METIS_OPTION_SEED,
00272 METIS_OPTION_NO2HOP,
00273 METIS_OPTION_MINCONN,
00274 METIS_OPTION_CONTIG,
00275 METIS_OPTION_COMPRESS,
00276 METIS_OPTION_CCORDER,
00277 METIS_OPTION_PFACTOR,
00278 METIS_OPTION_NSEPS,
00279 METIS_OPTION_UFACTOR,
00280 METIS_OPTION_NUMBERING,
00281
00282
00283 METIS_OPTION_HELP,
00284 METIS_OPTION_TPWGTS,
00285 METIS_OPTION_NCOMMON,
00286 METIS_OPTION_NOOUTPUT,
00287 METIS_OPTION_BALANCE,
00288 METIS_OPTION_GTYPE,
00289 METIS_OPTION_UBVEC
00290 } moptions_et;
00291
00292
00294 typedef enum {
00295 METIS_PTYPE_RB,
00296 METIS_PTYPE_KWAY
00297 } mptype_et;
00298
00300 typedef enum {
00301 METIS_GTYPE_DUAL,
00302 METIS_GTYPE_NODAL
00303 } mgtype_et;
00304
00306 typedef enum {
00307 METIS_CTYPE_RM,
00308 METIS_CTYPE_SHEM
00309 } mctype_et;
00310
00312 typedef enum {
00313 METIS_IPTYPE_GROW,
00314 METIS_IPTYPE_RANDOM,
00315 METIS_IPTYPE_EDGE,
00316 METIS_IPTYPE_NODE,
00317 METIS_IPTYPE_METISRB
00318 } miptype_et;
00319
00320
00322 typedef enum {
00323 METIS_RTYPE_FM,
00324 METIS_RTYPE_GREEDY,
00325 METIS_RTYPE_SEP2SIDED,
00326 METIS_RTYPE_SEP1SIDED
00327 } mrtype_et;
00328
00329
00331 typedef enum {
00332 METIS_DBG_INFO = 1,
00333 METIS_DBG_TIME = 2,
00334 METIS_DBG_COARSEN = 4,
00335 METIS_DBG_REFINE = 8,
00336 METIS_DBG_IPART = 16,
00337 METIS_DBG_MOVEINFO = 32,
00338 METIS_DBG_SEPINFO = 64,
00339 METIS_DBG_CONNINFO = 128,
00340 METIS_DBG_CONTIGINFO = 256,
00341 METIS_DBG_MEMORY = 2048,
00342 } mdbglvl_et;
00343
00344
00345
00346 typedef enum {
00347 METIS_OBJTYPE_CUT,
00348 METIS_OBJTYPE_VOL,
00349 METIS_OBJTYPE_NODE
00350 } mobjtype_et;
00351
00352
00353
00354 #endif