Index: XIOS/trunk/src/client_client_dht_template.hpp
===================================================================
--- XIOS/trunk/src/client_client_dht_template.hpp	(revision 866)
+++ XIOS/trunk/src/client_client_dht_template.hpp	(revision 867)
@@ -34,5 +34,5 @@
     typedef T InfoType;
     static const int infoTypeSize = sizeof(InfoType);
-    typedef typename boost::unordered_map<InfoType, std::vector<size_t> > InfoType2IndexMap;
+//    typedef typename boost::unordered_map<InfoType, std::vector<size_t> > InfoType2IndexMap;
     typedef typename boost::unordered_map<size_t,InfoType> Index2InfoTypeMap;
     typedef typename boost::unordered_map<size_t,std::vector<InfoType> > Index2VectorInfoTypeMap;
@@ -47,7 +47,5 @@
     void computeIndexInfoMapping(const CArray<size_t,1>& indices);
 
-//    const Index2InfoTypeMap& getInfoIndexMap() const {return indexToInfoMappingLevel_; }
     const Index2VectorInfoTypeMap& getInfoIndexMap() const {return indexToInfoMappingLevel_; }
-
     int getNbClient() { return nbClient_; }
 
@@ -102,13 +100,13 @@
   protected:
     //! Mapping of global index to the corresponding client
-//    Index2InfoTypeMap index2InfoMapping_;
     Index2VectorInfoTypeMap index2InfoMapping_;
 
     //! A mapping of index to the corresponding information in each level of hierarchy
-//    Index2InfoTypeMap indexToInfoMappingLevel_;
     Index2VectorInfoTypeMap indexToInfoMappingLevel_;
 
+    //! Rank of client to send on each DHT level
     std::vector<std::vector<int> > sendRank_;
 
+    //! Rank of client to receive on each DHT level
     std::vector<std::vector<int> > recvRank_;
 
Index: XIOS/trunk/src/client_client_dht_template_impl.hpp
===================================================================
--- XIOS/trunk/src/client_client_dht_template_impl.hpp	(revision 866)
+++ XIOS/trunk/src/client_client_dht_template_impl.hpp	(revision 867)
@@ -205,5 +205,4 @@
       if (iteIndexToInfoMap != itIndexToInfoMap)
         sendNbIndexOnReturn[idx] += itIndexToInfoMap->second.size();
-//        ++sendNbIndexOnReturn[idx];
     }
     currentIndex += recvNbIndexClientCount[idx];
@@ -294,8 +293,7 @@
     ProcessDHTElement<InfoType>::unpackElement(unpackedInfo, recvInfoBuffOnReturn, infoIndex);
     indexToInfoMapping[recvIndexBuffOnReturn[idx]].push_back(unpackedInfo);
-//    ProcessDHTElement<InfoType>::unpackElement(indexToInfoMapping[recvIndexBuffOnReturn[idx]], recvInfoBuffOnReturn, infoIndex);
-  }
-
-  indexToInfoMappingLevel_.swap(indexToInfoMapping); //indexToInfoMappingLevel_ = (indexToInfoMapping);
+  }
+
+  indexToInfoMappingLevel_.swap(indexToInfoMapping);
   if (0 != recvNbIndexCount) delete [] recvIndexBuff;
   for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin();
@@ -318,233 +316,4 @@
       delete [] it->second;
 }
