Index: XIOS/trunk/src/client_client_dht_template.hpp
===================================================================
--- XIOS/trunk/src/client_client_dht_template.hpp	(revision 842)
+++ XIOS/trunk/src/client_client_dht_template.hpp	(revision 843)
@@ -44,4 +44,6 @@
 
     const Index2InfoTypeMap& getInfoIndexMap() const {return indexToInfoMappingLevel_; }
+
+    int getNbClient() { return nbClient_; }
 
     /** Default destructor */
@@ -101,4 +103,7 @@
     //! Flag to specify whether data is distributed or not
     bool isDataDistributed_;
+
+    //! Number of client
+    int nbClient_;
 };
 
Index: XIOS/trunk/src/client_client_dht_template_impl.hpp
===================================================================
--- XIOS/trunk/src/client_client_dht_template_impl.hpp	(revision 842)
+++ XIOS/trunk/src/client_client_dht_template_impl.hpp	(revision 843)
@@ -24,6 +24,7 @@
 CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const boost::unordered_map<size_t,T>& indexInfoMap,
                                                         const MPI_Comm& clientIntraComm)
-  : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_()
-{
+  : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0)
+{
+  MPI_Comm_size(clientIntraComm, &nbClient_);
   this->computeMPICommLevel();
   int nbLvl = this->getNbLevel();
@@ -88,5 +89,5 @@
   }
 
-  std::map<int, size_t* > client2ClientIndex;
+  boost::unordered_map<int, size_t* > client2ClientIndex;
   for (int idx = 0; idx < nbClient; ++idx)
   {
@@ -140,6 +141,6 @@
   }
 
-  std::map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,
-                                    iteIndex = client2ClientIndex.end();
+  boost::unordered_map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,
+                                                iteIndex = client2ClientIndex.end();
   for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex)
     sendIndexToClients(itIndex->first, (itIndex->second), sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request);
@@ -213,6 +214,6 @@
   }
 
-  std::map<int,unsigned char*> client2ClientInfoOnReturn;
-  std::map<int,size_t*> client2ClientIndexOnReturn;
+  boost::unordered_map<int,unsigned char*> client2ClientInfoOnReturn;
+  boost::unordered_map<int,size_t*> client2ClientIndexOnReturn;
   currentIndex = 0;
   for (int idx = 0; idx < nbRecvClient; ++idx)
@@ -249,4 +250,5 @@
 
   boost::unordered_map<size_t,InfoType> indexToInfoMapping;
+  indexToInfoMapping.rehash(std::ceil(recvNbIndexCountOnReturn/indexToInfoMapping.max_load_factor()));
   int infoIndex = 0;
   for (int idx = 0; idx < recvNbIndexCountOnReturn; ++idx)
@@ -255,8 +257,8 @@
   }
 
-  indexToInfoMappingLevel_ = (indexToInfoMapping);
+  indexToInfoMappingLevel_.swap(indexToInfoMapping); //indexToInfoMappingLevel_ = (indexToInfoMapping);
   if (0 != recvNbIndexCount) delete [] recvIndexBuff;
-  for (std::map<int,size_t*>::const_iterator it = client2ClientIndex.begin();
-                                            it != client2ClientIndex.end(); ++it)
+  for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin();
+                                                        it != client2ClientIndex.end(); ++it)
       delete [] it->second;
   delete tmpGlobalIndex;
@@ -268,9 +270,9 @@
   }
 
-  for (std::map<int,unsigned char*>::const_iterator it = client2ClientInfoOnReturn.begin();
-                                                    it != client2ClientInfoOnReturn.end(); ++it)
+  for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfoOnReturn.begin();
+                                                               it != client2ClientInfoOnReturn.end(); ++it)
       delete [] it->second;
 
-  for (std::map<int,size_t*>::const_iterator it = client2ClientIndexOnReturn.begin();
+  for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndexOnReturn.begin();
                                             it != client2ClientIndexOnReturn.end(); ++it)
       delete [] it->second;
@@ -342,6 +344,6 @@
   }
 
-  std::map<int, size_t*> client2ClientIndex;
-  std::map<int, unsigned char*> client2ClientInfo;
+  boost::unordered_map<int, size_t*> client2ClientIndex;
+  boost::unordered_map<int, unsigned char*> client2ClientInfo;
   for (int idx = 0; idx < nbClient; ++idx)
   {
@@ -407,10 +409,10 @@
   }
 
-  std::map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,
-                                    iteIndex = client2ClientIndex.end();
+  boost::unordered_map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,
+                                                iteIndex = client2ClientIndex.end();
   for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex)
     sendIndexToClients(itIndex->first, itIndex->second, sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request);
