hp2FEM  0.1
include/metis.h
00001 
00010 #ifndef _METIS_H_
00011 #define _METIS_H_ 
00012 
00013 /****************************************************************************
00014 * A set of defines that can be modified by the user
00015 *****************************************************************************/
00016 
00017 /*--------------------------------------------------------------------------
00018  Specifies the width of the elementary data type that will hold information
00019  about vertices and their adjacency lists.
00020 
00021  Possible values:
00022    32 : Use 32 bit signed integers
00023    64 : Use 64 bit signed integers
00024 
00025  A width of 64 should be specified if the number of vertices or the total
00026  number of edges in the graph exceed the limits of a 32 bit signed integer
00027  i.e., 2^31-1.
00028  Proper use of 64 bit integers requires that the c99 standard datatypes
00029  int32_t and int64_t are supported by the compiler.
00030  GCC does provides these definitions in stdint.h, but it may require some
00031  modifications on other architectures.
00032 --------------------------------------------------------------------------*/
00033 #define IDXTYPEWIDTH 32
00034 
00035 
00036 /*--------------------------------------------------------------------------
00037  Specifies the data type that will hold floating-point style information.
00038 
00039  Possible values:
00040    32 : single precission floating point (float)
00041    64 : double precission floating point (double)
00042 --------------------------------------------------------------------------*/
00043 #define REALTYPEWIDTH 32
00044 
00045 
00046 
00047 /****************************************************************************
00048 * In principle, nothing needs to be changed beyond this point, unless the
00049 * int32_t and int64_t cannot be found in the normal places.
00050 *****************************************************************************/
00051 
00052 /* Uniform definitions for various compilers */
00053 #if defined(_MSC_VER)
00054   #define COMPILER_MSC
00055 #endif
00056 #if defined(__ICC)
00057   #define COMPILER_ICC
00058 #endif
00059 #if defined(__GNUC__)
00060   #define COMPILER_GCC
00061 #endif
00062 
00063 /* Include c99 int definitions and need constants. When building the library,
00064  * these are already defined by GKlib; hence the test for _GKLIB_H_ */
00065 #ifndef _GKLIB_H_
00066 #ifdef COMPILER_MSC
00067 #include <limits.h>
00068 
00069 typedef __int32 int32_t;
00070 typedef __int64 int64_t;
00071 #define PRId32       "I32d"
00072 #define PRId64       "I64d"
00073 #define SCNd32       "ld"
00074 #define SCNd64       "I64d"
00075 #define INT32_MIN    ((int32_t)_I32_MIN)
00076 #define INT32_MAX    _I32_MAX
00077 #define INT64_MIN    ((int64_t)_I64_MIN)
00078 #define INT64_MAX    _I64_MAX
00079 #else
00080 #include <inttypes.h>
00081 #endif
00082 #endif
00083 
00084 
00085 /*------------------------------------------------------------------------
00086 * Setup the basic datatypes
00087 *-------------------------------------------------------------------------*/
00088 #if IDXTYPEWIDTH == 32
00089   typedef int32_t idx_t;
00090 
00091   #define IDX_MAX   INT32_MAX
00092   #define IDX_MIN   INT32_MIN
00093 
00094   #define SCIDX  SCNd32
00095   #define PRIDX  PRId32
00096 
00097   #define strtoidx      strtol
00098   #define iabs          abs
00099 #elif IDXTYPEWIDTH == 64
00100   typedef int64_t idx_t;
00101 
00102   #define IDX_MAX   INT64_MAX
00103   #define IDX_MIN   INT64_MIN
00104 
00105   #define SCIDX  SCNd64
00106   #define PRIDX  PRId64
00107 
00108 #ifdef COMPILER_MSC
00109   #define strtoidx      _strtoi64
00110 #else
00111   #define strtoidx      strtoll
00112 #endif
00113   #define iabs          labs
00114 #else
00115   #error "Incorrect user-supplied value fo IDXTYPEWIDTH"
00116 #endif
00117 
00118 
00119 #if REALTYPEWIDTH == 32
00120   typedef float real_t;
00121 
00122   #define SCREAL         "f"
00123   #define PRREAL         "f"
00124   #define REAL_MAX       FLT_MAX
00125   #define REAL_MIN       FLT_MIN
00126   #define REAL_EPSILON   FLT_EPSILON
00127 
00128   #define rabs          fabsf
00129   #define REALEQ(x,y) ((rabs((x)-(y)) <= FLT_EPSILON))
00130 
00131 #ifdef COMPILER_MSC
00132   #define strtoreal     (float)strtod
00133 #else
00134   #define strtoreal     strtof
00135 #endif
00136 #elif REALTYPEWIDTH == 64
00137   typedef double real_t;
00138 
00139   #define SCREAL         "lf"
00140   #define PRREAL         "lf"
00141   #define REAL_MAX       DBL_MAX
00142   #define REAL_MIN       DBL_MIN
00143   #define REAL_EPSILON   DBL_EPSILON
00144 
00145   #define rabs          fabs
00146   #define REALEQ(x,y) ((rabs((x)-(y)) <= DBL_EPSILON))
00147 
00148   #define strtoreal     strtod
00149 #else
00150   #error "Incorrect user-supplied value for REALTYPEWIDTH"
00151 #endif
00152 
00153 
00154 /*------------------------------------------------------------------------
00155 * Constant definitions 
00156 *-------------------------------------------------------------------------*/
00157 /* Metis's version number */
00158 #define METIS_VER_MAJOR         5
00159 #define METIS_VER_MINOR         0
00160 #define METIS_VER_SUBMINOR      2
00161 
00162 /* The maximum length of the options[] array */
00163 #define METIS_NOPTIONS          40
00164 
00165 
00166 
00167 /*------------------------------------------------------------------------
00168 * Function prototypes 
00169 *-------------------------------------------------------------------------*/
00170 
00171 #ifdef _WINDLL
00172 #define METIS_API(type) __declspec(dllexport) type __cdecl
00173 #elif defined(__cdecl)
00174 #define METIS_API(type) type __cdecl
00175 #else
00176 #define METIS_API(type) type
00177 #endif
00178 
00179 
00180 
00181 #ifdef __cplusplus
00182 extern "C" {
00183 #endif
00184 
00185 METIS_API(int) METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, 
00186                   idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, 
00187                   idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, 
00188                   idx_t *edgecut, idx_t *part);
00189 
00190 METIS_API(int) METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, 
00191                   idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, 
00192                   idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, 
00193                   idx_t *edgecut, idx_t *part);
00194 
00195 METIS_API(int) METIS_MeshToDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, 
00196                   idx_t *ncommon, idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);
00197 
00198 METIS_API(int) METIS_MeshToNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, 
00199                   idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);
00200 
00201 METIS_API(int) METIS_PartMeshNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
00202                   idx_t *vwgt, idx_t *vsize, idx_t *nparts, real_t *tpwgts, 
00203                   idx_t *options, idx_t *objval, idx_t *epart, idx_t *npart);
00204 
00205 METIS_API(int) METIS_PartMeshDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
00206                   idx_t *vwgt, idx_t *vsize, idx_t *ncommon, idx_t *nparts, 
00207                   real_t *tpwgts, idx_t *options, idx_t *objval, idx_t *epart, 
00208                   idx_t *npart);
00209 
00210 METIS_API(int) METIS_NodeND(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
00211                   idx_t *options, idx_t *perm, idx_t *iperm);
00212 
00213 METIS_API(int) METIS_Free(void *ptr);
00214 
00215 METIS_API(int) METIS_SetDefaultOptions(idx_t *options);
00216 
00217 
00218 /* These functions are used by ParMETIS */
00219 
00220 METIS_API(int) METIS_NodeNDP(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
00221                    idx_t npes, idx_t *options, idx_t *perm, idx_t *iperm, 
00222                    idx_t *sizes);
00223 
00224 METIS_API(int) METIS_ComputeVertexSeparator(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, 
00225                    idx_t *vwgt, idx_t *options, idx_t *sepsize, idx_t *part);
00226 
00227 METIS_API(int) METIS_NodeRefine(idx_t nvtxs, idx_t *xadj, idx_t *vwgt, idx_t *adjncy,
00228                    idx_t *where, idx_t *hmarker, real_t ubfactor);
00229 
00230 
00231 #ifdef __cplusplus
00232 }
00233 #endif
00234 
00235 
00236 
00237 /*------------------------------------------------------------------------
00238 * Enum type definitions 
00239 *-------------------------------------------------------------------------*/
00241 typedef enum {
00242   METIS_OK              = 1,    
00243   METIS_ERROR_INPUT     = -2,   
00244   METIS_ERROR_MEMORY    = -3,   
00245   METIS_ERROR           = -4    
00246 } rstatus_et; 
00247 
00248 
00250 typedef enum {
00251   METIS_OP_PMETIS,       
00252   METIS_OP_KMETIS,
00253   METIS_OP_OMETIS
00254 } moptype_et;
00255 
00256 
00258 typedef enum {
00259   METIS_OPTION_PTYPE,
00260   METIS_OPTION_OBJTYPE,
00261   METIS_OPTION_CTYPE,
00262   METIS_OPTION_IPTYPE,
00263   METIS_OPTION_RTYPE,
00264   METIS_OPTION_DBGLVL,
00265   METIS_OPTION_NITER,
00266   METIS_OPTION_NCUTS,
00267   METIS_OPTION_SEED,
00268   METIS_OPTION_MINCONN,
00269   METIS_OPTION_CONTIG,
00270   METIS_OPTION_COMPRESS,
00271   METIS_OPTION_CCORDER,
00272   METIS_OPTION_PFACTOR,
00273   METIS_OPTION_NSEPS,
00274   METIS_OPTION_UFACTOR,
00275   METIS_OPTION_NUMBERING,
00276 
00277   /* Used for command-line parameter purposes */
00278   METIS_OPTION_HELP,
00279   METIS_OPTION_TPWGTS,
00280   METIS_OPTION_NCOMMON,
00281   METIS_OPTION_NOOUTPUT,
00282   METIS_OPTION_BALANCE,
00283   METIS_OPTION_GTYPE,
00284   METIS_OPTION_UBVEC
00285 } moptions_et;
00286 
00287 
00289 typedef enum {
00290   METIS_PTYPE_RB, 
00291   METIS_PTYPE_KWAY                
00292 } mptype_et;
00293 
00295 typedef enum {
00296   METIS_GTYPE_DUAL,
00297   METIS_GTYPE_NODAL               
00298 } mgtype_et;
00299 
00301 typedef enum {
00302   METIS_CTYPE_RM,
00303   METIS_CTYPE_SHEM
00304 } mctype_et;
00305 
00307 typedef enum {
00308   METIS_IPTYPE_GROW,
00309   METIS_IPTYPE_RANDOM,
00310   METIS_IPTYPE_EDGE,
00311   METIS_IPTYPE_NODE,
00312   METIS_IPTYPE_METISRB
00313 } miptype_et;
00314 
00315 
00317 typedef enum {
00318   METIS_RTYPE_FM,
00319   METIS_RTYPE_GREEDY,
00320   METIS_RTYPE_SEP2SIDED,
00321   METIS_RTYPE_SEP1SIDED
00322 } mrtype_et;
00323 
00324 
00326 typedef enum {
00327   METIS_DBG_INFO       = 1,       
00328   METIS_DBG_TIME       = 2,       
00329   METIS_DBG_COARSEN    = 4,       
00330   METIS_DBG_REFINE     = 8,       
00331   METIS_DBG_IPART      = 16,      
00332   METIS_DBG_MOVEINFO   = 32,      
00333   METIS_DBG_SEPINFO    = 64,      
00334   METIS_DBG_CONNINFO   = 128,     
00335   METIS_DBG_CONTIGINFO = 256,     
00336   METIS_DBG_MEMORY     = 2048,    
00337 } mdbglvl_et;
00338 
00339 
00340 /* Types of objectives */
00341 typedef enum {
00342   METIS_OBJTYPE_CUT,
00343   METIS_OBJTYPE_VOL,
00344   METIS_OBJTYPE_NODE
00345 } mobjtype_et;
00346 
00347 
00348 
00349 #endif  /* _METIS_H_ */
 All Classes Files Functions Variables Typedefs Friends Defines