-
-///*!
-//    Compute mapping between indices and information corresponding to these indices
-//for each level of hierarchical DHT. Recursive function
-//   \param [in] indices indices a proc has
-//   \param [in] commLevel communicator of current level
-//   \param [in] level current level
-//*/
-//template<typename T, typename H>
-//void CClientClientDHTTemplate<T,H>::computeIndexInfoMappingLevel(const CArray<size_t,1>& indices,
-//                                                                 const MPI_Comm& commLevel,
-//                                                                 int level)
-//{
-//  int clientRank;
-//  MPI_Comm_rank(commLevel,&clientRank);
-//  int groupRankBegin = this->getGroupBegin()[level];
-//  int nbClient = this->getNbInGroup()[level];
-//  std::vector<size_t> hashedIndex;
-//  computeHashIndex(hashedIndex, nbClient);
-//
-//  size_t ssize = indices.numElements(), hashedVal;
-//
-//  std::vector<size_t>::const_iterator itbClientHash = hashedIndex.begin(), itClientHash,
-//                                      iteClientHash = hashedIndex.end();
-//  std::vector<int> sendBuff(nbClient,0);
-//  std::vector<int> sendNbIndexBuff(nbClient,0);
-//
-//  // Number of global index whose mapping server are on other clients
-//  int nbIndexToSend = 0;
-//  size_t index;
-//  HashXIOS<size_t> hashGlobalIndex;
-//  for (int i = 0; i < ssize; ++i)
-//  {
-//    index = indices(i);
-//    hashedVal  = hashGlobalIndex(index);
-//    itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal);
-//    int indexClient = std::distance(itbClientHash, itClientHash)-1;
-//    ++sendNbIndexBuff[indexClient];
-//  }
-//
-//  boost::unordered_map<int, size_t* > client2ClientIndex;
-//  for (int idx = 0; idx < nbClient; ++idx)
-//  {
-//    if (0 != sendNbIndexBuff[idx])
-//    {
-//      client2ClientIndex[idx+groupRankBegin] = new unsigned long [sendNbIndexBuff[idx]];
-//      nbIndexToSend += sendNbIndexBuff[idx];
-//      sendBuff[idx] = 1;
-//      sendNbIndexBuff[idx] = 0;
-//    }
-//  }
-//
-//  for (int i = 0; i < ssize; ++i)
-//  {
-//    index = indices(i);
-//    hashedVal  = hashGlobalIndex(index);
-//    itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal);
-//    {
-//      int indexClient = std::distance(itbClientHash, itClientHash)-1;
-//      {
-//        client2ClientIndex[indexClient+groupRankBegin][sendNbIndexBuff[indexClient]] = index;
-//        ++sendNbIndexBuff[indexClient];
-//      }
-//    }
-//  }
-//
-//  std::vector<int> recvRankClient, recvNbIndexClientCount;
-//  sendRecvRank(level, sendBuff, sendNbIndexBuff,
-//               recvRankClient, recvNbIndexClientCount);
-//
-//  int recvNbIndexCount = 0;
-//  for (int idx = 0; idx < recvNbIndexClientCount.size(); ++idx)
-//    recvNbIndexCount += recvNbIndexClientCount[idx];
-//
-//  unsigned long* recvIndexBuff;
-//  if (0 != recvNbIndexCount)
-//    recvIndexBuff = new unsigned long[recvNbIndexCount];
-//
-//  std::vector<MPI_Request> request;
-//  std::vector<int>::iterator itbRecvIndex = recvRankClient.begin(), itRecvIndex,
-//                             iteRecvIndex = recvRankClient.end(),
-//                           itbRecvNbIndex = recvNbIndexClientCount.begin(),
-//                           itRecvNbIndex;
-//  int currentIndex = 0;
-//  int nbRecvClient = recvRankClient.size();
-//  for (int idx = 0; idx < nbRecvClient; ++idx)
-//  {
-//    if (0 != recvNbIndexClientCount[idx])
-//      recvIndexFromClients(recvRankClient[idx], recvIndexBuff+currentIndex, recvNbIndexClientCount[idx], commLevel, request);
-//    currentIndex += recvNbIndexClientCount[idx];
-//  }
-//
-//  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::vector<MPI_Status> status(request.size());
-//  MPI_Waitall(request.size(), &request[0], &status[0]);
-//
-//  CArray<size_t,1>* tmpGlobalIndex;
-//  if (0 != recvNbIndexCount)
-//    tmpGlobalIndex = new CArray<size_t,1>(recvIndexBuff, shape(recvNbIndexCount), neverDeleteData);
-//  else
-//    tmpGlobalIndex = new CArray<size_t,1>();
-//
-//  // OK, we go to the next level and do something recursive
-//  if (0 < level)
-//  {
-//    --level;
-//    computeIndexInfoMappingLevel(*tmpGlobalIndex, this->internalComm_, level);
-//  }
-//  else // Now, we are in the last level where necessary mappings are.
-//    indexToInfoMappingLevel_= (index2InfoMapping_);
-//
-//  typename Index2InfoTypeMap::const_iterator iteIndexToInfoMap = indexToInfoMappingLevel_.end(), itIndexToInfoMap;
-//  std::vector<int> sendNbIndexOnReturn(nbRecvClient,0);
-//  currentIndex = 0;
-//  for (int idx = 0; idx < nbRecvClient; ++idx)
-//  {
-//    for (int i = 0; i < recvNbIndexClientCount[idx]; ++i)
-//    {
-//      itIndexToInfoMap = indexToInfoMappingLevel_.find(*(recvIndexBuff+currentIndex+i));
-//      if (iteIndexToInfoMap != itIndexToInfoMap) ++sendNbIndexOnReturn[idx];
-//    }
-//    currentIndex += recvNbIndexClientCount[idx];
-//  }
-//
-//  std::vector<int> recvRankOnReturn(client2ClientIndex.size());
-//  std::vector<int> recvNbIndexOnReturn(client2ClientIndex.size(),0);
-//  int indexIndex = 0;
-//  for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex, ++indexIndex)
-//  {
-//    recvRankOnReturn[indexIndex] = itIndex->first;
-//  }
-//  sendRecvOnReturn(recvRankClient, sendNbIndexOnReturn,
-//                   recvRankOnReturn, recvNbIndexOnReturn);
-//
-//  int recvNbIndexCountOnReturn = 0;
-//  for (int idx = 0; idx < recvRankOnReturn.size(); ++idx)
-//    recvNbIndexCountOnReturn += recvNbIndexOnReturn[idx];
-//
-//  unsigned long* recvIndexBuffOnReturn;
-//  unsigned char* recvInfoBuffOnReturn;
-//  if (0 != recvNbIndexCountOnReturn)
-//  {
-//    recvIndexBuffOnReturn = new unsigned long[recvNbIndexCountOnReturn];
-//    recvInfoBuffOnReturn = new unsigned char[recvNbIndexCountOnReturn*ProcessDHTElement<InfoType>::typeSize()];
-//  }
-//
-//  std::vector<MPI_Request> requestOnReturn;
-//  currentIndex = 0;
-//  for (int idx = 0; idx < recvRankOnReturn.size(); ++idx)
-//  {
-//    if (0 != recvNbIndexOnReturn[idx])
-//    {
-//      recvIndexFromClients(recvRankOnReturn[idx], recvIndexBuffOnReturn+currentIndex, recvNbIndexOnReturn[idx], commLevel, requestOnReturn);
-//      recvInfoFromClients(recvRankOnReturn[idx],
-//                          recvInfoBuffOnReturn+currentIndex*ProcessDHTElement<InfoType>::typeSize(),
-//                          recvNbIndexOnReturn[idx]*ProcessDHTElement<InfoType>::typeSize(),
-//                          commLevel, requestOnReturn);
-//    }
-//    currentIndex += recvNbIndexOnReturn[idx];
-//  }
-//
-//  boost::unordered_map<int,unsigned char*> client2ClientInfoOnReturn;
-//  boost::unordered_map<int,size_t*> client2ClientIndexOnReturn;
-//  currentIndex = 0;
-//  for (int idx = 0; idx < nbRecvClient; ++idx)
-//  {
-//    if (0 != sendNbIndexOnReturn[idx])
-//    {
-//      int rank = recvRankClient[idx];
-//      client2ClientIndexOnReturn[rank] = new unsigned long [sendNbIndexOnReturn[idx]];
-//      client2ClientInfoOnReturn[rank] = new unsigned char [sendNbIndexOnReturn[idx]*ProcessDHTElement<InfoType>::typeSize()];
-//      unsigned char* tmpInfoPtr = client2ClientInfoOnReturn[rank];
-//      int infoIndex = 0;
-//      int nb = 0;
-//      for (int i = 0; i < recvNbIndexClientCount[idx]; ++i)
-//      {
-//        itIndexToInfoMap = indexToInfoMappingLevel_.find(*(recvIndexBuff+currentIndex+i));
-//        if (iteIndexToInfoMap != itIndexToInfoMap)
-//        {
-//          client2ClientIndexOnReturn[rank][nb] = itIndexToInfoMap->first;
-//          ProcessDHTElement<InfoType>::packElement(itIndexToInfoMap->second, tmpInfoPtr, infoIndex);
-//          ++nb;
-//        }
-//      }
-//
-//      sendIndexToClients(rank, client2ClientIndexOnReturn[rank],
-//                         sendNbIndexOnReturn[idx], commLevel, requestOnReturn);
-//      sendInfoToClients(rank, client2ClientInfoOnReturn[rank],
-//                        sendNbIndexOnReturn[idx]*ProcessDHTElement<InfoType>::typeSize(), commLevel, requestOnReturn);
-//    }
-//    currentIndex += recvNbIndexClientCount[idx];
-//  }
-//
-//  std::vector<MPI_Status> statusOnReturn(requestOnReturn.size());
-//  MPI_Waitall(requestOnReturn.size(), &requestOnReturn[0], &statusOnReturn[0]);
-//
-//  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)
-//  {
-//    ProcessDHTElement<InfoType>::unpackElement(indexToInfoMapping[recvIndexBuffOnReturn[idx]], recvInfoBuffOnReturn, infoIndex);
-//  }
-//
-//  indexToInfoMappingLevel_.swap(indexToInfoMapping); //indexToInfoMappingLevel_ = (indexToInfoMapping);
-//  if (0 != recvNbIndexCount) delete [] recvIndexBuff;
-//  for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin();
-//                                                        it != client2ClientIndex.end(); ++it)
-//      delete [] it->second;
-//  delete tmpGlobalIndex;
-//
-//  if (0 != recvNbIndexCountOnReturn)
-//  {
-//    delete [] recvIndexBuffOnReturn;
-//    delete [] recvInfoBuffOnReturn;
-//  }
-//
-//  for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfoOnReturn.begin();
-//                                                               it != client2ClientInfoOnReturn.end(); ++it)
-//      delete [] it->second;
-//
-//  for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndexOnReturn.begin();
-//                                            it != client2ClientIndexOnReturn.end(); ++it)
-//      delete [] it->second;
-//}
 
 /*!
@@ -689,23 +458,4 @@
   Index2VectorInfoTypeMap indexToInfoMapping;
   indexToInfoMapping.rehash(std::ceil(currentIndex/indexToInfoMapping.max_load_factor()));
-//  boost::unordered_map<size_t,int> tmpInfoSize;
-//  tmpInfoSize.rehash(std::ceil(currentIndex/tmpInfoSize.max_load_factor()));
-//  currentIndex = 0;
-//  for (int idx = 0; idx < nbRecvClient; ++idx)
-//  {
-//    int count = recvNbIndexClientCount[idx];
-//    for (int i = 0; i < count; ++i)
-//    {
-//      ++tmpInfoSize[*(recvIndexBuff+currentIndex+i)];
-//    }
-//    currentIndex += count;
-//  }
-//
-//  for (boost::unordered_map<size_t,int>::iterator it=tmpInfoSize.begin(); it != tmpInfoSize.end(); ++it)
-//  {
-//    indexToInfoMapping[it->first].resize(it->second);
-//    it->second = 0;
-//  }
-
   currentIndex = 0;
   InfoType infoValue;
@@ -714,12 +464,9 @@
   for (int idx = 0; idx < nbRecvClient; ++idx)
   {
-//    size_t index;
+    size_t index;
     int count = recvNbIndexClientCount[idx];
     for (int i = 0; i < count; ++i)
     {
-//      index = *(recvIndexBuff+currentIndex+i);
       ProcessDHTElement<InfoType>::unpackElement(infoValue, infoBuff, infoIndex);
-//      ProcessDHTElement<InfoType>::unpackElement(indexToInfoMapping[index][tmpInfoSize[index]], infoBuff, infoIndex);
-//      ++tmpInfoSize[index];
       indexToInfoMapping[*(recvIndexBuff+currentIndex+i)].push_back(infoValue);
     }
@@ -749,166 +496,4 @@
     index2InfoMapping_.swap(indexToInfoMapping);
 }
-
-///*!
-//  Compute distribution of global index for servers
-//  Each client already holds a piece of information and its associated index.
-//This information will be redistributed among processes by projecting indices into size_t space,
-//the corresponding information will be also distributed on size_t space.
-//After the redistribution, each client holds rearranged index and its corresponding information.
-//  \param [in] indexInfoMap index and its corresponding info (usually server index)
-//  \param [in] commLevel communicator of current level
-//  \param [in] level current level
-//*/
-//template<typename T, typename H>
-//void CClientClientDHTTemplate<T,H>::computeDistributedIndex(const boost::unordered_map<size_t,T>& indexInfoMap,
-//                                                            const MPI_Comm& commLevel,
-//                                                            int level)
-//{
-//  int clientRank;
-//  MPI_Comm_rank(commLevel,&clientRank);
-//  computeSendRecvRank(level, clientRank);
-//
-//  int groupRankBegin = this->getGroupBegin()[level];
-//  int nbClient = this->getNbInGroup()[level];
-//  std::vector<size_t> hashedIndex;
-//  computeHashIndex(hashedIndex, nbClient);
-//
-//  std::vector<int> sendBuff(nbClient,0);
-//  std::vector<int> sendNbIndexBuff(nbClient,0);
-//  std::vector<size_t>::const_iterator itbClientHash = hashedIndex.begin(), itClientHash,
-//                                      iteClientHash = hashedIndex.end();
-//  typename boost::unordered_map<size_t,InfoType>::const_iterator itb = indexInfoMap.begin(),it,
-//                                                                 ite = indexInfoMap.end();
-//  HashXIOS<size_t> hashGlobalIndex;
-//
-//  // Compute size of sending and receving buffer
-//  for (it = itb; it != ite; ++it)
-//  {
-//    size_t hashIndex = hashGlobalIndex(it->first);
-//    itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex);
-//    {
-//      int indexClient = std::distance(itbClientHash, itClientHash)-1;
-//      {
-//        ++sendNbIndexBuff[indexClient];
-//      }
-//    }
-//  }
-//
-//  boost::unordered_map<int, size_t*> client2ClientIndex;
-//  boost::unordered_map<int, unsigned char*> client2ClientInfo;
-//  for (int idx = 0; idx < nbClient; ++idx)
-//  {
-//    if (0 != sendNbIndexBuff[idx])
-//    {
-//      client2ClientIndex[idx+groupRankBegin] = new unsigned long [sendNbIndexBuff[idx]];
-//      client2ClientInfo[idx+groupRankBegin] = new unsigned char [sendNbIndexBuff[idx]*ProcessDHTElement<InfoType>::typeSize()];
-//      sendNbIndexBuff[idx] = 0;
-//      sendBuff[idx] = 1;
-//    }
-//  }
-//
-//  std::vector<int> sendNbInfo(nbClient,0);
-//  for (it = itb; it != ite; ++it)
-//  {
-//    size_t hashIndex = hashGlobalIndex(it->first);
-//    itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex);
-//    {
-//      int indexClient = std::distance(itbClientHash, itClientHash)-1;
-//      {
-//        client2ClientIndex[indexClient + groupRankBegin][sendNbIndexBuff[indexClient]] = it->first;;
-//        ProcessDHTElement<InfoType>::packElement(it->second, client2ClientInfo[indexClient + groupRankBegin], sendNbInfo[indexClient]);
-//        ++sendNbIndexBuff[indexClient];
-//      }
-//    }
-//  }
-//
-//  // Calculate from how many clients each client receive message.
-//  // Calculate size of buffer for receiving message
-//  std::vector<int> recvRankClient, recvNbIndexClientCount;
-//  sendRecvRank(level, sendBuff, sendNbIndexBuff,
-//               recvRankClient, recvNbIndexClientCount);
-//
-//  int recvNbIndexCount = 0;
-//  for (int idx = 0; idx < recvNbIndexClientCount.size(); ++idx)
-//    recvNbIndexCount += recvNbIndexClientCount[idx];
-//
-//  unsigned long* recvIndexBuff;
-//  unsigned char* recvInfoBuff;
-//  if (0 != recvNbIndexCount)
-//  {
-//    recvIndexBuff = new unsigned long[recvNbIndexCount];
-//    recvInfoBuff = new unsigned char[recvNbIndexCount*ProcessDHTElement<InfoType>::typeSize()];
-//  }
-//
-//  // If a client holds information about index and the corresponding which don't belong to it,
-//  // it will send a message to the correct clients.
-//  // Contents of the message are index and its corresponding informatioin
-//  std::vector<MPI_Request> request;
-//  int currentIndex = 0;
-//  int nbRecvClient = recvRankClient.size();
-//  for (int idx = 0; idx < nbRecvClient; ++idx)
-//  {
-//    if (0 != recvNbIndexClientCount[idx])
-//    {
-//      recvIndexFromClients(recvRankClient[idx], recvIndexBuff+currentIndex, recvNbIndexClientCount[idx], commLevel, request);
-//      recvInfoFromClients(recvRankClient[idx],
-//                          recvInfoBuff+currentIndex*ProcessDHTElement<InfoType>::typeSize(),
-//                          recvNbIndexClientCount[idx]*ProcessDHTElement<InfoType>::typeSize(),
-//                          commLevel, request);
-//    }
-//    currentIndex += recvNbIndexClientCount[idx];
-//  }
-//
-//  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);
-//  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);
-//
-//  std::vector<MPI_Status> status(request.size());
-//  MPI_Waitall(request.size(), &request[0], &status[0]);
-//
-//  boost::unordered_map<size_t,InfoType> indexToInfoMapping;
-//  indexToInfoMapping.rehash(std::ceil(currentIndex/indexToInfoMapping.max_load_factor()));
-//  currentIndex = 0;
-//  InfoType infoValue;
-//  int infoIndex = 0;
-//  unsigned char* infoBuff = recvInfoBuff;
-//  for (int idx = 0; idx < nbRecvClient; ++idx)
-//  {
-//    int count = recvNbIndexClientCount[idx];
-//    for (int i = 0; i < count; ++i)
-//    {
-//      ProcessDHTElement<InfoType>::unpackElement(infoValue, infoBuff, infoIndex);
-//      indexToInfoMapping[*(recvIndexBuff+currentIndex+i)] = infoValue;
-//    }
-//    currentIndex += count;
-//  }
-//
-//  if (0 != recvNbIndexCount)
-//  {
-//    delete [] recvIndexBuff;
-//    delete [] recvInfoBuff;
-//  }
-//  for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfo.begin();
-//                                                               it != client2ClientInfo.end(); ++it)
-//      delete [] it->second;
-//
-//  for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin();
-//                                                        it != client2ClientIndex.end(); ++it)
-//      delete [] it->second;
-//
-//  // Ok, now do something recursive
-//  if (0 < level)
-//  {
-//    --level;
-//    computeDistributedIndex(indexToInfoMapping, this->internalComm_, level);
-//  }
-//  else
-//    index2InfoMapping_.swap(indexToInfoMapping); //index2InfoMapping_ = (indexToInfoMapping);
-//}
 
 /*!
@@ -1107,5 +692,5 @@
   {
     MPI_Irecv(&recvBuff[0]+2*idx, 2, MPI_INT,
-              recvRank[idx], MPI_DHT_INDEX_1, this->internalComm_, &request[nRequest]);
+              recvRank[idx], MPI_DHT_INDEX_0, this->internalComm_, &request[nRequest]);
     ++nRequest;
   }
@@ -1121,5 +706,5 @@
   {
     MPI_Isend(&sendBuff[idx*2], 2, MPI_INT,
-              sendRank[idx], MPI_DHT_INDEX_1, this->internalComm_, &request[nRequest]);
+              sendRank[idx], MPI_DHT_INDEX_0, this->internalComm_, &request[nRequest]);
     ++nRequest;
   }
Index: XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp
===================================================================
--- XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp	(revision 866)
+++ XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp	(revision 867)
@@ -274,6 +274,4 @@
         transPosition_[idx].resize(1);
         transPosition_[idx][0] = (dom->i_index)(idx) + niGlobDom * (dom->j_index)(idx);
-//        transPosition_[idx][0] = (dom->i_index)(idx);
-//        transPosition_[idx][1] = (dom->j_index)(idx);
       }
     }
Index: XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp
===================================================================
--- XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp	(revision 866)
+++ XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp	(revision 867)
@@ -14,4 +14,5 @@
 #include "context_client.hpp"
 #include "client_client_dht_template.hpp"
+#include "axis.hpp"
 
 namespace xios {
@@ -32,4 +33,13 @@
 }
 
+void CAxisAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
+{
+}
+
+/*!
+  Compute global index of axis on different processes
+  \param [in] globalAxisIndex global index of axis source
+  \param [out] globalAxisIndexOnProc processes which contain the corresponding global index of axis source
+*/
 void CAxisAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex,
                                                               CClientClientDHTInt::Index2VectorInfoTypeMap& globalAxisIndexOnProc)
