Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
geo_mpi_partition_scotch.cc
Go to the documentation of this file.
1
21#include "rheolef/config.h"
22#ifdef _RHEOLEF_HAVE_MPI
23// mesh partition
24#include "rheolef/communicator.h"
25
27
28namespace rheolef {
29using namespace std;
30
31void geo_dual (
32 my_idxtype *elmdist,
33 my_idxtype *eptr,
34 vector<my_idxtype>& eind,
35 int *ncommonnodes,
36 vector<my_idxtype>& xadj,
37 vector<my_idxtype>& adjncy,
38 const mpi::communicator& comm);
39
40extern "C" {
41void ParMETIS_V3_PartKway (const int * const, int * const, int * const, int * const, int * const, const int * const, const int * const, const int * const, const int * const, const float * const, const float * const, const int * const, int * const, int * const, MPI_Comm * const);
42}
43// -------------------------------------------------------------------------------------
44// This function is the entry point of the distributed k-way multilevel mesh partitionioner
45// This function assumes nothing about the mesh distribution.
46// It is the general case.
47// -------------------------------------------------------------------------------------
49 my_idxtype *elmdist,
50 my_idxtype *eptr,
51 vector<my_idxtype>& eind,
52 my_idxtype *elmwgt,
53 int *ncon,
54 int *ncommonnodes,
55 int *nparts,
56 float *tpwgts,
57 float *ubvec,
58 int *edgecut,
59 my_idxtype *part,
60 const mpi::communicator& comm)
61{
62 if (eind.size() == 0) {
63 error_macro ("empty sizes not supported");
64 }
65 // Try and take care bad inputs
66 if (elmdist == NULL || eptr == NULL ||
67 ncon == NULL || ncommonnodes == NULL || nparts == NULL ||
68 tpwgts == NULL || ubvec == NULL || edgecut == NULL ||
69 part == NULL) {
70 error_macro ("one or more required parameters is NULL");
71 }
72 comm.barrier();
73
74 vector<my_idxtype> xadj;
75 vector<my_idxtype> adjncy;
76 geo_dual (
77 elmdist,
78 eptr,
79 eind,
80 ncommonnodes,
81 xadj,
82 adjncy,
83 comm);
84
85 comm.barrier();
86
87 // Partition the graph
88 MPI_Comm raw_comm = comm;
89 int options[10];
90 options[0] = 1;
91 options[PMV3_OPTION_DBGLVL] = 0; // otherwise: timming print to stdout...
92 options[PMV3_OPTION_SEED] = 0;
93 int numflag = 0;
94 int wgtflag = 0;
96 elmdist,
97 xadj.begin().operator->(),
98 adjncy.begin().operator->(),
99 elmwgt,
100 NULL,
101 &wgtflag,
102 &numflag,
103 ncon,
104 nparts,
105 tpwgts,
106 ubvec,
107 options,
108 edgecut,
109 part,
110 &raw_comm);
111
112 comm.barrier();
113}
114
115} // namespace rheolef
116#endif // _RHEOLEF_HAVE_MPI
#define error_macro(message)
Definition dis_macros.h:49
#define PMV3_OPTION_DBGLVL
#define PMV3_OPTION_SEED
This file is part of Rheolef.
void geo_partition_scotch(my_idxtype *elmdist, my_idxtype *eptr, vector< my_idxtype > &eind, my_idxtype *elmwgt, int *ncon, int *ncommonnodes, int *nparts, float *tpwgts, float *ubvec, int *edgecut, my_idxtype *part, const mpi::communicator &comm)
void geo_dual(my_idxtype *elmdist, my_idxtype *eptr, vector< my_idxtype > &eind, int *ncommonnodes, vector< my_idxtype > &xadj, vector< my_idxtype > &adjncy, const mpi::communicator &comm)
void ParMETIS_V3_PartKway(const int *const, int *const, int *const, int *const, int *const, const int *const, const int *const, const int *const, const int *const, const float *const, const float *const, const int *const, int *const, int *const, MPI_Comm *const)
STL namespace.