14 MPI_Comm_size(MPI_COMM_WORLD, &ws);
18 MPI_Reduce(&n, &result, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
19 MPI_Reduce(&n, &total, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
20 return result*ws*1.0/(total*1.0);
24 outer,
int Niter,
double tload,
double speed,
int mode,
bool Rmin)
27 MPI_Comm_size(MPI_COMM_WORLD, &ws);
29 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
35 vector<size_t> selfindex;
36 vector<vector<int> > sentpoints;
41 local.
SetPointNo(static_cast<int>(points.size()));
42 for(
int i=0;i<Niter;++i)
44 MPI_Barrier(MPI_COMM_WORLD);
45 procmove.Update(tproc,local);
46 points = local.
UpdateMPIPoints(tproc, rank, points, &outer, selfindex, sentproc, sentpoints);
48 local.
SetPointNo(static_cast<int>(points.size()));
49 MPI_Barrier(MPI_COMM_WORLD);
50 double load=GetLoad(local);
51 MPI_Bcast(&load, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
61 outer,
int Niter,
double speed,
int mode,
bool Rmin)
63 RunLoadBalance(tproc,points,outer,Niter,0,speed,mode,Rmin);
67 outer,
double TargetLoad,
double speed,
int mode,
bool Rmin)
69 RunLoadBalance(tproc,points,outer,1000,TargetLoad,speed,mode,Rmin);
Voronoi tessellation class.
Abstract class for tessellation.
void SetLoad(Tessellation &tproc, vector< Vector2D > &points, OuterBoundary const &outer, int Niter=100, double speed=0.04, int mode=2, bool Rmin=false)
Corrects the load between processors based on number of cells per processor.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
vector< Vector2D > UpdateMPIPoints(Tessellation const &vproc, int rank, vector< Vector2D > &points, OuterBoundary const *obc, vector< size_t > &selfindex, vector< int > &sentproc, vector< vector< int > > &sentpoints)
Communicate position of mesh generating points between processes.
Function for setting the load balance based on equal cells per processor.
A load balancing scheme aiming for the same number of points in each process.
void SetPointNo(int N)
Set the number of points.
vector< Vector2D > & GetMeshPoints(void)
Returns a reference to the point vector.
Abstract class for geometric boundary conditions for the tessellation.