@@ -49,5 +59,4 @@
     globalIndex2ProcRank[globalIndex].resize(1);
     globalIndex2ProcRank[globalIndex][0] = clientRank;
-//    globalIndex2ProcRank[globalIndex].push_back(clientRank);
   }
 
@@ -55,191 +64,6 @@
   dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex);
 
-//  std::vector<int> countIndex(clientSize,0);
-//  const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
   globalAxisIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
-//
-//  CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it,
-//                                                               ite = computedGlobalIndexOnProc.end();
-//  for (it = itb; it != ite; ++it)
-//  {
-//    const std::vector<int>& procList = it->second;
-//    for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]];
-//  }
-//
-//  globalAxisIndexOnProc.rehash(std::ceil(clientSize/globalAxisIndexOnProc.max_load_factor()));
-//  for (int idx = 0; idx < clientSize; ++idx)
-//  {
-//    if (0 != countIndex[idx])
-//    {
-//      globalAxisIndexOnProc[idx].resize(countIndex[idx]);
-//      countIndex[idx] = 0;
-//    }
-//  }
-//
-//  for (it = itb; it != ite; ++it)
-//  {
-//    const std::vector<int>& procList = it->second;
-//    for (int idx = 0; idx < procList.size(); ++idx)
-//    {
-//      globalAxisIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first;
-//      ++countIndex[procList[idx]];
-//    }
-//  }
 }
 
