1 #include "SALOME_ResourcesCatalog_Parser.hxx"
9 unsigned int ResourceDataToSort::_nbOfNodesWanted = NULL_VALUE;
10 unsigned int ResourceDataToSort::_nbOfProcPerNodeWanted = NULL_VALUE;
11 unsigned int ResourceDataToSort::_CPUFreqMHzWanted = NULL_VALUE;
12 unsigned int ResourceDataToSort::_memInMBWanted = NULL_VALUE;
14 ResourceDataToSort::ResourceDataToSort()
17 ResourceDataToSort::ResourceDataToSort(const string& hostname,
18 unsigned int nbOfNodes,
19 unsigned int nbOfProcPerNode,
20 unsigned int CPUFreqMHz,
21 unsigned int memInMB):
23 _nbOfNodes(nbOfNodes),
24 _nbOfProcPerNode(nbOfProcPerNode),
25 _CPUFreqMHz(CPUFreqMHz),
29 //! Method used by list::sort to sort the resources used in SALOME_ResourcesManager::GetResourcesFitting
30 bool ResourceDataToSort::operator< (const ResourceDataToSort& other) const
32 unsigned int nbPts = GetNumberOfPoints();
33 return nbPts < other.GetNumberOfPoints();
36 unsigned int ResourceDataToSort::GetNumberOfPoints() const
39 //priority 1 : Nb of nodes
41 if (_nbOfNodesWanted != NULL_VALUE)
43 if (_nbOfNodes == _nbOfNodesWanted)
45 else if (_nbOfNodes > _nbOfNodesWanted)
51 //priority 2 : Nb of proc by node
52 if (_nbOfProcPerNodeWanted != NULL_VALUE)
54 if (_nbOfProcPerNode == _nbOfProcPerNodeWanted)
56 else if (_nbOfProcPerNode > _nbOfProcPerNodeWanted)
62 //priority 3 : Cpu freq
63 if (_CPUFreqMHzWanted != NULL_VALUE)
65 if (_CPUFreqMHz == _CPUFreqMHzWanted)
67 else if (_CPUFreqMHz > _CPUFreqMHzWanted)
74 if (_memInMBWanted != NULL_VALUE)
76 if (_memInMB == _memInMBWanted)
78 else if (_memInMB > _memInMBWanted)
87 //! Method used for debug
88 void ResourceDataToSort::Print() const
91 SCRUTE(_nbOfProcPerNode);
96 void ParserResourcesType::Print()
98 MESSAGE("##############*****");
99 MESSAGE("HostName : " << DataForSort._hostName);
100 MESSAGE("Alias : " << Alias);
101 MESSAGE("Protocol : " << Protocol);
102 MESSAGE("Mode : " << Mode);
103 MESSAGE("UserName : " << UserName);
104 MESSAGE("Modules : ");
107 for (std::map<std::string, std::string>::iterator iter = ModulesPath.begin();
108 iter != ModulesPath.end();
111 MESSAGE("Module " << i++ << " called : " << (*iter).first
112 << " with path : " << (*iter).second);
115 MESSAGE("PreReqFilePath : " << PreReqFilePath);
116 MESSAGE("OS : " << OS);