39class PartitionConverter
44 PartitionConverter(
IParallelMng* pm=NULL,
Real max=(2<<30),
bool check=
false)
45 : m_pm(pm), m_maxAllowed(max), m_sum(0), m_zoomfactor(0), m_ready(
false), m_check(check)
48 m_zoomfactor.fill(1.0);
53 Integer ncon=1,
bool check=
false)
54 : m_pm(pm), m_maxAllowed(max), m_ready(
false), m_check(check)
57 computeContrib(input);
61 void reset(
Integer ncon=1,
bool check=
false)
67 m_zoomfactor.resize(ncon);
73 template<
typename DataReal>
76 if (!m_check || imb.
size() < m_max.size())
80 computeContrib(input);
83 for (
int i = 0 ; i < m_max.size() ; ++i) {
84 while (m_max[i] > imb[i]*m_sum[i]/partnum) {
95 Integer ncon = m_zoomfactor.size();
97 m_sum[i%ncon] += (
Real)input[i]*multiplier;
99 m_sum[ncon] += input.
size();
104 m_max[i%ncon] =
math::max((
Real)input[i]*multiplier, m_max[i%ncon]);
108 m_zoomfactor[0] = (m_maxAllowed-m_sum[ncon])/(m_sum[0]+1);
113 for (
Integer i = 0 ; i < ncon ; ++i) {
114 m_zoomfactor[i] = (m_maxAllowed-m_sum[ncon])/(m_sum[i]+1);
117 for (
Integer i = 0 ; i < ncon ; ++i) {
118 m_zoomfactor[i] =
math::min(1.0, m_zoomfactor[i]);
127 computeContrib(input);
128 Integer ncon = m_zoomfactor.size();
130 output[i] = (TypeB)((
Real)input[i]*m_zoomfactor[i%ncon])+1;
139 ARCANE_UNUSED(input);
140 ARCANE_UNUSED(output);