-void CAxisAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
 }
-
-/*!
-  Compute an array of global index from a global index on a axis
-  \param[in] axisDestGlobalIndex global index on an axis of destination grid
-  \param[in] axisSrcGlobalIndex global index on an axis of source grid (which are needed by one index on axis destination)
-  \param[in] axisPositionInGrid position of the axis in the grid
-  \param[in] gridDestGlobalDim dimension size of destination grid (it should share the same size for all dimension, maybe except the axis on which transformation is performed)
-  \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s), this array is already acsending sorted
-  \param[in/out] globalIndexDestGrid array of global index (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated
-  \param[in/out] globalIndexSrcGrid array of global index of source grid (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated
-*/
-void CAxisAlgorithmTransformation::computeGlobalGridIndexFromGlobalIndexElement(int axisDestGlobalIndex,
-                                                                          const std::vector<int>& axisSrcGlobalIndex,
-                                                                          const std::vector<int>& destGlobalIndexPositionInGrid,
-                                                                          int axisPositionInGrid,
-                                                                          const std::vector<int>& gridDestGlobalDim,
-                                                                          const std::vector<int>& gridSrcGlobalDim,
-                                                                          const GlobalLocalMap& globalLocalIndexDestSendToServerMap,
-                                                                          std::vector<std::pair<size_t,int> >& globalLocalIndexDestMap,
-                                                                          std::vector<std::vector<size_t> >& globalIndexSrcGrid)
-{
-  bool hasDestGlobalIndexPos = !destGlobalIndexPositionInGrid.empty();
-  int globalDim = gridDestGlobalDim.size();
-
-  std::vector<size_t> currentIndex(globalDim);
-  std::vector<int> gridAxisGlobalDim(globalDim);
-  std::vector<int> idxLoop(globalDim, 0);
-
-  size_t ssize = 1, idx = 0, realGlobalIndexSize = 0;
-  for (int i = 0; i< globalDim; ++i)
-  {
-    if (axisPositionInGrid == i) gridAxisGlobalDim[i] = 1;
-    else
-    {
-      if (!hasDestGlobalIndexPos) gridAxisGlobalDim[i] = gridDestGlobalDim[i];
-      else gridAxisGlobalDim[i] = 1;
-    }
-    ssize *= gridAxisGlobalDim[i];
-  }
-
-  GlobalLocalMap::const_iterator iteArr = globalLocalIndexDestSendToServerMap.end(), it;
-
-  while (idx < ssize)
-  {
-    for (int i = 0; i < globalDim-1; ++i)
-    {
-      if (idxLoop[i] == gridAxisGlobalDim[i])
-      {
-        idxLoop[i] = 0;
-        ++idxLoop[i+1];
-      }
-    }
-
-    int j = 0;
-    for (int i = 0; i < globalDim; ++i)
-    {
-      if (!hasDestGlobalIndexPos) currentIndex[i] = idxLoop[i];
-      else
-      {
-        if (axisPositionInGrid == i) currentIndex[i] = axisDestGlobalIndex;
-        else
-        {
-          currentIndex[i] = destGlobalIndexPositionInGrid[j];
-          ++j;
-        }
-      }
-    }
-
-    currentIndex[axisPositionInGrid] = axisDestGlobalIndex;
-
-    size_t globIndex = currentIndex[0];
-    size_t mulDim = 1;
-    for (int k = 1; k < globalDim; ++k)
-    {
-      mulDim *= gridDestGlobalDim[k-1];
-      globIndex += (currentIndex[k])*mulDim;
-    }
-
-    if (iteArr != globalLocalIndexDestSendToServerMap.find(globIndex)) ++realGlobalIndexSize;
-    ++idxLoop[0];
-    ++idx;
-  }
-
-  if (globalLocalIndexDestMap.size() != realGlobalIndexSize)
-    globalLocalIndexDestMap.resize(realGlobalIndexSize);
-
-  if (realGlobalIndexSize != globalIndexSrcGrid.size()) globalIndexSrcGrid.resize(realGlobalIndexSize);
-  for (int i = 0; i < globalIndexSrcGrid.size(); ++i)
-    if (globalIndexSrcGrid[i].size() != axisSrcGlobalIndex.size())
-      globalIndexSrcGrid[i].resize(axisSrcGlobalIndex.size());
-
-  size_t realGlobalIndex = 0;
-  idx = 0;
-  idxLoop.assign(globalDim, 0);
-  while (idx < ssize)
-  {
-    for (int i = 0; i < globalDim-1; ++i)
-    {
-      if (idxLoop[i] == gridAxisGlobalDim[i])
-      {
-        idxLoop[i] = 0;
-        ++idxLoop[i+1];
-      }
-    }
-
-    int j = 0;
-    for (int i = 0; i < globalDim; ++i)
-    {
-      if (!hasDestGlobalIndexPos) currentIndex[i] = idxLoop[i];
-      else
-      {
-        if (axisPositionInGrid == i) currentIndex[i] = axisDestGlobalIndex;
-        else
-        {
-          currentIndex[i] = destGlobalIndexPositionInGrid[j];
-          ++j;
-        }
-      }
-    }
-    currentIndex[axisPositionInGrid] = axisDestGlobalIndex;
-
-    size_t globIndex = currentIndex[0];
-    size_t mulDim = 1;
-    for (int k = 1; k < globalDim; ++k)
-    {
-      mulDim *= gridDestGlobalDim[k-1];
-      globIndex += (currentIndex[k])*mulDim;
-    }
-
-    it = globalLocalIndexDestSendToServerMap.find(globIndex);
-    if (iteArr != it)
-    {
-      globalLocalIndexDestMap[realGlobalIndex] = (std::make_pair(it->first,it->second));
-      for (int i = 0; i < globalIndexSrcGrid[realGlobalIndex].size(); ++i)
-      {
-        currentIndex[axisPositionInGrid] = axisSrcGlobalIndex[i];
-        globIndex = currentIndex[0];
-        mulDim = 1;
-        for (int k = 1; k < globalDim; ++k)
-        {
-          mulDim *= gridDestGlobalDim[k-1];
-          globIndex += (currentIndex[k])*mulDim;
-        }
-        (globalIndexSrcGrid[realGlobalIndex])[i] = globIndex;
-      }
-      ++realGlobalIndex;
-    }
-
-    ++idxLoop[0];
-    ++idx;
-  }
-}
-}
Index: XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp
===================================================================
--- XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp	(revision 866)
+++ XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp	(revision 867)
@@ -11,8 +11,8 @@
 
 #include "generic_algorithm_transformation.hpp"
