Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmergrid/src/metis-5.1.0/include/metis.h
3206 views
1
/*!
2
\file metis.h
3
\brief This file contains function prototypes and constant definitions for METIS
4
*
5
\author George
6
\date Started 8/9/02
7
\version\verbatim $Id$\endverbatim
8
*/
9
10
#ifndef _METIS_H_
11
#define _METIS_H_
12
13
/****************************************************************************
14
* A set of defines that can be modified by the user
15
*****************************************************************************/
16
17
/*--------------------------------------------------------------------------
18
Specifies the width of the elementary data type that will hold information
19
about vertices and their adjacency lists.
20
21
Possible values:
22
32 : Use 32 bit signed integers
23
64 : Use 64 bit signed integers
24
25
A width of 64 should be specified if the number of vertices or the total
26
number of edges in the graph exceed the limits of a 32 bit signed integer
27
i.e., 2^31-1.
28
Proper use of 64 bit integers requires that the c99 standard datatypes
29
int32_t and int64_t are supported by the compiler.
30
GCC does provides these definitions in stdint.h, but it may require some
31
modifications on other architectures.
32
--------------------------------------------------------------------------*/
33
#define IDXTYPEWIDTH 32
34
35
36
/*--------------------------------------------------------------------------
37
Specifies the data type that will hold floating-point style information.
38
39
Possible values:
40
32 : single precission floating point (float)
41
64 : double precission floating point (double)
42
--------------------------------------------------------------------------*/
43
#define REALTYPEWIDTH 32
44
45
46
47
/****************************************************************************
48
* In principle, nothing needs to be changed beyond this point, unless the
49
* int32_t and int64_t cannot be found in the normal places.
50
*****************************************************************************/
51
52
/* Uniform definitions for various compilers */
53
#if defined(_MSC_VER)
54
#define COMPILER_MSC
55
#endif
56
#if defined(__ICC)
57
#define COMPILER_ICC
58
#endif
59
#if defined(__GNUC__)
60
#define COMPILER_GCC
61
#endif
62
63
/* Include c99 int definitions and need constants. When building the library,
64
* these are already defined by GKlib; hence the test for _GKLIB_H_ */
65
#ifndef _GKLIB_H_
66
#ifdef COMPILER_MSC
67
#include <limits.h>
68
69
typedef __int32 int32_t;
70
typedef __int64 int64_t;
71
#define PRId32 "I32d"
72
#define PRId64 "I64d"
73
#define SCNd32 "ld"
74
#define SCNd64 "I64d"
75
#define INT32_MIN ((int32_t)_I32_MIN)
76
#define INT32_MAX _I32_MAX
77
#define INT64_MIN ((int64_t)_I64_MIN)
78
#define INT64_MAX _I64_MAX
79
#else
80
#include <inttypes.h>
81
#endif
82
#endif
83
84
85
/*------------------------------------------------------------------------
86
* Setup the basic datatypes
87
*-------------------------------------------------------------------------*/
88
#if IDXTYPEWIDTH == 32
89
typedef int32_t idx_t;
90
91
#define IDX_MAX INT32_MAX
92
#define IDX_MIN INT32_MIN
93
94
#define SCIDX SCNd32
95
#define PRIDX PRId32
96
97
#define strtoidx strtol
98
#define iabs abs
99
#elif IDXTYPEWIDTH == 64
100
typedef int64_t idx_t;
101
102
#define IDX_MAX INT64_MAX
103
#define IDX_MIN INT64_MIN
104
105
#define SCIDX SCNd64
106
#define PRIDX PRId64
107
108
#ifdef COMPILER_MSC
109
#define strtoidx _strtoi64
110
#else
111
#define strtoidx strtoll
112
#endif
113
#define iabs labs
114
#else
115
#error "Incorrect user-supplied value fo IDXTYPEWIDTH"
116
#endif
117
118
119
#if REALTYPEWIDTH == 32
120
typedef float real_t;
121
122
#define SCREAL "f"
123
#define PRREAL "f"
124
#define REAL_MAX FLT_MAX
125
#define REAL_MIN FLT_MIN
126
#define REAL_EPSILON FLT_EPSILON
127
128
#define rabs fabsf
129
#define REALEQ(x,y) ((rabs((x)-(y)) <= FLT_EPSILON))
130
131
#ifdef COMPILER_MSC
132
#define strtoreal (float)strtod
133
#else
134
#define strtoreal strtof
135
#endif
136
#elif REALTYPEWIDTH == 64
137
typedef double real_t;
138
139
#define SCREAL "lf"
140
#define PRREAL "lf"
141
#define REAL_MAX DBL_MAX
142
#define REAL_MIN DBL_MIN
143
#define REAL_EPSILON DBL_EPSILON
144
145
#define rabs fabs
146
#define REALEQ(x,y) ((rabs((x)-(y)) <= DBL_EPSILON))
147
148
#define strtoreal strtod
149
#else
150
#error "Incorrect user-supplied value for REALTYPEWIDTH"
151
#endif
152
153
154
/*------------------------------------------------------------------------
155
* Constant definitions
156
*-------------------------------------------------------------------------*/
157
/* Metis's version number */
158
#define METIS_VER_MAJOR 5
159
#define METIS_VER_MINOR 1
160
#define METIS_VER_SUBMINOR 0
161
162
/* The maximum length of the options[] array */
163
#define METIS_NOPTIONS 40
164
165
166
167
/*------------------------------------------------------------------------
168
* Function prototypes
169
*-------------------------------------------------------------------------*/
170
171
#ifdef _WINDLL
172
#define METIS_API(type) __declspec(dllexport) type __cdecl
173
#elif defined(__cdecl)
174
#define METIS_API(type) type __cdecl
175
#else
176
#define METIS_API(type) type
177
#endif
178
179
180
181
#ifdef __cplusplus
182
extern "C" {
183
#endif
184
185
METIS_API(int) METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,
186
idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,
187
idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,
188
idx_t *edgecut, idx_t *part);
189
190
METIS_API(int) METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,
191
idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,
192
idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,
193
idx_t *edgecut, idx_t *part);
194
195
METIS_API(int) METIS_MeshToDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
196
idx_t *ncommon, idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);
197
198
METIS_API(int) METIS_MeshToNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
199
idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy);
200
201
METIS_API(int) METIS_PartMeshNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
202
idx_t *vwgt, idx_t *vsize, idx_t *nparts, real_t *tpwgts,
203
idx_t *options, idx_t *objval, idx_t *epart, idx_t *npart);
204
205
METIS_API(int) METIS_PartMeshDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind,
206
idx_t *vwgt, idx_t *vsize, idx_t *ncommon, idx_t *nparts,
207
real_t *tpwgts, idx_t *options, idx_t *objval, idx_t *epart,
208
idx_t *npart);
209
210
METIS_API(int) METIS_NodeND(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
211
idx_t *options, idx_t *perm, idx_t *iperm);
212
213
METIS_API(int) METIS_Free(void *ptr);
214
215
METIS_API(int) METIS_SetDefaultOptions(idx_t *options);
216
217
218
/* These functions are used by ParMETIS */
219
220
METIS_API(int) METIS_NodeNDP(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
221
idx_t npes, idx_t *options, idx_t *perm, idx_t *iperm,
222
idx_t *sizes);
223
224
METIS_API(int) METIS_ComputeVertexSeparator(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy,
225
idx_t *vwgt, idx_t *options, idx_t *sepsize, idx_t *part);
226
227
METIS_API(int) METIS_NodeRefine(idx_t nvtxs, idx_t *xadj, idx_t *vwgt, idx_t *adjncy,
228
idx_t *where, idx_t *hmarker, real_t ubfactor);
229
230
231
#ifdef __cplusplus
232
}
233
#endif
234
235
236
237
/*------------------------------------------------------------------------
238
* Enum type definitions
239
*-------------------------------------------------------------------------*/
240
/*! Return codes */
241
typedef enum {
242
METIS_OK = 1, /*!< Returned normally */
243
METIS_ERROR_INPUT = -2, /*!< Returned due to erroneous inputs and/or options */
244
METIS_ERROR_MEMORY = -3, /*!< Returned due to insufficient memory */
245
METIS_ERROR = -4 /*!< Some other errors */
246
} rstatus_et;
247
248
249
/*! Operation type codes */
250
typedef enum {
251
METIS_OP_PMETIS,
252
METIS_OP_KMETIS,
253
METIS_OP_OMETIS
254
} moptype_et;
255
256
257
/*! Options codes (i.e., options[]) */
258
typedef enum {
259
METIS_OPTION_PTYPE,
260
METIS_OPTION_OBJTYPE,
261
METIS_OPTION_CTYPE,
262
METIS_OPTION_IPTYPE,
263
METIS_OPTION_RTYPE,
264
METIS_OPTION_DBGLVL,
265
METIS_OPTION_NITER,
266
METIS_OPTION_NCUTS,
267
METIS_OPTION_SEED,
268
METIS_OPTION_NO2HOP,
269
METIS_OPTION_MINCONN,
270
METIS_OPTION_CONTIG,
271
METIS_OPTION_COMPRESS,
272
METIS_OPTION_CCORDER,
273
METIS_OPTION_PFACTOR,
274
METIS_OPTION_NSEPS,
275
METIS_OPTION_UFACTOR,
276
METIS_OPTION_NUMBERING,
277
278
/* Used for command-line parameter purposes */
279
METIS_OPTION_HELP,
280
METIS_OPTION_TPWGTS,
281
METIS_OPTION_NCOMMON,
282
METIS_OPTION_NOOUTPUT,
283
METIS_OPTION_BALANCE,
284
METIS_OPTION_GTYPE,
285
METIS_OPTION_UBVEC
286
} moptions_et;
287
288
289
/*! Partitioning Schemes */
290
typedef enum {
291
METIS_PTYPE_RB,
292
METIS_PTYPE_KWAY
293
} mptype_et;
294
295
/*! Graph types for meshes */
296
typedef enum {
297
METIS_GTYPE_DUAL,
298
METIS_GTYPE_NODAL
299
} mgtype_et;
300
301
/*! Coarsening Schemes */
302
typedef enum {
303
METIS_CTYPE_RM,
304
METIS_CTYPE_SHEM
305
} mctype_et;
306
307
/*! Initial partitioning schemes */
308
typedef enum {
309
METIS_IPTYPE_GROW,
310
METIS_IPTYPE_RANDOM,
311
METIS_IPTYPE_EDGE,
312
METIS_IPTYPE_NODE,
313
METIS_IPTYPE_METISRB
314
} miptype_et;
315
316
317
/*! Refinement schemes */
318
typedef enum {
319
METIS_RTYPE_FM,
320
METIS_RTYPE_GREEDY,
321
METIS_RTYPE_SEP2SIDED,
322
METIS_RTYPE_SEP1SIDED
323
} mrtype_et;
324
325
326
/*! Debug Levels */
327
typedef enum {
328
METIS_DBG_INFO = 1, /*!< Shows various diagnostic messages */
329
METIS_DBG_TIME = 2, /*!< Perform timing analysis */
330
METIS_DBG_COARSEN = 4, /*!< Show the coarsening progress */
331
METIS_DBG_REFINE = 8, /*!< Show the refinement progress */
332
METIS_DBG_IPART = 16, /*!< Show info on initial partitioning */
333
METIS_DBG_MOVEINFO = 32, /*!< Show info on vertex moves during refinement */
334
METIS_DBG_SEPINFO = 64, /*!< Show info on vertex moves during sep refinement */
335
METIS_DBG_CONNINFO = 128, /*!< Show info on minimization of subdomain connectivity */
336
METIS_DBG_CONTIGINFO = 256, /*!< Show info on elimination of connected components */
337
METIS_DBG_MEMORY = 2048, /*!< Show info related to wspace allocation */
338
} mdbglvl_et;
339
340
341
/* Types of objectives */
342
typedef enum {
343
METIS_OBJTYPE_CUT,
344
METIS_OBJTYPE_VOL,
345
METIS_OBJTYPE_NODE
346
} mobjtype_et;
347
348
349
350
#endif /* _METIS_H_ */
351
352