3#ifndef DUNE_GRID_YASPGRID_PARTITIONING_HH
4#define DUNE_GRID_YASPGRID_PARTITIONING_HH
15#include<dune/common/math.hh>
16#include <dune/common/deprecated.hh>
65 optimize_dims(d-1,size,P,dims,trydims,opt,
overlap);
75 for (
int k=1; k<=P; k++)
87 optimize_dims(i-1,size,P/k,dims,trydims,opt,
overlap);
105 for (
int k=0; k<d; k++)
107 double mm=((double)size[k])/((double)trydims[k]);
108 if (fmod((
double)size[k],(double)trydims[k])>0.0001) mm*=3;
109 if ( mm > m ) m = mm;
132 for (
int i=1; i<=P; ++i)
133 if (Dune::power(i, d) == P) {
134 std::fill(dims.begin(), dims.end(),i);
138 DUNE_THROW(
GridError,
"Power partitioning failed: your number of processes needs to be a " << d <<
"-th power.");
154 void partition(
const std::array<int,d>&,
int P, std::array<int,d>& dims,
int overlap)
const final
157 for (
int i=0; i<d; i++)
160 DUNE_THROW(Dune::Exception,
"Your processor number doesn't match your partitioning information");
165 std::array<int,d> _dims;
179 [[deprecated(
"use the new interface of Yasp::Partitioning")]]
187DUNE_NO_DEPRECATED_BEGIN
191 std::unique_ptr<Yasp::Partitioning<d>> p_;
197 return p_->partition(size,P,dims,1);
241DUNE_NO_DEPRECATED_END
Include standard header files.
Definition: agrid.hh:60
constexpr Overlap overlap
PartitionSet for the overlap partition.
Definition: partitionset.hh:278
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:20
a base class for the yaspgrid partitioning strategy
Definition: partitioning.hh:39
std::array< int, d > iTupel
Definition: partitioning.hh:41
virtual ~Partitioning()=default
virtual void partition(const iTupel &, int, iTupel &, int) const =0
Definition: partitioning.hh:48
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:57
std::array< int, d > iTupel
Definition: partitioning.hh:50
Implement yaspgrid load balance strategy for P=x^{dim} processors.
Definition: partitioning.hh:125
virtual ~PowerDPartitioning()
Definition: partitioning.hh:128
std::array< int, d > iTupel
Definition: partitioning.hh:127
void partition(const iTupel &size, int P, iTupel &dims, int overlap) const final
Definition: partitioning.hh:130
Implement partitioner that gets a fixed partitioning from an array If the given partitioning doesn't ...
Definition: partitioning.hh:148
void partition(const std::array< int, d > &, int P, std::array< int, d > &dims, int overlap) const final
Definition: partitioning.hh:154
FixedSizePartitioning(const std::array< int, d > &dims)
Definition: partitioning.hh:150
virtual ~FixedSizePartitioning()
Definition: partitioning.hh:152
a base class for the yaspgrid partitioning strategy
Definition: partitioning.hh:176
void partition(const iTupel &size, int P, iTupel &dims, int overlap) const final
Definition: partitioning.hh:181
virtual void loadbalance(const iTupel &, int, iTupel &) const =0
virtual ~YLoadBalance()
Definition: partitioning.hh:180
std::array< int, d > iTupel
Definition: partitioning.hh:178
Definition: partitioning.hh:190
void loadbalance(const iTupel &size, int P, iTupel &dims) const final
Definition: partitioning.hh:196
YLoadBalanceForward(std::unique_ptr< Yasp::Partitioning< d > > &&p)
Definition: partitioning.hh:194
virtual ~YLoadBalanceForward()
Definition: partitioning.hh:195
std::array< int, d > iTupel
Definition: partitioning.hh:193
Implement the default load balance strategy of yaspgrid.
Definition: partitioning.hh:206
YLoadBalanceDefault()
Definition: partitioning.hh:208
Implement yaspgrid load balance strategy for P=x^{dim} processors.
Definition: partitioning.hh:218
std::array< int, d > iTupel
Definition: partitioning.hh:220
YLoadBalancePowerD()
Definition: partitioning.hh:221
Implement partitioner that gets a fixed partitioning from an array If the given partitioning doesn't ...
Definition: partitioning.hh:233
YaspFixedSizePartitioner(const std::array< int, d > &dims)
Definition: partitioning.hh:236
std::array< int, d > iTupel
Definition: partitioning.hh:235