-#include "axis.hpp"
 
 namespace xios {
 
+class CAxis;
 /*!
   \class CAxisAlgorithmTransformation
@@ -27,18 +27,8 @@
 
 protected:
-  virtual void computeGlobalGridIndexFromGlobalIndexElement(int axisDestGlobalIndex,
-                                                        const std::vector<int>& axisSrcGlobalIndex,
-                                                        const std::vector<int>& destGlobalIndexPositionInGrid,
-                                                        int axisPositionInGrid,
-                                                        const std::vector<int>& gridDestGlobalDim,
-                                                        const std::vector<int>& gridSrcGlobalDim,
-                                                        const GlobalLocalMap& globalLocalIndexDestSendToServerMap,
-                                                        std::vector<std::pair<size_t,int> >& globalLocalIndexDestMap,
-                                                        std::vector<std::vector<size_t> >& globalIndexSrcGrid);
-
   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
 
-  void computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex,
-                                  CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc);
+  virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex,
+                                          CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc);
 
 protected:
Index: XIOS/trunk/src/transformation/domain_algorithm_transformation.cpp
===================================================================
--- XIOS/trunk/src/transformation/domain_algorithm_transformation.cpp	(revision 866)
+++ XIOS/trunk/src/transformation/domain_algorithm_transformation.cpp	(revision 867)
@@ -28,4 +28,9 @@
 }
 
+/*!
+  Compute global index of domain on different processes
+  \param [in] globalDomainIndex global index of domain source
+  \param [out] globalDomainIndexOnProc processes which contain the corresponding global index of domain source
+*/
 void CDomainAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex,
                                                                 CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc)
@@ -54,202 +59,5 @@
   dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex);
   globalDomainIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
-
-
-//  std::vector<int> countIndex(clientSize,0);
-//  const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
-//  CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it,
-//                                                               ite = computedGlobalIndexOnProc.end();
-//  for (it = itb; it != ite; ++it)
-//  {
-//    const std::vector<int>& procList = it->second;
-//    for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]];
-//  }
-//
-//  globalDomainIndexOnProc.rehash(std::ceil(clientSize/globalDomainIndexOnProc.max_load_factor()));
-//  for (int idx = 0; idx < clientSize; ++idx)
-//  {
-//    if (0 != countIndex[idx])
-//    {
-//      globalDomainIndexOnProc[idx].resize(countIndex[idx]);
-//      countIndex[idx] = 0;
-//    }
-//  }
-//
-//  for (it = itb; it != ite; ++it)
-//  {
-//    const std::vector<int>& procList = it->second;
-//    for (int idx = 0; idx < procList.size(); ++idx)
-//    {
-//      globalDomainIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first;
-//      ++countIndex[procList[idx]];
-//    }
-//  }
 }
 
-/*!
-  Compute an array of global index from a global index on a domain
-  \param[in] domainDestGlobalIndex global index on an domain of destination grid
-  \param[in] domainSrcGlobalIndex global index on an domain of source grid (which are needed by one index on domain destination)
-  \param[in] domainPositionInGrid position of the domain in the grid
-  \param[in] gridDestGlobalDim dimension size of destination grid (it should share the same size for all dimension, maybe except the domain on which transformation is performed)
-  \param[in] gridSrcGlobalDim dimension size of source grid (it should share the same size for all dimension, maybe except the domain on which transformation is performed)
-  \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s), this array is already acsending sorted
-  \param[in/out] globalIndexDestGrid array of global index (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated
-  \param[in/out] globalIndexSrcGrid array of global index of source grid (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated
-*/
-void CDomainAlgorithmTransformation::computeGlobalGridIndexFromGlobalIndexElement(int domainDestGlobalIndex,
-                                                                          const std::vector<int>& domainSrcGlobalIndex,
-                                                                          const std::vector<int>& destGlobalIndexPositionInGrid,
-                                                                          int domainPositionInGrid,
-                                                                          const std::vector<int>& gridDestGlobalDim,
-                                                                          const std::vector<int>& gridSrcGlobalDim,
-                                                                          const GlobalLocalMap& globalLocalIndexDestSendToServerMap,
-                                                                          std::vector<std::pair<size_t,int> >& globalLocalIndexDestMap,
-                                                                          std::vector<std::vector<size_t> >& globalIndexSrcGrid)
-{
-  int globalDim = gridDestGlobalDim.size();
-  int numElement = globalDim - 1;
-  int domainElementPosition = 0;
-  std::vector<int> currentIndex(globalDim);
-  std::vector<int> gridDomainGlobalDim(numElement), indexMap(numElement);
-  std::vector<int> idxLoop(numElement, 0), domainSrcGlobalDim(2), domainDestGlobalDim(2);
-
-
-  size_t ssize = 1, idx = 0, realGlobalIndexSize = 0;
-  for (int i = 0; i< globalDim; ++i)
-  {
-    if (domainPositionInGrid == i) continue;
-    if (domainPositionInGrid == (i+1))
-    {
-      domainDestGlobalDim[0] = gridDestGlobalDim[i];
-      domainDestGlobalDim[1] = gridDestGlobalDim[i+1];
-      domainSrcGlobalDim[0] = gridSrcGlobalDim[i];
-      domainSrcGlobalDim[1] = gridSrcGlobalDim[i+1];
-      gridDomainGlobalDim[idx] = 1;
-      domainElementPosition = idx;
-    }
-    else
-    {
-      gridDomainGlobalDim[idx] = gridDestGlobalDim[i];
-    }
-    indexMap[idx] = i;
-    ++idx;
-  }
-  int iIndex = domainDestGlobalIndex % domainDestGlobalDim[0];
-  int jIndex = domainDestGlobalIndex / domainDestGlobalDim[0];
-
-  for (int i = 0; i< numElement; ++i) ssize *= gridDomainGlobalDim[i];
-
-  GlobalLocalMap::const_iterator iteArr = globalLocalIndexDestSendToServerMap.end(), it;
-
-  idx = 0;
-  while (idx < ssize)
-  {
-    for (int i = 0; i < numElement; ++i)
-    {
-      if (idxLoop[i] == gridDomainGlobalDim[i])
-      {
-        idxLoop[i] = 0;
-        ++idxLoop[i+1];
-      }
-    }
-
-    for (int i = 0; i < numElement; ++i)
-    {
-      if (domainElementPosition == i)
-      {
-        currentIndex[indexMap[i]]   = iIndex;
-        currentIndex[indexMap[i]+1] = jIndex;
-      }
-      else
-        currentIndex[indexMap[i]] = idxLoop[i];
-    }
-
-    size_t globIndex = currentIndex[0];
-    size_t mulDim = 1;
-    for (int k = 1; k < globalDim; ++k)
-    {
-      mulDim *= gridDestGlobalDim[k-1];
-      globIndex += (currentIndex[k])*mulDim;
-    }
-
-    if (iteArr != globalLocalIndexDestSendToServerMap.find(globIndex)) ++realGlobalIndexSize;
-    ++idxLoop[0];
-    ++idx;
-  }
-
-  if (globalLocalIndexDestMap.size() != realGlobalIndexSize)
-    globalLocalIndexDestMap.resize(realGlobalIndexSize);
-
-  if (realGlobalIndexSize != globalIndexSrcGrid.size()) globalIndexSrcGrid.resize(realGlobalIndexSize);
-  for (int i = 0; i < globalIndexSrcGrid.size(); ++i)
-    if (globalIndexSrcGrid[i].size() != domainSrcGlobalIndex.size())
-      globalIndexSrcGrid[i].resize(domainSrcGlobalIndex.size());
-
-  size_t realGlobalIndex = 0;
-  idx = 0;
-  idxLoop.assign(globalDim, 0);
-  while (idx < ssize)
-  {
-    for (int i = 0; i < numElement; ++i)
-    {
-      if (idxLoop[i] == gridDomainGlobalDim[i])
-      {
-        idxLoop[i] = 0;
-        ++idxLoop[i+1];
-      }
-    }
-
-    for (int i = 0; i < numElement; ++i)
-    {
-      if (domainElementPosition == i)
-      {
-        currentIndex[indexMap[i]]   = iIndex;
-        currentIndex[indexMap[i]+1] = jIndex;
-      }
-      else
-        currentIndex[indexMap[i]] = idxLoop[i];
-    }
-
-    size_t globIndex = currentIndex[0];
-    size_t mulDim = 1;
-    for (int k = 1; k < globalDim; ++k)
-    {
-      mulDim *= gridDestGlobalDim[k-1];
-      globIndex += (currentIndex[k])*mulDim;
-    }
-
-    it = globalLocalIndexDestSendToServerMap.find(globIndex);
-    if (iteArr != it)
-    {
-      globalLocalIndexDestMap[realGlobalIndex] = (std::make_pair(it->first,it->second));
-      for (int i = 0; i < globalIndexSrcGrid[realGlobalIndex].size(); ++i)
-      {
-        domainGlobalIndex(domainSrcGlobalIndex[i], domainSrcGlobalDim[0], domainSrcGlobalDim[1],
-                          currentIndex[indexMap[domainElementPosition]],
-                          currentIndex[indexMap[domainElementPosition]+1]);
-
-        globIndex = currentIndex[0];
-        mulDim = 1;
-        for (int k = 1; k < globalDim; ++k)
-        {
-          mulDim *= gridSrcGlobalDim[k-1];
-          globIndex += (currentIndex[k])*mulDim;
-        }
-        (globalIndexSrcGrid[realGlobalIndex])[i] = globIndex;
-      }
-      ++realGlobalIndex;
-    }
-
-    ++idxLoop[0];
-    ++idx;
-  }
 }
