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