Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
geo_partition_scotch.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_PARMETIS_TOOLS_H
2#define _RHEOLEF_PARMETIS_TOOLS_H
23
24#include "rheolef/distributor.h"
25
26namespace rheolef {
27
28typedef int my_idxtype;
29#define IDX_DATATYPE MPI_INT
30typedef my_idxtype idxtype;
31
32// main call
33extern void geo_partition_scotch (
34 my_idxtype *elmdist,
35 my_idxtype *eptr,
36 std::vector<my_idxtype>& eind,
37 my_idxtype *elmwgt,
38 int *ncon,
39 int *ncommonnodes,
40 int *nparts,
41 float *tpwgts,
42 float *ubvec,
43 int *edgecut,
44 my_idxtype *part,
45 const mpi::communicator& comm);
46
47// internal materials:
48#include <stdio.h>
49#include <stdlib.h>
50#include <malloc.h>
51#include <string.h>
52#include <ctype.h>
53#include <math.h>
54#include <stdarg.h>
55#include <limits.h>
56#include <time.h>
57#include <assert.h>
58
59#define UNBALANCE_FRACTION 1.05
60#define DBG_INFO 2 /* Perform timing analysis */
61#define PMV3_OPTION_DBGLVL 1
62#define PMV3_OPTION_SEED 2
63#define MAXNCON 12
64#define MAXLINE 8192
65
66
67struct MeshType {
69 std::vector<my_idxtype> elements;
70 int etype;
72 int nelms, nns;
73 int ncon;
75 my_idxtype *elmwgt;
76 MeshType();
77private:
78 MeshType(const MeshType& x);
79 MeshType& operator= (const MeshType& x);
80};
81inline
83: ownership(),
84 elements(),
85 etype(0),
86 gnelms(0),
87 gnns(0),
88 nelms(0),
89 nns(0),
90 ncon(0),
91 esize(0),
92 gminnode(0),
93 elmwgt(0)
94{
95}
96#ifdef TODO
97inline
99: ownership(x.ownership),
100 elements(x.elements),
101 etype(x.etype),
102 gnelms(x.gnelms),
103 gnns(x.gnns),
104 nelms(x.nelms),
105 nns(x.nns),
106 ncon(x.ncon),
107 esize(x.esize),
108 gminnode(x.gminnode),
109 elmwgt(ARGGG)
110{
111}
112#endif // TODO
113
114/*************************************************************************
115* The following data structure stores key-value pair
116**************************************************************************/
117
119 my_idxtype key;
120 my_idxtype val;
121};
123
124#define amax(a, b) ((a) >= (b) ? (a) : (b))
125#define icopy(n, a, b) memcpy((b), (a), sizeof(int)*(n))
126#define idxcopy(n, a, b) memcpy((b), (a), sizeof(my_idxtype)*(n))
127#define SHIFTCSR(i, n, a) \
128 do { \
129 for (i=n; i>0; i--) a[i] = a[i-1]; \
130 a[0] = 0; \
131 } while(0)
132
133template <class Size, class RandomIOIterator>
134static inline void init_csr_ptr (Size n, const RandomIOIterator& aptr) {
135 for (Size i=1; i<n; i++) aptr[i] += aptr[i-1];
136 for (Size i=n; i>0; i--) aptr[i] = aptr[i-1];
137 aptr[0] = 0;
138}
139template <class Size, class RandomIOIterator>
140static inline void shift_csr_ptr (Size n, const RandomIOIterator& aptr) {
141 for (long int i = n; i > 0; i--) aptr[i] = aptr[i-1];
142 aptr[0] = 0;
143}
144
145/*************************************************************************
146* These functions return the index of the minimum element in a vector
147**************************************************************************/
148inline
149int
150idxamin(int n, const std::vector<my_idxtype>& x) {
151 int min=0;
152 for (int i=1; i<n; i++) min = (x[i] < x[min] ? i : min);
153 return min;
154}
155/*************************************************************************
156* These functions return the index of the maximum element in a vector
157**************************************************************************/
158inline
159int
160idxamax(int n, const std::vector<my_idxtype>& x) {
161 int max=0;
162 for (int i=1; i<n; i++) max = (x[i] > x[max] ? i : max);
163 return max;
164}
165
166} // namespace rheolef
167#endif // _RHEOLEF_PARMETIS_TOOLS_H
see the distributor page for the full documentation
Definition distributor.h:69
my_idxtype idxtype
struct KeyValueType KeyValueType
This file is part of Rheolef.
int idxamin(int n, const std::vector< my_idxtype > &x)
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)
int idxamax(int n, const std::vector< my_idxtype > &x)
std::vector< my_idxtype > elements
rheolef::distributor ownership