Changeset 831 for XIOS/trunk/src/node
- Timestamp:
- 03/23/16 16:11:09 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/grid.cpp
r829 r831 459 459 const CClientServerMapping::GlobalIndexMap& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer(); 460 460 461 const std::vector<size_t>& globalIndexSendToServer = clientDistribution_->getGlobalDataIndexSendToServer(); 461 const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); 462 CDistributionClient::GlobalLocalDataMap::const_iterator iteGlobalLocalIndexMap = globalLocalIndexSendToServer.end(), itGlobalLocalIndexMap; 462 463 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; 463 464 itGlobalMap = itbGlobalMap = globalIndexOnServer.begin(); 464 465 iteGlobalMap = globalIndexOnServer.end(); 465 466 466 typedef XIOSBinarySearchWithIndex<size_t> BinarySearch;467 std::vector<int>::iterator itVec;468 int nbGlobalIndex = globalIndexSendToServer.size();469 467 for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 470 468 { 471 469 int serverRank = itGlobalMap->first; 472 470 int indexSize = itGlobalMap->second.size(); 473 std::vector<int> permutIndex(indexSize); 474 XIOSAlgorithms::fillInIndex(indexSize, permutIndex); 475 XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(itGlobalMap->second, permutIndex); 476 BinarySearch binSearch(itGlobalMap->second); 477 for (int i = 0; i < nbGlobalIndex; ++i) 471 const std::vector<size_t>& indexVec = itGlobalMap->second; 472 for (int idx = 0; idx < indexSize; ++idx) 478 473 { 479 if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexSendToServer[i], itVec)) 480 { 481 if (connectedDataSize_.end() == connectedDataSize_.find(serverRank)) 482 connectedDataSize_[serverRank] = 1; 483 else 484 ++connectedDataSize_[serverRank]; 485 } 474 itGlobalLocalIndexMap = globalLocalIndexSendToServer.find(indexVec[idx]); 475 if (iteGlobalLocalIndexMap != itGlobalLocalIndexMap) 476 { 477 if (connectedDataSize_.end() == connectedDataSize_.find(serverRank)) 478 connectedDataSize_[serverRank] = 1; 479 else 480 ++connectedDataSize_[serverRank]; 481 } 486 482 } 487 483 } … … 788 784 list<CArray<size_t,1> > listOutIndex; 789 785 const CClientServerMapping::GlobalIndexMap& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer(); 790 const std::vector<int>& localIndexSendToServer = clientDistribution_->getLocalDataIndexSendToServer(); 791 const std::vector<size_t>& globalIndexSendToServer = clientDistribution_->getGlobalDataIndexSendToServer(); 786 const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); 787 CDistributionClient::GlobalLocalDataMap::const_iterator itIndex = globalLocalIndexSendToServer.begin(), 788 iteIndex = globalLocalIndexSendToServer.end(); 792 789 793 790 if (!doGridHaveDataDistributed()) … … 795 792 if (0 == client->clientRank) 796 793 { 797 CArray<size_t,1> outGlobalIndexOnServer(globalIndexSendToServer.size()); 798 for (int idx = 0; idx < globalIndexSendToServer.size();++idx) 799 outGlobalIndexOnServer(idx) = globalIndexSendToServer[idx]; 800 801 CArray<int,1> outLocalIndexToServer(localIndexSendToServer.size()); 802 for (int idx = 0; idx < localIndexSendToServer.size();++idx) 803 outLocalIndexToServer(idx) = localIndexSendToServer[idx]; 794 int indexSize = globalLocalIndexSendToServer.size(); 795 CArray<size_t,1> outGlobalIndexOnServer(indexSize); 796 CArray<int,1> outLocalIndexToServer(indexSize); 797 for (int idx = 0; itIndex != iteIndex; ++itIndex, ++idx) 798 { 799 outGlobalIndexOnServer(idx) = itIndex->first; 800 outLocalIndexToServer(idx) = itIndex->second; 801 } 804 802 805 803 for (rank = 0; rank < client->serverSize; ++rank) … … 821 819 else 822 820 { 823 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, it bGlobalMap, itGlobalMap;824 it bGlobalMap = itGlobalMap = globalIndexOnServer.begin();821 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap; 822 itGlobalMap = globalIndexOnServer.begin(); 825 823 iteGlobalMap = globalIndexOnServer.end(); 826 824 827 int nbGlobalIndex = globalIndexSendToServer.size();828 825 std::map<int,std::vector<int> >localIndexTmp; 829 826 std::map<int,std::vector<size_t> > globalIndexTmp; 830 831 typedef XIOSBinarySearchWithIndex<size_t> BinarySearch;832 std::vector<int>::iterator itVec;833 827 for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 834 828 { 835 829 int serverRank = itGlobalMap->first; 836 830 int indexSize = itGlobalMap->second.size(); 837 std::vector<int> permutIndex(indexSize); 838 XIOSAlgorithms::fillInIndex(indexSize, permutIndex); 839 XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(itGlobalMap->second, permutIndex); 840 BinarySearch binSearch(itGlobalMap->second); 841 842 for (int i = 0; i < nbGlobalIndex; ++i) 831 const std::vector<size_t>& indexVec = itGlobalMap->second; 832 for (int idx = 0; idx < indexSize; ++idx) 843 833 { 844 if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexSendToServer[i], itVec)) 834 itIndex = globalLocalIndexSendToServer.find(indexVec[idx]); 835 if (iteIndex != itIndex) 845 836 { 846 globalIndexTmp[serverRank].push_back( globalIndexSendToServer[i]);847 localIndexTmp[serverRank].push_back( localIndexSendToServer[i]);837 globalIndexTmp[serverRank].push_back(itIndex->first); 838 localIndexTmp[serverRank].push_back(itIndex->second); 848 839 } 849 840 }
Note: See TracChangeset
for help on using the changeset viewer.