1 // Copyright (C) 2006-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __COMPLEXWEIGHT_HXX__
21 #define __COMPLEXWEIGHT_HXX__
33 ComplexWeight(double elementaryWeight, double loopWeight, int nbCoresByIteration);
34 ComplexWeight(const ComplexWeight& other) {_bootWeight=other._bootWeight; _loopWeight=other._loopWeight; _elementaryWeight=other._elementaryWeight;}
36 std::vector<std::pair<double,int> > getLoopWeight() const {return _loopWeight;}
37 double getSimpleLoopWeight() const;
38 double getElementaryWeight() const {return _elementaryWeight;}
39 double calculateTotalLength(int nbOfCoresAllocated) const;
40 void setDefaultElementary() {setToZero(); setLoopWeight(0.,0);}
41 void setDefaultLoop() {setToZero(); setElementaryWeight(0.);}
42 bool isDefaultValue() const { return ((isDefaultValueElementary()) && (isDefaultValueLoop()));}
43 bool isUnsetLoopWeight() const {return ((*(_loopWeight.begin())).second==0);}
44 bool isUnsetElementaryWeight() const {return (_elementaryWeight==0);}
45 bool hasValidLoopWeight() const { return (((*(_loopWeight.begin())).first>0) && ((*(_loopWeight.begin())).second!=-1));}
46 bool hasValidElementaryWeight() const { return (_elementaryWeight>=0);}
47 void setLoopWeight(double loopWeight, int nbCoresByIteration);
48 void setElementaryWeight(double elementaryWeight) {_bootWeight=false; _elementaryWeight=elementaryWeight;}
49 void setToZero() {_bootWeight=true; unsetElementary(); unsetLoop(); }
50 int getNbCoresConsoLoopMax() const;
51 void max(ComplexWeight &other);
52 ComplexWeight& addWeight(const ComplexWeight *other);
55 // _loopWeight: vect<pair(weight,nbcorePerIteration)>, for first element of vector: nbcorePerIteration<0 -> unset, nbcorePerIteration==0 -> no loopweight
56 std::vector<std::pair<double,int> > _loopWeight;
57 double _elementaryWeight;
59 void unsetLoop() {_loopWeight.clear(); _loopWeight.push_back(std::pair<double,int>(-1.,-1));}
60 void unsetElementary(){_elementaryWeight=-1.;}
61 bool isDefaultValueLoop() const {return ((*(_loopWeight.begin())).second==-1);}
62 bool isDefaultValueElementary() const {return (_elementaryWeight<0);}