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) {
95 Integer
ncon = m_zoomfactor.size();
96 for( Integer i=0, is=
input.size(); i<is; ++i ) {
97 m_sum[i%
ncon] += (Real)
input[i]*multiplier;
100 m_pm->reduce(Parallel::ReduceSum, m_sum);
103 for( Integer i=0, is=
input.size(); i<is; ++i ) {
104 m_max[i%
ncon] = math::max((Real)
input[i]*multiplier, m_max[i%
ncon]);
106 m_pm->reduce(Parallel::ReduceMax, m_max);
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();
129 for( Integer i=0, is=
input.size(); i<is; ++i )
139 ARCANE_UNUSED(
input);
140 ARCANE_UNUSED(output);