36 ComplexWeight::ComplexWeight(
double elementaryWeight,
double loopWeight,
int nbCoresByIteration): _elementaryWeight(elementaryWeight), _bootWeight(false)
38 _loopWeight.push_back(std::pair<double,int>(loopWeight,nbCoresByIteration));
44 throw Exception(
"ComplexWeight::getSimpleLoopWeight : can not get loop weight. Node contain multiple loop weights!");
51 throw Exception(
"ComplexWeight::calculateTotalLength : can not calculate total weight with default value!");
52 double totalWeight(0);
55 for(std::vector< std::pair<double,int> >::const_iterator it=
_loopWeight.begin();it!=
_loopWeight.end();it++)
58 totalWeight+=(*it).first*((double)(*it).second)/((double)nbOfCoresAllocated);
66 int i(0), rankFound(0);
70 if ((*it).second==nbCoresByIteration)
79 _loopWeight.push_back(std::pair<double,int>(loopWeight,nbCoresByIteration));
86 int nbCoresPerShotLoopMax(0);
87 for(std::vector< std::pair<double,int> >::const_iterator it=
_loopWeight.begin();it!=
_loopWeight.end();it++)
88 if ((*it).second>nbCoresPerShotLoopMax)nbCoresPerShotLoopMax=(*it).second;
89 return nbCoresPerShotLoopMax;
96 double allLoopWeight1(0);
97 double allLoopWeight2(0);
98 for(std::vector< std::pair<double,int> >::const_iterator it=
_loopWeight.begin();it!=
_loopWeight.end();it++)
100 if (((*it).first>0) && ((*it).second>0))
101 allLoopWeight1+=(*it).first * (*it).second;
103 for(std::vector< std::pair<double,int> >::const_iterator it=other.
_loopWeight.begin();it!=other.
_loopWeight.end();it++)
105 if (((*it).first>0) && ((*it).second>0))
106 allLoopWeight2+=(*it).first * (*it).second;
108 if (allLoopWeight2>allLoopWeight1)
119 for(std::vector< std::pair<double,int> >::const_iterator it=other->
_loopWeight.begin();it!=other->
_loopWeight.end();it++)
124 if ((*it).second == (*it2).second)
126 if (((*it2).first>=0) && ((*it).first>=0))
127 this->
setLoopWeight((*it2).first+(*it).first, (*it2).second);
128 else if ((*it).first>=0)
134 if ((!found) && ((*it).second!=-1))
bool isDefaultValueElementary() const
std::vector< std::pair< double, int > > _loopWeight
void addWeight(const ComplexWeight *other)
bool isDefaultValueLoop() const
void setLoopWeight(double loopWeight, int nbCoresByIteration)
int getNbCoresConsoLoopMax() const
bool isUnsetElementaryWeight() const
double calculateTotalLength(int nbOfCoresAllocated) const
bool isUnsetLoopWeight() const
bool isDefaultValue() const
void max(ComplexWeight &other)
bool hasValidElementaryWeight() const
double getSimpleLoopWeight() const