Changeset 584 for XIOS/trunk/src/client_server_mapping_distributed.cpp
- Timestamp:
- 04/01/15 17:52:53 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client_server_mapping_distributed.cpp
r569 r584 11 11 #include <limits> 12 12 #include <boost/functional/hash.hpp> 13 #include "utils.hpp" 13 14 14 15 namespace xios … … 35 36 \param [in] globalIndexOnClient global index client has 36 37 */ 37 void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient)38 {39 int ssize = globalIndexOnClient.numElements();40 CArray<int,1>* localIndexOnClient = new CArray<int,1>(ssize);41 for (int i = 0; i < ssize; ++i) (*localIndexOnClient)(i) = i;42 43 this->computeServerIndexMapping(globalIndexOnClient, *localIndexOnClient);44 delete localIndexOnClient;45 }38 //void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 39 //{ 40 // int ssize = globalIndexOnClient.numElements(); 41 // CArray<int,1>* localIndexOnClient = new CArray<int,1>(ssize); 42 // for (int i = 0; i < ssize; ++i) (*localIndexOnClient)(i) = i; 43 // 44 // this->computeServerIndexMapping(globalIndexOnClient, *localIndexOnClient); 45 // delete localIndexOnClient; 46 //} 46 47 47 48 /*! … … 50 51 \param [in] localIndexOnClient local index on client 51 52 */ 52 void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 53 const CArray<int,1>& localIndexOnClient) 53 //void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 54 // const CArray<int,1>& localIndexOnClient) 55 void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 54 56 { 55 57 size_t ssize = globalIndexOnClient.numElements(), hashedIndex; … … 59 61 std::map<int, std::vector<size_t> > client2ClientIndexGlobal; 60 62 std::map<int, std::vector<int> > client2ClientIndexServer; 61 std::map<int, std::vector<int> > clientLocalIndex;63 // std::map<int, std::vector<int> > clientLocalIndex; 62 64 63 65 // Number of global index whose mapping server can be found out thanks to index-server mapping … … 66 68 // Number of global index whose mapping server are on other clients 67 69 int nbIndexSendToOthers = 0; 68 boost::hash<size_t> hashGlobalIndex;70 HashXIOS<size_t> hashGlobalIndex; 69 71 for (int i = 0; i < ssize; ++i) 70 72 { … … 79 81 { 80 82 (indexGlobalOnServer_[globalIndexToServerMapping_[globalIndexClient]]).push_back(globalIndexClient); 81 (localIndexSend2Server_[globalIndexToServerMapping_[globalIndexClient]]).push_back(localIndexOnClient(i));83 // (localIndexSend2Server_[globalIndexToServerMapping_[globalIndexClient]]).push_back(localIndexOnClient(i)); 82 84 ++nbIndexAlreadyOnClient; 83 85 } … … 85 87 { 86 88 client2ClientIndexGlobal[indexClient].push_back(globalIndexClient); 87 clientLocalIndex[indexClient].push_back(i);89 // clientLocalIndex[indexClient].push_back(i); 88 90 ++nbIndexSendToOthers; 89 91 } … … 123 125 std::vector<int> demandAlreadyReceived, repondAlreadyReceived; 124 126 int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0; 127 128 resetReceivingRequestAndCount(); 125 129 while ((0 < nbDemandingClient) || (!sendRequest.empty()) || 126 130 (nbIndexServerReceived < nbIndexReceivedFromOthers)) … … 176 180 int* beginBuff = indexServerBuffBegin_[clientSourceRank]; 177 181 std::vector<size_t>& globalIndexTmp = client2ClientIndexGlobal[clientSourceRank]; 178 std::vector<int>& localIndexTmp = clientLocalIndex[clientSourceRank];182 // std::vector<int>& localIndexTmp = clientLocalIndex[clientSourceRank]; 179 183 for (int i = 0; i < count; ++i) 180 184 { 181 185 (indexGlobalOnServer_[*(beginBuff+i)]).push_back(globalIndexTmp[i]); 182 (localIndexSend2Server_[*(beginBuff+i)]).push_back(localIndexOnClient(localIndexTmp[i]));186 // (localIndexSend2Server_[*(beginBuff+i)]).push_back(localIndexOnClient(localIndexTmp[i])); 183 187 } 184 188 nbIndexServerReceived += count; … … 243 247 boost::unordered_map<size_t,int>::const_iterator it = globalIndexOfServer.begin(), 244 248 ite = globalIndexOfServer.end(); 245 boost::hash<size_t> hashGlobalIndex;249 HashXIOS<size_t> hashGlobalIndex; 246 250 for (; it != ite; ++it) 247 251 {
Note: See TracChangeset
for help on using the changeset viewer.