1 #include "SALOME_ResourcesCatalog_Parser.hxx"
8 unsigned int ResourceDataToSort::_nbOfNodesWanted=NULL_VALUE;
9 unsigned int ResourceDataToSort::_nbOfProcPerNodeWanted=NULL_VALUE;
10 unsigned int ResourceDataToSort::_CPUFreqMHzWanted=NULL_VALUE;
11 unsigned int ResourceDataToSort::_memInMBWanted=NULL_VALUE;
13 ResourceDataToSort::ResourceDataToSort()
17 ResourceDataToSort::ResourceDataToSort(const string& hostname,unsigned int nbOfNodes,unsigned int nbOfProcPerNode,unsigned int CPUFreqMHz,unsigned int memInMB):_hostName(hostname),_nbOfNodes(nbOfNodes),_nbOfProcPerNode(nbOfProcPerNode),_CPUFreqMHz(CPUFreqMHz),_memInMB(memInMB)
21 //! Method used by list::sort to sort the resources used in SALOME_ResourcesManager::GetResourcesFitting
22 bool ResourceDataToSort::operator< (const ResourceDataToSort& other) const
24 unsigned int nbPts=GetNumberOfPoints();
25 return nbPts<other.GetNumberOfPoints();
28 unsigned int ResourceDataToSort::GetNumberOfPoints() const
31 //priority 1 : Nb of nodes
32 if(_nbOfNodesWanted!=NULL_VALUE)
34 if(_nbOfNodes==_nbOfNodesWanted)
36 else if(_nbOfNodes>_nbOfNodesWanted)
41 //priority 2 : Nb of proc by node
42 if(_nbOfProcPerNodeWanted!=NULL_VALUE)
44 if(_nbOfProcPerNode==_nbOfProcPerNodeWanted)
46 else if(_nbOfProcPerNode > _nbOfProcPerNodeWanted)
51 //priority 3 : Cpu freq
52 if(_CPUFreqMHzWanted!=NULL_VALUE)
54 if(_CPUFreqMHz==_CPUFreqMHzWanted)
56 else if(_CPUFreqMHz > _CPUFreqMHzWanted)
62 if(_memInMBWanted!=NULL_VALUE)
64 if(_memInMB==_memInMBWanted)
66 else if(_memInMB > _memInMBWanted)
74 //! Method used for debug
75 void ResourceDataToSort::Print() const
77 cout << "Nb of nodes : " << _nbOfNodes << endl;
78 cout << "Nb of proc per node : " << _nbOfProcPerNode << endl;
79 cout << "CPU : " << _CPUFreqMHz << endl;
80 cout << "Mem : " << _memInMB << endl;