ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
metisInterface.c
Go to the documentation of this file.
1 /*
2  ******************************************************************
3  * *
4  * File: metisInterface.c *
5  * Author: Edwin van der Weide *
6  * Starting date: 02-12-2003 *
7  * Last modified: 07-07-2005 *
8  * *
9  ******************************************************************
10 */
11 
12 #include "metis.h"
13 
14 /*
15  ******************************************************************
16  * *
17  * metisInterface is an interface between the application *
18  * program, either written in Fortran or C, and the *
19  * multi-constraint graph partitioning routines of metis. *
20  * *
21  ******************************************************************
22 */
23 
24 void metisInterface(int *n, int *ncon, idxtype *xadj, idxtype *adjncy,
25  idxtype *vwgt, idxtype *adjwgt, int *wgtflag,
26  int *numflag, int *nparts, float *ubvec,
27  int *options, int *edgecut, idxtype *part)
28 {
29  /* According to the Metis manual, the graph partitioner should be */
30  /* used when the number of partitions is greater than 8. Otherwise */
31  /* the recursive bisection is to be preferred. */
32  /* Take care of the special case nparts == 1 here. */
33  /*printf("metisinterface: %d",*nparts); */
34 
35  /* The PartGraphKway does NOT work with ADFLOW. Therefore ALWAYS use the */
36  /* the graphRecursive algorithm */
37 
38 
39  if(*nparts == 1)
40  {
41  int i;
42  for(i=0; i<(*n); i++) part[i] = 0;
43  }
44  else if(*nparts > 8)
45  METIS_mCPartGraphKway(n, ncon, xadj, adjncy, vwgt, adjwgt, wgtflag,
46  numflag, nparts, ubvec, options, edgecut,
47  part);
48  else
49  METIS_mCPartGraphRecursive(n, ncon, xadj, adjncy, vwgt, adjwgt,
50  wgtflag, numflag, nparts, options,
51  edgecut, part);
52 }
53 
54  /* else */
55 /* METIS_mCPartGraphRecursive(n, ncon, xadj, adjncy, vwgt, adjwgt, */
56 /* wgtflag, numflag, nparts, options, */
57 /* edgecut, part); */
58 
59 
60 
61 /*
62  ******************************************************************
63  * *
64  * Dummy functions to allow the calling from FORTRAN. *
65  * *
66  ******************************************************************
67 */
68 
69 void METISINTERFACE(int *n, int *ncon, idxtype *xadj, idxtype *adjncy,
70  idxtype *vwgt, idxtype *adjwgt, int *wgtflag,
71  int *numflag, int *nparts, float *ubvec,
72  int *options, int *edgecut, idxtype *part)
73 {
74  metisInterface(n, ncon, xadj, adjncy, vwgt, adjwgt, wgtflag,
75  numflag, nparts, ubvec, options, edgecut, part);
76 }
77 
78 void metisinterface_(int *n, int *ncon, idxtype *xadj, idxtype *adjncy,
79  idxtype *vwgt, idxtype *adjwgt, int *wgtflag,
80  int *numflag, int *nparts, float *ubvec,
81  int *options, int *edgecut, idxtype *part)
82 {
83  metisInterface(n, ncon, xadj, adjncy, vwgt, adjwgt, wgtflag,
84  numflag, nparts, ubvec, options, edgecut, part);
85 }
86 
87 void metisinterface(int *n, int *ncon, idxtype *xadj, idxtype *adjncy,
88  idxtype *vwgt, idxtype *adjwgt, int *wgtflag,
89  int *numflag, int *nparts, float *ubvec,
90  int *options, int *edgecut, idxtype *part)
91 {
92  metisInterface(n, ncon, xadj, adjncy, vwgt, adjwgt, wgtflag,
93  numflag, nparts, ubvec, options, edgecut, part);
94 }
95 
96 void metisinterface__(int *n, int *ncon, idxtype *xadj, idxtype *adjncy,
97  idxtype *vwgt, idxtype *adjwgt, int *wgtflag,
98  int *numflag, int *nparts, float *ubvec,
99  int *options, int *edgecut, idxtype *part)
100 {
101  metisInterface(n, ncon, xadj, adjncy, vwgt, adjwgt, wgtflag,
102  numflag, nparts, ubvec, options, edgecut, part);
103 }
void METIS_mCPartGraphKway(int *nvtxs, int *ncon, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, float *rubvec, int *options, int *edgecut, idxtype *part)
Definition: metis.c:10353
void METIS_mCPartGraphRecursive(int *nvtxs, int *ncon, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, int *options, int *edgecut, idxtype *part)
Definition: metis.c:12550
void metisInterface(int *n, int *ncon, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, float *ubvec, int *options, int *edgecut, idxtype *part)
void METISINTERFACE(int *n, int *ncon, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, float *ubvec, int *options, int *edgecut, idxtype *part)
void metisinterface__(int *n, int *ncon, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, float *ubvec, int *options, int *edgecut, idxtype *part)
void metisinterface(int *n, int *ncon, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, float *ubvec, int *options, int *edgecut, idxtype *part)
void metisinterface_(int *n, int *ncon, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, float *ubvec, int *options, int *edgecut, idxtype *part)
integer(kind=inttype), dimension(:), allocatable part
real, dimension(2) ubvec
ADflow_intT idxtype
Definition: struct.h:19