-  std::map<int, unsigned char*>::iterator itbInfo = client2ClientInfo.begin(), itInfo,
-                                          iteInfo = client2ClientInfo.end();
+  boost::unordered_map<int, unsigned char*>::iterator itbInfo = client2ClientInfo.begin(), itInfo,
+                                                      iteInfo = client2ClientInfo.end();
   for (itInfo = itbInfo; itInfo != iteInfo; ++itInfo)
     sendInfoToClients(itInfo->first, itInfo->second, sendNbInfo[itInfo->first-groupRankBegin], commLevel, request);
@@ -420,4 +422,5 @@
 
   boost::unordered_map<size_t,InfoType> indexToInfoMapping;
+  indexToInfoMapping.rehash(std::ceil(currentIndex/indexToInfoMapping.max_load_factor()));
   currentIndex = 0;
   InfoType infoValue;
@@ -440,10 +443,10 @@
     delete [] recvInfoBuff;
   }
-  for (std::map<int,unsigned char*>::const_iterator it = client2ClientInfo.begin();
-                                                    it != client2ClientInfo.end(); ++it)
+  for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfo.begin();
+                                                               it != client2ClientInfo.end(); ++it)
       delete [] it->second;
 
-  for (std::map<int,size_t*>::const_iterator it = client2ClientIndex.begin();
-                                            it != client2ClientIndex.end(); ++it)
+  for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin();
+                                                        it != client2ClientIndex.end(); ++it)
       delete [] it->second;
 
@@ -455,5 +458,5 @@
   }
   else
-    index2InfoMapping_ = (indexToInfoMapping);
+    index2InfoMapping_.swap(indexToInfoMapping); //index2InfoMapping_ = (indexToInfoMapping);
 }
 
Index: XIOS/trunk/src/client_server_mapping.cpp
===================================================================
--- XIOS/trunk/src/client_server_mapping.cpp	(revision 842)
+++ XIOS/trunk/src/client_server_mapping.cpp	(revision 843)
@@ -12,5 +12,5 @@
 
 CClientServerMapping::CClientServerMapping()
-  : indexGlobalOnServer_(), connectedClients_() //, localIndexSend2Server_()
+  : indexGlobalOnServer_()
 {
 }
Index: XIOS/trunk/src/client_server_mapping.hpp
===================================================================
--- XIOS/trunk/src/client_server_mapping.hpp	(revision 842)
+++ XIOS/trunk/src/client_server_mapping.hpp	(revision 843)
@@ -45,7 +45,4 @@
     //! Global index of data on SERVER, which are calculated by client(s)
     GlobalIndexMap indexGlobalOnServer_;
-
-    //!< Number of clients connected to a server
-    std::map<int, int> connectedClients_;
 };
 
Index: XIOS/trunk/src/client_server_mapping_distributed.cpp
===================================================================
--- XIOS/trunk/src/client_server_mapping_distributed.cpp	(revision 842)
+++ XIOS/trunk/src/client_server_mapping_distributed.cpp	(revision 843)
@@ -38,8 +38,25 @@
   ccDHT_->computeIndexInfoMapping(globalIndexOnClient);
   const boost::unordered_map<size_t,int>& infoIndexMap = (ccDHT_->getInfoIndexMap());
-  boost::unordered_map<size_t,int>::const_iterator it = infoIndexMap.begin(), ite = infoIndexMap.end();
-  for (; it != ite; ++it)
+  boost::unordered_map<size_t,int>::const_iterator itb = infoIndexMap.begin(), ite = infoIndexMap.end(), it;
+  std::vector<size_t> nbInfoIndex(ccDHT_->getNbClient(),0);
+
+  for (it = itb; it != ite; ++it)
   {
-    indexGlobalOnServer_[it->second].push_back(it->first);
+    ++nbInfoIndex[it->second];
+  }
+
+  for (int idx = 0; idx < nbInfoIndex.size(); ++idx)
+  {
+    if (0 != nbInfoIndex[idx])
+    {
+      indexGlobalOnServer_[idx].resize(nbInfoIndex[idx]);
+      nbInfoIndex[idx] = 0;
+    }
+  }
+
+  for (it = itb; it != ite; ++it)
+  {
+    indexGlobalOnServer_[it->second][nbInfoIndex[it->second]] = (it->first);
+    ++nbInfoIndex[it->second];
   }
 }
