本文整理匯總了C++中CkVec::quickSort方法的典型用法代碼示例。如果您正苦於以下問題:C++ CkVec::quickSort方法的具體用法?C++ CkVec::quickSort怎麽用?C++ CkVec::quickSort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CkVec
的用法示例。
在下文中一共展示了CkVec::quickSort方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: numUniqNodes
// return -1 when not supported
int numUniqNodes() {
#if 0
if (numNodes != 0) return numNodes;
int n = 0;
for (int i=0; i<CmiNumPes(); i++)
if (nodeIDs[i] > n)
n = nodeIDs[i];
numNodes = n+1;
return numNodes;
#else
if (numNodes > 0) return numNodes; // already calculated
CkVec<int> unodes;
int i;
for (i=0; i<numPes; i++) unodes.push_back(nodeIDs[i]);
//unodes.bubbleSort(0, numPes-1);
unodes.quickSort();
int last = -1;
std::map<int, int> nodemap; // nodeIDs can be out of range of [0,numNodes]
for (i=0; i<numPes; i++) {
if (unodes[i] != last) {
last=unodes[i];
nodemap[unodes[i]] = numNodes;
numNodes++;
}
}
if (numNodes == 0) {
numNodes = CmiNumNodes();
numPes = CmiNumPes();
}
else {
// re-number nodeIDs, which may be necessary e.g. on BlueGene/P
for (i=0; i<numPes; i++) nodeIDs[i] = nodemap[nodeIDs[i]];
CpuTopology::supported = 1;
}
return numNodes;
#endif
}