1 #ifndef DUNE_GRID_YASPGRID_PARTITIONING_HH
2 #define DUNE_GRID_YASPGRID_PARTITIONING_HH
13 #include<dune/common/power.hh>
50 optimize_dims(d-1,size,P,dims,trydims,opt);
53 void optimize_dims (
int i,
const iTupel& size,
int P,
iTupel& dims,
iTupel& trydims,
double &opt )
const
57 for (
int k=1; k<=P; k++)
62 optimize_dims(i-1,size,P/k,dims,trydims,opt);
73 for (
int k=0; k<d; k++)
75 double mm=((double)size[k])/((double)trydims[k]);
76 if (fmod((
double)size[k],(double)trydims[k])>0.0001) mm*=3;
100 for(
int i=1; i<=P; ++i)
101 if(Power<d>::eval(i)==P) {
102 std::fill(dims.begin(), dims.end(),i);
106 DUNE_THROW(
GridError,
"Loadbalancing failed: your number of processes needs to be a " << d <<
"-th power.");
122 virtual void loadbalance(
const std::array<int,d>&,
int P, std::array<int,d>& dims)
const
125 for (
int i=0; i<d; i++)
128 DUNE_THROW(Dune::Exception,
"Your processor number doesn't match your partitioning information");
133 std::array<int,d> _dims;
Include standard header files.
Definition: agrid.hh:58
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:18
a base class for the yaspgrid partitioning strategy The name might be irritating. It will probably ch...
Definition: partitioning.hh:24
virtual void loadbalance(const iTupel &, int, iTupel &) const =0
virtual ~YLoadBalance()
Definition: partitioning.hh:27
std::array< int, d > iTupel
Definition: partitioning.hh:26
Implement the default load balance strategy of yaspgrid.
Definition: partitioning.hh:35
virtual ~YLoadBalanceDefault()
Definition: partitioning.hh:38
virtual void loadbalance(const iTupel &size, int P, iTupel &dims) const
Distribute a structured grid across a set of processors.
Definition: partitioning.hh:45
std::array< int, d > iTupel
Definition: partitioning.hh:37
Implement yaspgrid load balance strategy for P=x^{dim} processors.
Definition: partitioning.hh:93
std::array< int, d > iTupel
Definition: partitioning.hh:95
virtual void loadbalance(const iTupel &size, int P, iTupel &dims) const
Definition: partitioning.hh:98
virtual ~YLoadBalancePowerD()
Definition: partitioning.hh:96
Implement partitioner that gets a fixed partitioning from an array If the given partitioning doesn't ...
Definition: partitioning.hh:116
YaspFixedSizePartitioner(const std::array< int, d > &dims)
Definition: partitioning.hh:118
virtual ~YaspFixedSizePartitioner()
Definition: partitioning.hh:120
virtual void loadbalance(const std::array< int, d > &, int P, std::array< int, d > &dims) const
Definition: partitioning.hh:122