3#ifndef DUNE_GRID_YASPGRID_PARTITIONING_HH
4#define DUNE_GRID_YASPGRID_PARTITIONING_HH
15#include<dune/common/math.hh>
64 optimize_dims(d-1,size,P,dims,trydims,opt,overlap);
70 void optimize_dims (
int i,
const iTupel& size,
int P,
iTupel& dims,
iTupel& trydims,
double &opt,
int overlap )
const
74 for (
int k=1; k<=P; k++)
80 size[i] / k >= 2*overlap
86 optimize_dims(i-1,size,P/k,dims,trydims,opt,overlap);
95 size[0] / P >= 2*overlap
104 for (
int k=0; k<d; k++)
106 double mm=((double)size[k])/((double)trydims[k]);
107 if (fmod((
double)size[k],(double)trydims[k])>0.0001) mm*=3;
108 if ( mm > m ) m = mm;
131 for (
int i=1; i<=P; ++i)
132 if (Dune::power(i, d) == P) {
133 std::fill(dims.begin(), dims.end(),i);
137 DUNE_THROW(
GridError,
"Power partitioning failed: your number of processes needs to be a " << d <<
"-th power.");
153 void partition(
const std::array<int,d>&,
int P, std::array<int,d>& dims,
int overlap)
const final
156 for (
int i=0; i<d; i++)
159 DUNE_THROW(Dune::Exception,
"Your processor number doesn't match your partitioning information");
164 std::array<int,d> _dims;
Include standard header files.
Definition agrid.hh:60
Base class for exceptions in Dune grid modules.
Definition exceptions.hh:20
a base class for the yaspgrid partitioning strategy
Definition partitioning.hh:38
std::array< int, d > iTupel
Definition partitioning.hh:40
virtual ~Partitioning()=default
virtual void partition(const iTupel &, int, iTupel &, int) const =0
Definition partitioning.hh:47
void partition(const iTupel &size, int P, iTupel &dims, int overlap) const final
Distribute a structured grid across a set of processors.
Definition partitioning.hh:56
std::array< int, d > iTupel
Definition partitioning.hh:49
Implement yaspgrid load balance strategy for P=x^{dim} processors.
Definition partitioning.hh:124
virtual ~PowerDPartitioning()
Definition partitioning.hh:127
std::array< int, d > iTupel
Definition partitioning.hh:126
void partition(const iTupel &size, int P, iTupel &dims, int overlap) const final
Definition partitioning.hh:129
Implement partitioner that gets a fixed partitioning from an array If the given partitioning doesn't ...
Definition partitioning.hh:147
void partition(const std::array< int, d > &, int P, std::array< int, d > &dims, int overlap) const final
Definition partitioning.hh:153
FixedSizePartitioning(const std::array< int, d > &dims)
Definition partitioning.hh:149
virtual ~FixedSizePartitioning()
Definition partitioning.hh:151