-
-void CDomainAlgorithmTransformation::domainGlobalIndex(const int& index, const int& niGlob, const int& njGlob,
-                                                       int& iIndex, int& jIndex)
-{
-   iIndex = index % niGlob;
-   jIndex = index / niGlob;
-}
-}
Index: XIOS/trunk/src/transformation/domain_algorithm_transformation.hpp
===================================================================
--- XIOS/trunk/src/transformation/domain_algorithm_transformation.hpp	(revision 866)
+++ XIOS/trunk/src/transformation/domain_algorithm_transformation.hpp	(revision 867)
@@ -28,21 +28,8 @@
 
 protected:
-  virtual void computeGlobalGridIndexFromGlobalIndexElement(int domainDestGlobalIndex,
-                                                        const std::vector<int>& domainSrcGlobalIndex,
-                                                        const std::vector<int>& destGlobalIndexPositionInGrid,
-                                                        int domainPositionInGrid,
-                                                        const std::vector<int>& gridDestGlobalDim,
-                                                        const std::vector<int>& gridSrcGlobalDim,
-                                                        const GlobalLocalMap& globalLocalIndexDestSendToServerMap,
-                                                        std::vector<std::pair<size_t,int> >& globalLocalIndexDestMap,
-                                                        std::vector<std::vector<size_t> >& globalIndexSrcGrid);
-
   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&);
 
-  void computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex,
+  virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex,
                                   CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc);
-protected:
-  inline void domainGlobalIndex(const int& index, const int& niGlob, const int& njGlob,
-                                int& iIndex, int& jIndex);
 
 protected:
Index: XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
===================================================================
--- XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 866)
+++ XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 867)
@@ -22,89 +22,8 @@
   This function computes the global indexes of grid source, which the grid destination is in demand.
   \param[in] elementPositionInGrid position of an element in a grid .E.g: if grid is composed of domain and axis (in order),
-                then position of axis in grid is 2 (since a domain is considered to contain 2 elements (axis)
-  \param[in] gridDestGlobalDim global size of each dimension of grid source (all dimension must have the same size except of the one on which transformation is performed)
-  \param[in] gridSrcGlobalDim dimension size of source grid (it should share the same size for all dimension, maybe except the domain on which transformation is performed)
-  \param[in] globalLocalIndexGridDestSendToServer global and local index mapping of grid destination on the current client to send to server
-  \param[in/out] globaIndexWeightFromDestToSource mapping between transformed global index of grid destination
-             and the weighted value as well as global index from grid index source
-*/
-//void CGenericAlgorithmTransformation::computeGlobalSourceIndex(int elementPositionInGrid,
-//                                                               const std::vector<int>& gridDestGlobalDim,
-//                                                               const std::vector<int>& gridSrcGlobalDim,
-//                                                               const GlobalLocalMap& globalLocalIndexGridDestSendToServer,
-//                                                               DestinationIndexMap& globaIndexWeightFromDestToSource)
-//{
-//  bool isTransPosEmpty = transformationPosition_.empty();
-//  for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans)
-//  {
-//    TransformationIndexMap::const_iterator itbTransMap = transformationMapping_[idxTrans].begin(), itTransMap,
-//                                                     iteTransMap = transformationMapping_[idxTrans].end();
-//    TransformationWeightMap::const_iterator itTransWeight = transformationWeight_[idxTrans].begin();
-//
-//    // If transformation position exists
-//    TransformationIndexMap::const_iterator itTransPos, iteTransPos;
-//    if (!isTransPosEmpty)
-//    {
-//      itTransPos  = transformationPosition_[idxTrans].begin(),
-//      iteTransPos = transformationPosition_[idxTrans].end();
-//    }
-//    std::vector<int> emptyTransPos;
-//
-//    std::vector<std::vector<size_t> > globalIndexSrcGrid;
-//    std::vector<std::pair<size_t,int> > globalLocalIndexDest;
-//    for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight)
-//    {
-//      if (!isTransPosEmpty)
-//      {
-//        this->computeGlobalGridIndexFromGlobalIndexElement(itTransMap->first,
-//                                                           itTransMap->second,
-//                                                           itTransPos->second,
-//                                                           elementPositionInGrid,
-//                                                           gridDestGlobalDim,
-//                                                           gridSrcGlobalDim,
-//                                                           globalLocalIndexGridDestSendToServer,
-//                                                           globalLocalIndexDest,
-//                                                           globalIndexSrcGrid);
-//        ++itTransPos;
-//      }
-//      else
-//      {
-//        this->computeGlobalGridIndexFromGlobalIndexElement(itTransMap->first,
-//                                                           itTransMap->second,
-//                                                           emptyTransPos,
-//                                                           elementPositionInGrid,
-//                                                           gridDestGlobalDim,
-//                                                           gridSrcGlobalDim,
-//                                                           globalLocalIndexGridDestSendToServer,
-//                                                           globalLocalIndexDest,
-//                                                           globalIndexSrcGrid);
-//      }
-//      std::vector<std::pair<size_t,int> >::const_iterator it = globalLocalIndexDest.begin(), ite = globalLocalIndexDest.end();
-//      const std::vector<double>& currentVecWeight = itTransWeight->second;
-//
-//      for (size_t idx = 0; it != ite; ++it, ++idx)
-//      {
-//        size_t srcGridSize = globalIndexSrcGrid[idx].size();
-////        globaIndexWeightFromDestToSource[(it->first)].resize(srcGridSize);
-//        DestinationGlobalIndex& tmp = globaIndexWeightFromDestToSource[(it->first)];
-//        tmp.resize(srcGridSize);
-//        for (int i = 0; i < srcGridSize; ++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])));
-//        }
-//      }
-//    }
-//  }
-//}
-
-/*!
-  This function computes the global indexes of grid source, which the grid destination is in demand.
-  \param[in] elementPositionInGrid position of an element in a grid .E.g: if grid is composed of domain and axis (in order),
                 then position of axis in grid is 1 and domain is positioned at 0.
   \param[in] gridSrc Grid source
   \param[in] gridDst Grid destination
-  \param[in] globaIndexWeightFromSrcToDst mapping of each global index source and weight to index destination
+  \param[in\out] globaIndexWeightFromSrcToDst mapping of each global index source and weight to index destination
 */
 void CGenericAlgorithmTransformation::computeGlobalSourceIndex(int elementPositionInGrid,
Index: XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
===================================================================
--- XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 866)
+++ XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 867)
@@ -47,10 +47,4 @@
   virtual ~CGenericAlgorithmTransformation() {}
 