Index: XIOS/trunk/src/distribution_client.cpp
===================================================================
--- XIOS/trunk/src/distribution_client.cpp	(revision 842)
+++ XIOS/trunk/src/distribution_client.cpp	(revision 843)
@@ -17,5 +17,5 @@
    , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_()
    , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_()
-   , isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_()
+   , isDataDistributed_(true), axisNum_(0), domainNum_(0)
    , localDataIndex_(), localMaskIndex_()
    , globalLocalDataSendToServerMap_()
@@ -30,5 +30,5 @@
    , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_()
    , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_()
-   , isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_()
+   , isDataDistributed_(true), axisNum_(0), domainNum_(0)
    , localDataIndex_(), localMaskIndex_()
    , globalLocalDataSendToServerMap_()
@@ -37,5 +37,4 @@
   readDistributionInfo(grid);
   createGlobalIndex();
-//  createGlobalIndexSendToServer();
 }
 
@@ -81,35 +80,4 @@
 }
 
-void CDistributionClient::readDomainIndex(const std::vector<CDomain*>& domList)
-{
-  int domainSize = domList.size();
-  nIndexDomain_.resize(domainSize);
-
-  for (int k = 0; k < domainSize; ++k)
-  {
-    nIndexDomain_[k].resize(2);
-    int ni = domList[k]->ni;
-    int nj = domList[k]->nj;
-    nIndexDomain_[k][0].resize(ni*nj);
-    nIndexDomain_[k][1].resize(ni*nj);
-    nIndexDomain_[k][0] = domList[k]->i_index;
-    nIndexDomain_[k][1] = domList[k]->j_index;
-  }
-}
-
-void CDistributionClient::readAxisIndex(const std::vector<CAxis*>& axisList)
-{
-  int axisSize = axisList.size();
-  nIndexAxis_.resize(axisSize);
-
-  for (int k = 0; k < axisSize; ++k)
-  {
-    int n = axisList[k]->n;
-    nIndexAxis_[k].resize(n);
-    for (int i = 0; i < n; ++i)
-      nIndexAxis_[k](i) = i;
-  }
-}
-
 /*!
   Read information from domain(s) and axis to generate distribution.
@@ -204,7 +172,5 @@
 
       dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); //(2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1;
-//      dataIndex_.at(indexMap_[idx]+1).resize(domList[domIndex]->data_j_index.numElements());
       dataIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->data_j_index);
-//      infoIndex_.at(indexMap_[idx]+1).resize(domList[domIndex]->j_index.numElements());
       infoIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->j_index);
 
@@ -218,7 +184,5 @@
 
       dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue();
-//      dataIndex_.at(indexMap_[idx]).resize(domList[domIndex]->data_i_index.numElements());
       dataIndex_.at(indexMap_[idx]) = &(domList[domIndex]->data_i_index);
-//      infoIndex_.at(indexMap_[idx]).resize(domList[domIndex]->i_index.numElements());
       infoIndex_.at(indexMap_[idx]) = &(domList[domIndex]->i_index);
 
@@ -240,7 +204,5 @@
 
       dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue();
-//      dataIndex_.at(indexMap_[idx]).resize(axisList[axisIndex]->data_index.numElements());
       dataIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->data_index);
-//      infoIndex_.at(indexMap_[idx]).resize(axisList[axisIndex]->index.numElements());
       infoIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->index);
       dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements();
@@ -253,6 +215,4 @@
     ++idx;
   }
-  readDomainIndex(domList);
-  readAxisIndex(axisList);
 }
 
@@ -511,4 +471,5 @@
   localDataIndex_.resize(indexLocalDataOnClientCount);
   localMaskIndex_.resize(indexSend2ServerCount);
+  globalLocalDataSendToServerMap_.rehash(std::ceil(indexSend2ServerCount/globalLocalDataSendToServerMap_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount);
 
   // We need to loop with data index
Index: XIOS/trunk/src/distribution_client.hpp
===================================================================
--- XIOS/trunk/src/distribution_client.hpp	(revision 842)
+++ XIOS/trunk/src/distribution_client.hpp	(revision 843)
@@ -62,6 +62,4 @@
                               const std::vector<CAxis*>& axisList,
                               const CArray<bool,1>& axisDomainOrder);
-    void readDomainIndex(const std::vector<CDomain*>& domList);
-    void readAxisIndex(const std::vector<CAxis*>& axisList);
   private:
     //! Create local index of a domain
@@ -92,6 +90,4 @@
     std::vector<int> nZoomBegin_; //!< Begin index of zoom of each dimension
     std::vector<int> nZoomEnd_; //!< End index of zoom of each dimension
-    std::vector<std::vector<CArray<int,1> > > nIndexDomain_; //!< Local index of each domain dimension (e.x: i_index, j_index)
-    std::vector<CArray<int,1> > nIndexAxis_;
 
     // Data_n_index of domain or axis (For now, axis uses its size as data_n_index
Index: XIOS/trunk/src/server_distribution_description.cpp
===================================================================
--- XIOS/trunk/src/server_distribution_description.cpp	(revision 842)
+++ XIOS/trunk/src/server_distribution_description.cpp	(revision 843)
@@ -117,4 +117,6 @@
            << "Index begin is larger than index end");
 
+  globalIndex_.rehash(std::ceil((indexEnd-indexBegin+1)/globalIndex_.max_load_factor()));
+
   int dim = nGlobal_.size();
   std::vector<int> currentIndex(dim);
@@ -153,5 +155,5 @@
         }
         if ((indexBegin <= globalIndex) && (globalIndex <= indexEnd))
-          globalIndex_.insert(std::make_pair<size_t,int>(globalIndex, idxServer));
+          globalIndex_[globalIndex] = idxServer;
         ++idx;
       }
Index: XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
===================================================================
--- XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 842)
+++ XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 843)
@@ -83,9 +83,12 @@
       {
         size_t srcGridSize = globalIndexSrcGrid[idx].size();
-//        globaIndexWeightFromDestToSource[(it->first)].reserve(srcGridSize);
-        globaIndexWeightFromDestToSource[(it->first)].resize(srcGridSize);
+//        globaIndexWeightFromDestToSource[(it->first)].resize(srcGridSize);
+        DestinationGlobalIndex& tmp = globaIndexWeightFromDestToSource[(it->first)];
+        tmp.resize(srcGridSize);
         for (int i = 0; i < srcGridSize; ++i)
         {
-          globaIndexWeightFromDestToSource[(it->first)][i] = (make_pair(it->second, make_pair(globalIndexSrcGrid[idx][i], currentVecWeight[i])));
+          tmp[i].first = it->second;
+          tmp[i].second = make_pair(globalIndexSrcGrid[idx][i], currentVecWeight[i]);
+//          globaIndexWeightFromDestToSource[(it->first)][i] = (make_pair(it->second, make_pair(globalIndexSrcGrid[idx][i], currentVecWeight[i])));
         }
       }
Index: XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
===================================================================
--- XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 842)
+++ XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 843)
@@ -21,8 +21,11 @@
 class CGenericAlgorithmTransformation
 {
+protected:
+  typedef std::vector<std::pair<int, std::pair<size_t,double> > > DestinationGlobalIndex;
 public:
   // Stupid global index map, it must be replaced by tuple
   // Mapping between global index map of DESTINATION and its local index with pair of global index of SOURCE and weights
-  typedef boost::unordered_map<size_t, std::vector<std::pair<int, std::pair<size_t,double> > > > DestinationIndexMap;
+  typedef boost::unordered_map<size_t, DestinationGlobalIndex> DestinationIndexMap;
+
 protected:
   typedef boost::unordered_map<size_t,int> GlobalLocalMap;
Index: XIOS/trunk/src/transformation/transformation_mapping.cpp
===================================================================
--- XIOS/trunk/src/transformation/transformation_mapping.cpp	(revision 842)
+++ XIOS/trunk/src/transformation/transformation_mapping.cpp	(revision 843)
@@ -31,5 +31,7 @@
 
   // Mapping of global index and pair containing rank and local index
-  CClientClientDHTPairIntInt::Index2InfoTypeMap globalIndexOfServer;
+  CClientClientDHTPairIntInt::Index2InfoTypeMap globalIndexOfClientSrc;
+  globalIndexOfClientSrc.rehash(std::ceil(globalLocalIndexGridSrc.size()/globalIndexOfClientSrc.max_load_factor()));
+
   PairIntInt pairIntInt;
   for (; itIndex != iteIndex; ++itIndex)
@@ -37,8 +39,8 @@
     pairIntInt.first  = clientRank;
     pairIntInt.second = itIndex->second;
-    globalIndexOfServer[itIndex->first] = pairIntInt;
-  }
-
-  gridIndexClientClientMapping_ = new CClientClientDHTPairIntInt(globalIndexOfServer,
+    globalIndexOfClientSrc[itIndex->first] = pairIntInt;
+  }
+
+  gridIndexClientClientMapping_ = new CClientClientDHTPairIntInt(globalIndexOfClientSrc,
                                                                  client->intraComm);
 }
