Path: blob/devel/elmergrid/src/metis-5.1.0/include/metis.h
3206 views
/*!1\file metis.h2\brief This file contains function prototypes and constant definitions for METIS3*4\author George5\date Started 8/9/026\version\verbatim $Id$\endverbatim7*/89#ifndef _METIS_H_10#define _METIS_H_1112/****************************************************************************13* A set of defines that can be modified by the user14*****************************************************************************/1516/*--------------------------------------------------------------------------17Specifies the width of the elementary data type that will hold information18about vertices and their adjacency lists.1920Possible values:2132 : Use 32 bit signed integers2264 : Use 64 bit signed integers2324A width of 64 should be specified if the number of vertices or the total25number of edges in the graph exceed the limits of a 32 bit signed integer26i.e., 2^31-1.27Proper use of 64 bit integers requires that the c99 standard datatypes28int32_t and int64_t are supported by the compiler.29GCC does provides these definitions in stdint.h, but it may require some30modifications on other architectures.31--------------------------------------------------------------------------*/32#define IDXTYPEWIDTH 32333435/*--------------------------------------------------------------------------36Specifies the data type that will hold floating-point style information.3738Possible values:3932 : single precission floating point (float)4064 : double precission floating point (double)41--------------------------------------------------------------------------*/42#define REALTYPEWIDTH 3243444546/****************************************************************************47* In principle, nothing needs to be changed beyond this point, unless the48* int32_t and int64_t cannot be found in the normal places.49*****************************************************************************/5051/* Uniform definitions for various compilers */52#if defined(_MSC_VER)53#define COMPILER_MSC54#endif55#if defined(__ICC)56#define COMPILER_ICC57#endif58#if defined(__GNUC__)59#define COMPILER_GCC60#endif6162/* Include c99 int definitions and need constants. When building the library,63* these are already defined by GKlib; hence the test for _GKLIB_H_ */64#ifndef _GKLIB_H_65#ifdef COMPILER_MSC66#include <limits.h>6768typedef __int32 int32_t;69typedef __int64 int64_t;70#define PRId32 "I32d"71#define PRId64 "I64d"72#define SCNd32 "ld"73#define SCNd64 "I64d"74#define INT32_MIN ((int32_t)_I32_MIN)75#define INT32_MAX _I32_MAX76#define INT64_MIN ((int64_t)_I64_MIN)77#define INT64_MAX _I64_MAX78#else79#include <inttypes.h>80#endif81#endif828384/*------------------------------------------------------------------------85* Setup the basic datatypes86*-------------------------------------------------------------------------*/87#if IDXTYPEWIDTH == 3288typedef int32_t idx_t;8990#define IDX_MAX INT32_MAX91#define IDX_MIN INT32_MIN9293#define SCIDX SCNd3294#define PRIDX PRId329596#define strtoidx strtol97#define iabs abs98#elif IDXTYPEWIDTH == 6499typedef int64_t idx_t;100101#define IDX_MAX INT64_MAX102#define IDX_MIN INT64_MIN103104#define SCIDX SCNd64105#define PRIDX PRId64106107#ifdef COMPILER_MSC108#define strtoidx _strtoi64109#else110#define strtoidx strtoll111#endif112#define iabs labs113#else114#error "Incorrect user-supplied value fo IDXTYPEWIDTH"115#endif116117118#if REALTYPEWIDTH == 32119typedef float real_t;120121#define SCREAL "f"122#define PRREAL "f"123#define REAL_MAX FLT_MAX124#define REAL_MIN FLT_MIN125#define REAL_EPSILON FLT_EPSILON126127#define rabs fabsf128#define REALEQ(x,y) ((rabs((x)-(y)) <= FLT_EPSILON))129130#ifdef COMPILER_MSC131#define strtoreal (float)strtod132#else133#define strtoreal strtof134#endif135#elif REALTYPEWIDTH == 64136typedef double real_t;137138#define SCREAL "lf"139#define PRREAL "lf"140#define REAL_MAX DBL_MAX141#define REAL_MIN DBL_MIN142#define REAL_EPSILON DBL_EPSILON143144#define rabs fabs145#define REALEQ(x,y) ((rabs((x)-(y)) <= DBL_EPSILON))146147#define strtoreal strtod148#else149#error "Incorrect user-supplied value for REALTYPEWIDTH"150#endif151152153/*------------------------------------------------------------------------154* Constant definitions155*-------------------------------------------------------------------------*/156/* Metis's version number */157#define METIS_VER_MAJOR 5158#define METIS_VER_MINOR 1159#define METIS_VER_SUBMINOR 0160161/* The maximum length of the options[] array */162#define METIS_NOPTIONS 40163164165166/*------------------------------------------------------------------------167* Function prototypes168*-------------------------------------------------------------------------*/169170#ifdef _WINDLL171#define METIS_API(type) __declspec(dllexport) type __cdecl172#elif defined(__cdecl)173#define METIS_API(type) type __cdecl174#else175#define METIS_API(type) type176#endif177178179180#ifdef __cplusplus181extern "C" {182#endif183184METIS_API(int) METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,185idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,186idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,187idx_t *edgecut, idx_t *part);188189METIS_API(int) METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,190idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,191idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,192idx_t *edgecut, idx_t *part);193194METIS_API(int) METIS_MeshToDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,195idx_t *ncommon, idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);196197METIS_API(int) METIS_MeshToNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,198idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);199200METIS_API(int) METIS_PartMeshNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,201idx_t *vwgt, idx_t *vsize, idx_t *nparts, real_t *tpwgts,202idx_t *options, idx_t *objval, idx_t *epart, idx_t *npart);203204METIS_API(int) METIS_PartMeshDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,205idx_t *vwgt, idx_t *vsize, idx_t *ncommon, idx_t *nparts,206real_t *tpwgts, idx_t *options, idx_t *objval, idx_t *epart,207idx_t *npart);208209METIS_API(int) METIS_NodeND(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,210idx_t *options, idx_t *perm, idx_t *iperm);211212METIS_API(int) METIS_Free(void *ptr);213214METIS_API(int) METIS_SetDefaultOptions(idx_t *options);215216217/* These functions are used by ParMETIS */218219METIS_API(int) METIS_NodeNDP(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,220idx_t npes, idx_t *options, idx_t *perm, idx_t *iperm,221idx_t *sizes);222223METIS_API(int) METIS_ComputeVertexSeparator(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy,224idx_t *vwgt, idx_t *options, idx_t *sepsize, idx_t *part);225226METIS_API(int) METIS_NodeRefine(idx_t nvtxs, idx_t *xadj, idx_t *vwgt, idx_t *adjncy,227idx_t *where, idx_t *hmarker, real_t ubfactor);228229230#ifdef __cplusplus231}232#endif233234235236/*------------------------------------------------------------------------237* Enum type definitions238*-------------------------------------------------------------------------*/239/*! Return codes */240typedef enum {241METIS_OK = 1, /*!< Returned normally */242METIS_ERROR_INPUT = -2, /*!< Returned due to erroneous inputs and/or options */243METIS_ERROR_MEMORY = -3, /*!< Returned due to insufficient memory */244METIS_ERROR = -4 /*!< Some other errors */245} rstatus_et;246247248/*! Operation type codes */249typedef enum {250METIS_OP_PMETIS,251METIS_OP_KMETIS,252METIS_OP_OMETIS253} moptype_et;254255256/*! Options codes (i.e., options[]) */257typedef enum {258METIS_OPTION_PTYPE,259METIS_OPTION_OBJTYPE,260METIS_OPTION_CTYPE,261METIS_OPTION_IPTYPE,262METIS_OPTION_RTYPE,263METIS_OPTION_DBGLVL,264METIS_OPTION_NITER,265METIS_OPTION_NCUTS,266METIS_OPTION_SEED,267METIS_OPTION_NO2HOP,268METIS_OPTION_MINCONN,269METIS_OPTION_CONTIG,270METIS_OPTION_COMPRESS,271METIS_OPTION_CCORDER,272METIS_OPTION_PFACTOR,273METIS_OPTION_NSEPS,274METIS_OPTION_UFACTOR,275METIS_OPTION_NUMBERING,276277/* Used for command-line parameter purposes */278METIS_OPTION_HELP,279METIS_OPTION_TPWGTS,280METIS_OPTION_NCOMMON,281METIS_OPTION_NOOUTPUT,282METIS_OPTION_BALANCE,283METIS_OPTION_GTYPE,284METIS_OPTION_UBVEC285} moptions_et;286287288/*! Partitioning Schemes */289typedef enum {290METIS_PTYPE_RB,291METIS_PTYPE_KWAY292} mptype_et;293294/*! Graph types for meshes */295typedef enum {296METIS_GTYPE_DUAL,297METIS_GTYPE_NODAL298} mgtype_et;299300/*! Coarsening Schemes */301typedef enum {302METIS_CTYPE_RM,303METIS_CTYPE_SHEM304} mctype_et;305306/*! Initial partitioning schemes */307typedef enum {308METIS_IPTYPE_GROW,309METIS_IPTYPE_RANDOM,310METIS_IPTYPE_EDGE,311METIS_IPTYPE_NODE,312METIS_IPTYPE_METISRB313} miptype_et;314315316/*! Refinement schemes */317typedef enum {318METIS_RTYPE_FM,319METIS_RTYPE_GREEDY,320METIS_RTYPE_SEP2SIDED,321METIS_RTYPE_SEP1SIDED322} mrtype_et;323324325/*! Debug Levels */326typedef enum {327METIS_DBG_INFO = 1, /*!< Shows various diagnostic messages */328METIS_DBG_TIME = 2, /*!< Perform timing analysis */329METIS_DBG_COARSEN = 4, /*!< Show the coarsening progress */330METIS_DBG_REFINE = 8, /*!< Show the refinement progress */331METIS_DBG_IPART = 16, /*!< Show info on initial partitioning */332METIS_DBG_MOVEINFO = 32, /*!< Show info on vertex moves during refinement */333METIS_DBG_SEPINFO = 64, /*!< Show info on vertex moves during sep refinement */334METIS_DBG_CONNINFO = 128, /*!< Show info on minimization of subdomain connectivity */335METIS_DBG_CONTIGINFO = 256, /*!< Show info on elimination of connected components */336METIS_DBG_MEMORY = 2048, /*!< Show info related to wspace allocation */337} mdbglvl_et;338339340/* Types of objectives */341typedef enum {342METIS_OBJTYPE_CUT,343METIS_OBJTYPE_VOL,344METIS_OBJTYPE_NODE345} mobjtype_et;346347348349#endif /* _METIS_H_ */350351352