-//  void computeGlobalSourceIndex(int elementPositionInGrid,
-//                                const std::vector<int>& gridDestGlobalDim,
-//                                const std::vector<int>& gridSrcGlobalDim,
-//                                const GlobalLocalMap& globalLocalIndexGridDestSendToServer,
-//                                DestinationIndexMap& globaIndexWeightFromDestToSource);
-
   void computeGlobalSourceIndex(int elementPositionInGrid,
                                CGrid* gridSrc,
@@ -66,29 +60,15 @@
 
 protected:
-  /*!
-  Compute an array of global index from a global index on an element
-    \param[in] destGlobalIndex global index on an element of destination grid
-    \param[in] srcGlobalIndex global index(es) on an element of source grid (which are needed by one index on element destination)
-    \param[in] elementPositionInGrid position of the element in the grid (for example: a grid with one domain and one axis, position of domain is 1, position of axis is 2)
-    \param[in] gridDestGlobalDim dimension size of destination grid (it should share the same size for all dimension, maybe except the element on which transformation is performed)
-    \param[in] globalLocalIndexDestSendToServerMap pair of global index and local index of destination grid which are to be sent to server(s), this array is already acsending sorted
-    \param[in/out] globalLocalIndexDestMap array of global index (for 2d grid, this array maybe a line, for 3d, this array may represent a plan). It should be preallocated
-    \param[in/out] globalIndexSrcGrid array of global index of source grid (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated
-  */
-  virtual void computeGlobalGridIndexFromGlobalIndexElement(int destGlobalIndex,
-                                                        const std::vector<int>& srcGlobalIndex,
-                                                        const std::vector<int>& destGlobalIndexPositionInGrid,
-                                                        int elementPositionInGrid,
-                                                        const std::vector<int>& gridDestGlobalDim,
-                                                        const std::vector<int>& gridSrcGlobalDim,
-                                                        const GlobalLocalMap& globalLocalIndexDestSendToServerMap,
-                                                        std::vector<std::pair<size_t,int> >& globalLocalIndexDestMap,
-                                                        std::vector<std::vector<size_t> >& globalIndexSrcGrid) = 0;
-
   virtual void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&) = 0;
 
+  /*!
+  Compute proc which contains global index of an element
+    \param[in] globalElementIndex demanding global index of an element of source grid
+    \param[out] globalElementIndexOnProc Proc contains the demanding global index
+  */
   virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalElementIndex,
                                           CClientClientDHTInt::Index2VectorInfoTypeMap& globalElementIndexOnProc) = 0;
 
+protected:
   void computeGlobalGridIndexMapping(int elementPositionInGrid,
                                      const std::vector<int>& srcRank,
@@ -118,5 +98,5 @@
   std::vector<TransformationPositionMap> transformationPosition_;
 
-  //! Id of auxillary inputs which help doing transformation dynamically
+  //! Id of auxillary inputs which helps doing transformation dynamically
   std::vector<StdString> idAuxInputs_;
 };
Index: XIOS/trunk/src/transformation/grid_transformation.cpp
===================================================================
--- XIOS/trunk/src/transformation/grid_transformation.cpp	(revision 866)
+++ XIOS/trunk/src/transformation/grid_transformation.cpp	(revision 867)
@@ -15,8 +15,8 @@
 #include "context.hpp"
 #include "context_client.hpp"
-#include "transformation_mapping.hpp"
 #include "axis_algorithm_transformation.hpp"
 #include "distribution_client.hpp"
 #include "mpi_tag.hpp"
+#include "grid.hpp"
 #include <boost/unordered_map.hpp>
 
@@ -24,5 +24,5 @@
 CGridTransformation::CGridTransformation(CGrid* destination, CGrid* source)
 : gridSource_(source), gridDestination_(destination), originalGridSource_(source),
-  algoTypes_(), nbAlgos_(0), currentGridIndexToOriginalGridIndex_(), tempGrids_(),
+  algoTypes_(), nbAlgos_(0), tempGrids_(),
   auxInputs_(), dynamicalTransformation_(false), timeStamp_()
 
@@ -45,5 +45,5 @@
   }
 
-  initializeMappingOfOriginalGridSource();
+  initializeTransformations();
 }
 
@@ -54,5 +54,5 @@
 for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one.
 */
-void CGridTransformation::initializeMappingOfOriginalGridSource()
+void CGridTransformation::initializeTransformations()
 {
   CContext* context = CContext::getCurrent();
@@ -95,13 +95,8 @@
     {
       axisPositionInGrid.push_back(i);
-//      axisPositionInGrid.push_back(idx);
-//      ++idx;
     }
     else
     {
       domPositionInGrid.push_back(i);
-//      ++idx;
-//      domPositionInGrid.push_back(idx);
-//      ++idx;
     }
   }
@@ -123,13 +118,8 @@
     {
       initializeAxisAlgorithms(i);
-//      initializeAxisAlgorithms(idx);
-//      ++idx;
     }
     else
     {
       initializeDomainAlgorithms(i);
-//      ++idx;
-//      initializeDomainAlgorithms(idx);
-//      ++idx;
     }
   }
@@ -357,77 +347,7 @@
   -) Chose the correct algorithm by transformation type and position of element
   -) Calculate the mapping of global index between the current grid source and grid destination
-  -) Calculate the mapping of global index between current grid DESTINATION and ORIGINAL grid SOURCE
+  -) Calculate the mapping of global index between current grid DESTINATION and grid SOURCE
   -) Make current grid destination become grid source in the next transformation
 */
