Changeset 843 for XIOS/trunk/src/client_client_dht_template_impl.hpp
- Timestamp:
- 04/26/16 16:04:04 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client_client_dht_template_impl.hpp
r839 r843 24 24 CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const boost::unordered_map<size_t,T>& indexInfoMap, 25 25 const MPI_Comm& clientIntraComm) 26 : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_() 27 { 26 : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0) 27 { 28 MPI_Comm_size(clientIntraComm, &nbClient_); 28 29 this->computeMPICommLevel(); 29 30 int nbLvl = this->getNbLevel(); … … 88 89 } 89 90 90 std::map<int, size_t* > client2ClientIndex;91 boost::unordered_map<int, size_t* > client2ClientIndex; 91 92 for (int idx = 0; idx < nbClient; ++idx) 92 93 { … … 140 141 } 141 142 142 std::map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,143 iteIndex = client2ClientIndex.end();143 boost::unordered_map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex, 144 iteIndex = client2ClientIndex.end(); 144 145 for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex) 145 146 sendIndexToClients(itIndex->first, (itIndex->second), sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request); … … 213 214 } 214 215 215 std::map<int,unsigned char*> client2ClientInfoOnReturn;216 std::map<int,size_t*> client2ClientIndexOnReturn;216 boost::unordered_map<int,unsigned char*> client2ClientInfoOnReturn; 217 boost::unordered_map<int,size_t*> client2ClientIndexOnReturn; 217 218 currentIndex = 0; 218 219 for (int idx = 0; idx < nbRecvClient; ++idx) … … 249 250 250 251 boost::unordered_map<size_t,InfoType> indexToInfoMapping; 252 indexToInfoMapping.rehash(std::ceil(recvNbIndexCountOnReturn/indexToInfoMapping.max_load_factor())); 251 253 int infoIndex = 0; 252 254 for (int idx = 0; idx < recvNbIndexCountOnReturn; ++idx) … … 255 257 } 256 258 257 indexToInfoMappingLevel_ = (indexToInfoMapping);259 indexToInfoMappingLevel_.swap(indexToInfoMapping); //indexToInfoMappingLevel_ = (indexToInfoMapping); 258 260 if (0 != recvNbIndexCount) delete [] recvIndexBuff; 259 for ( std::map<int,size_t*>::const_iterator it = client2ClientIndex.begin();260 it != client2ClientIndex.end(); ++it)261 for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin(); 262 it != client2ClientIndex.end(); ++it) 261 263 delete [] it->second; 262 264 delete tmpGlobalIndex; … … 268 270 } 269 271 270 for ( std::map<int,unsigned char*>::const_iterator it = client2ClientInfoOnReturn.begin();271 it != client2ClientInfoOnReturn.end(); ++it)272 for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfoOnReturn.begin(); 273 it != client2ClientInfoOnReturn.end(); ++it) 272 274 delete [] it->second; 273 275 274 for ( std::map<int,size_t*>::const_iterator it = client2ClientIndexOnReturn.begin();276 for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndexOnReturn.begin(); 275 277 it != client2ClientIndexOnReturn.end(); ++it) 276 278 delete [] it->second; … … 342 344 } 343 345 344 std::map<int, size_t*> client2ClientIndex;345 std::map<int, unsigned char*> client2ClientInfo;346 boost::unordered_map<int, size_t*> client2ClientIndex; 347 boost::unordered_map<int, unsigned char*> client2ClientInfo; 346 348 for (int idx = 0; idx < nbClient; ++idx) 347 349 { … … 407 409 } 408 410 409 std::map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,410 iteIndex = client2ClientIndex.end();411 boost::unordered_map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex, 412 iteIndex = client2ClientIndex.end(); 411 413 for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex) 412 414 sendIndexToClients(itIndex->first, itIndex->second, sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request); 413 std::map<int, unsigned char*>::iterator itbInfo = client2ClientInfo.begin(), itInfo,414 iteInfo = client2ClientInfo.end();415 boost::unordered_map<int, unsigned char*>::iterator itbInfo = client2ClientInfo.begin(), itInfo, 416 iteInfo = client2ClientInfo.end(); 415 417 for (itInfo = itbInfo; itInfo != iteInfo; ++itInfo) 416 418 sendInfoToClients(itInfo->first, itInfo->second, sendNbInfo[itInfo->first-groupRankBegin], commLevel, request); … … 420 422 421 423 boost::unordered_map<size_t,InfoType> indexToInfoMapping; 424 indexToInfoMapping.rehash(std::ceil(currentIndex/indexToInfoMapping.max_load_factor())); 422 425 currentIndex = 0; 423 426 InfoType infoValue; … … 440 443 delete [] recvInfoBuff; 441 444 } 442 for ( std::map<int,unsigned char*>::const_iterator it = client2ClientInfo.begin();443 it != client2ClientInfo.end(); ++it)445 for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfo.begin(); 446 it != client2ClientInfo.end(); ++it) 444 447 delete [] it->second; 445 448 446 for ( std::map<int,size_t*>::const_iterator it = client2ClientIndex.begin();447 it != client2ClientIndex.end(); ++it)449 for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin(); 450 it != client2ClientIndex.end(); ++it) 448 451 delete [] it->second; 449 452 … … 455 458 } 456 459 else 457 index2InfoMapping_ = (indexToInfoMapping);460 index2InfoMapping_.swap(indexToInfoMapping); //index2InfoMapping_ = (indexToInfoMapping); 458 461 } 459 462
Note: See TracChangeset
for help on using the changeset viewer.