-//void CGridTransformation::computeAll(const std::vector<CArray<double,1>* >& dataAuxInputs, Time timeStamp)
-//{
-//  if (nbAlgos_ < 1) return;
-//  if (!auxInputs_.empty() && !dynamicalTransformation_) { dynamicalTransformation_ = true; return; }
-//  if (dynamicalTransformation_)
-//  {
-//    if (timeStamp_.insert(timeStamp).second)
-//      DestinationIndexMap().swap(currentGridIndexToOriginalGridIndex_);  // Reset map
-//    else
-//      return;
-//  }
-//
-//  CContext* context = CContext::getCurrent();
-//  CContextClient* client = context->client;
-//
-//  ListAlgoType::const_iterator itb = listAlgos_.begin(),
-//                               ite = listAlgos_.end(), it;
-//
-//  CGenericAlgorithmTransformation* algo = 0;
-//  int nbAgloTransformation = 0; // Only count for executed transformation. Generate domain is a special one, not executed in the list
-//  for (it = itb; it != ite; ++it)
-//  {
-//    int elementPositionInGrid = it->first;
-//    ETranformationType transType = (it->second).first;
-//    int transformationOrder = (it->second).second;
-//    DestinationIndexMap globaIndexWeightFromDestToSource;
-//
-//    // First of all, select an algorithm
-//    if (!dynamicalTransformation_ || (algoTransformation_.size() < listAlgos_.size()))
-//    {
-//      selectAlgo(elementPositionInGrid, transType, transformationOrder, algoTypes_[std::distance(itb, it)]);
-//      algo = algoTransformation_.back();
-//    }
-//    else
-//      algo = algoTransformation_[std::distance(itb, it)];
-//
-//    if (0 != algo) // Only registered transformation can be executed
-//    {
-//      algo->computeIndexSourceMapping(dataAuxInputs);
-//
-//      // Recalculate the distribution of grid destination
-//      CDistributionClient distributionClientDest(client->clientRank, gridDestination_);
-//      const CDistributionClient::GlobalLocalDataMap& globalLocalIndexGridDestSendToServer = distributionClientDest.getGlobalLocalDataSendToServer();
-//
-//      // ComputeTransformation of global index of each element
-//      std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension();
-//      std::vector<int> gridSrcDimensionSize = gridSource_->getGlobalDimension();
-//      int elementPosition = it->first;
-//      algo->computeGlobalSourceIndex(elementPosition,
-//                                     gridDestinationDimensionSize,
-//                                     gridSrcDimensionSize,
-//                                     globalLocalIndexGridDestSendToServer,
-//                                     globaIndexWeightFromDestToSource);
-//
-//      // Compute transformation of global indexes among grids
-//      computeTransformationMapping(globaIndexWeightFromDestToSource);
-//
-//      // Update number of local index on each transformation
-//      nbLocalIndexOnGridDest_.push_back(globalLocalIndexGridDestSendToServer.size());
-//
-//      if (1 < nbAlgos_)
-//      {
-//        // Now grid destination becomes grid source in a new transformation
-//        if (nbAgloTransformation != (nbAlgos_-1)) setUpGrid(elementPositionInGrid, transType, nbAgloTransformation);
-//      }
-//      ++nbAgloTransformation;
-//    }
-//  }
-//}
-
 void CGridTransformation::computeAll(const std::vector<CArray<double,1>* >& dataAuxInputs, Time timeStamp)
 {
@@ -436,11 +356,10 @@
   if (dynamicalTransformation_)
   {
-    if (timeStamp_.insert(timeStamp).second)
-    {
-      DestinationIndexMap().swap(currentGridIndexToOriginalGridIndex_);  // Reset map
-      std::list<size_t>().swap(nbLocalIndexOnGridDest_);
+    if (timeStamp_.insert(timeStamp).second)   //Reset map
+    {
       std::list<SendingIndexGridSourceMap>().swap(localIndexToSendFromGridSource_);
       std::list<RecvIndexGridDestinationMap>().swap(localIndexToReceiveOnGridDest_);
-    }      
+      std::list<size_t>().swap(nbLocalIndexOnGridDest_);
+    }
     else
       return;
@@ -555,6 +474,4 @@
   }
 
-
-
   // Sending global index of grid source to corresponding process as well as the corresponding mask
   std::vector<MPI_Request> requests;
@@ -720,53 +637,4 @@
 }
 
-///*!
-//  Compute exchange index between grid source and grid destination
-//  \param [in] globalIndexWeightFromDestToSource global index mapping between grid destination and grid source
-//*/
-//void CGridTransformation::computeTransformationMapping(const DestinationIndexMap& globalIndexWeightFromDestToSource)
-//{
-//  CContext* context = CContext::getCurrent();
-//  CContextClient* client = context->client;
-//
-//  CTransformationMapping transformationMap(gridDestination_, gridSource_);
-//
-//  transformationMap.computeTransformationMapping(globalIndexWeightFromDestToSource);
-//
-//  const CTransformationMapping::ReceivedIndexMap& globalIndexToReceive = transformationMap.getGlobalIndexReceivedOnGridDestMapping();
-//  CTransformationMapping::ReceivedIndexMap::const_iterator itbMapRecv, itMapRecv, iteMapRecv;
-//  itbMapRecv = globalIndexToReceive.begin();
-//  iteMapRecv = globalIndexToReceive.end();
-//  localIndexToReceiveOnGridDest_.push_back(RecvIndexGridDestinationMap());
-//  RecvIndexGridDestinationMap& recvTmp = localIndexToReceiveOnGridDest_.back();
-//  for (itMapRecv = itbMapRecv; itMapRecv != iteMapRecv; ++itMapRecv)
-//  {
-//    int sourceRank = itMapRecv->first;
-//    int numGlobalIndex = (itMapRecv->second).size();
-//    recvTmp[sourceRank].resize(numGlobalIndex);
-//    for (int i = 0; i < numGlobalIndex; ++i)
-//    {
-//      recvTmp[sourceRank][i] = make_pair((itMapRecv->second)[i].localIndex,(itMapRecv->second)[i].weight);
-//    }
-//  }
-//
-//  // Find out local index on grid source (to send)
-//  const CTransformationMapping::SentIndexMap& globalIndexToSend = transformationMap.getGlobalIndexSendToGridDestMapping();
-//  CTransformationMapping::SentIndexMap::const_iterator itbMap, itMap, iteMap;
-//  itbMap = globalIndexToSend.begin();
-//  iteMap = globalIndexToSend.end();
-//  localIndexToSendFromGridSource_.push_back(SendingIndexGridSourceMap());
-//  SendingIndexGridSourceMap& tmpSend = localIndexToSendFromGridSource_.back();
-//  for (itMap = itbMap; itMap != iteMap; ++itMap)
-//  {
-//    int destRank = itMap->first;
-//    int vecSize = itMap->second.size();
-//    tmpSend[destRank].resize(vecSize);
-//    for (int idx = 0; idx < vecSize; ++idx)
-//    {
-//      tmpSend[destRank](idx) = itMap->second[idx].first;
-//    }
-//  }
-//}
-
 bool CGridTransformation::isSpecialTransformation(ETranformationType transType)
 {
Index: XIOS/trunk/src/transformation/grid_transformation.hpp
===================================================================
--- XIOS/trunk/src/transformation/grid_transformation.hpp	(revision 866)
+++ XIOS/trunk/src/transformation/grid_transformation.hpp	(revision 867)
@@ -12,5 +12,4 @@
 #include <map>
 #include <vector>
-#include "grid.hpp"
 #include "generic_algorithm_transformation.hpp"
 #include "transformation_enum.hpp"
@@ -25,7 +24,6 @@
   This class is an interface for all transformations to interact with the rest of XIOS.
 The class, firstly, tries to get all information relating to requested transformations by retrieving directly from grid.
-Then with all these information, all necessary transformations will be created by generic class \class CGenericAlgorithmTransformation.
-Because there are information exchange among clients to accomplish the transformations (e.g: some index need retrieving from other clients),
-this class uses class \class CTransformationMapping to fulfill this demand.
+Secondly, with all these information, all necessary transformations will be created by generic class \class CGenericAlgorithmTransformation.
+Then this class accomplishes the transformations by exchanging information among clients (e.g: some index need retrieving index from other clients),
 For each transformation, a new temporary grid source is created.
 For a consequential transformations (e.g: inversing -> zoom -> inversing -> ...),
@@ -63,5 +61,5 @@
   void initializeAxisAlgorithms(int axisPositionInGrid);
   void initializeDomainAlgorithms(int domPositionInGrid);
-  void initializeMappingOfOriginalGridSource();
+  void initializeTransformations();
 
   void selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder);
@@ -69,8 +67,5 @@
   void selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, bool isDomainAlgo);
   void setUpGrid(int elementPositionInGrid, ETranformationType transType, int nbTransformation);
-//  void computeFinalTransformationMapping();
-//  void computeTransformationFromOriginalGridSource(const DestinationIndexMap& globaIndexMapFromDestToSource);
   void computeTransformationMapping(const SourceDestinationIndexMap& globalIndexWeightFromSrcToDest);
-//  void updateFinalGridDestination();
   bool isSpecialTransformation(ETranformationType transType);
 
@@ -113,7 +108,4 @@
   std::map<int, int> elementPosition2AxisPositionInGrid_, elementPosition2DomainPositionInGrid_;
 
-  //! (Grid) Global index of grid source
-  DestinationIndexMap currentGridIndexToOriginalGridIndex_;
-
   std::vector<CGrid*> tempGrids_;
   std::vector<StdString> auxInputs_;
