Index: /XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp	(revision 865)
+++ /XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp	(revision 866)
@@ -33,5 +33,5 @@
 
 void CAxisAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex,
-                                                              boost::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc)
+                                                              CClientClientDHTInt::Index2VectorInfoTypeMap& globalAxisIndexOnProc)
 {
   CContext* context = CContext::getCurrent();
@@ -47,5 +47,7 @@
   {
     globalIndex = axisSrc_->index(idx);
-    globalIndex2ProcRank[globalIndex].push_back(clientRank);
+    globalIndex2ProcRank[globalIndex].resize(1);
+    globalIndex2ProcRank[globalIndex][0] = clientRank;
+//    globalIndex2ProcRank[globalIndex].push_back(clientRank);
   }
 
@@ -53,33 +55,35 @@
   dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex);
 
-  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]];
-  }
-
-  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]];
-    }
-  }
+//  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]];
+//    }
+//  }
 }
 
Index: /XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp
===================================================================
--- /XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp	(revision 865)
+++ /XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp	(revision 866)
@@ -40,5 +40,5 @@
 
   void computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex,
-                                  boost::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc);
+                                  CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc);
 
 protected:
Index: /XIOS/trunk/src/transformation/domain_algorithm_transformation.cpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_transformation.cpp	(revision 865)
+++ /XIOS/trunk/src/transformation/domain_algorithm_transformation.cpp	(revision 866)
@@ -11,5 +11,5 @@
 #include "context.hpp"
 #include "context_client.hpp"
-#include "client_client_dht_template.hpp"
+#include "domain.hpp"
 
 namespace xios {
@@ -29,5 +29,5 @@
 
 void CDomainAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex,
-                                                                boost::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc)
+                                                                CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc)
 {
   CContext* context = CContext::getCurrent();
@@ -53,34 +53,36 @@
   CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm);
   dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex);
-
-  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]];
-    }
-  }
+  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]];
+//    }
+//  }
 }
 
Index: /XIOS/trunk/src/transformation/domain_algorithm_transformation.hpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_transformation.hpp	(revision 865)
+++ /XIOS/trunk/src/transformation/domain_algorithm_transformation.hpp	(revision 866)
@@ -11,8 +11,9 @@
 
 #include "generic_algorithm_transformation.hpp"
-#include "domain.hpp"
+#include "client_client_dht_template.hpp"
 
 namespace xios {
 
+class CDomain;
 /*!
   \class CDomainAlgorithmTransformation
@@ -40,5 +41,5 @@
 
   void computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex,
-                                  boost::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc);
+                                  CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc);
 protected:
   inline void domainGlobalIndex(const int& index, const int& niGlob, const int& njGlob,
Index: /XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
===================================================================
--- /XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 865)
+++ /XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp	(revision 866)
@@ -118,5 +118,98 @@
 
   typedef boost::unordered_map<int, std::vector<std::pair<int,double> > > SrcToDstMap;
+
+  size_t indexSrcSize = 0;
+  for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans)
+  {
+    TransformationIndexMap::const_iterator itbTransMap = transformationMapping_[idxTrans].begin(), itTransMap,
+                                           iteTransMap = transformationMapping_[idxTrans].end();
+    TransformationWeightMap::const_iterator itbTransWeight = transformationWeight_[idxTrans].begin(), itTransWeight;
+
+    itTransWeight = itbTransWeight;
+    for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight)
+    {
+       indexSrcSize += (itTransMap->second).size();
+    }
+  }
+
   bool isTransPosEmpty = transformationPosition_.empty();
+  CArray<size_t,1> transPos;
+  if (!isTransPosEmpty) transPos.resize(transformationMapping_.size());
+  CArray<size_t,1> indexSrc(indexSrcSize);
+  indexSrcSize = 0;
+  for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans)
+  {
+    TransformationIndexMap::const_iterator itbTransMap = transformationMapping_[idxTrans].begin(), itTransMap,
+                                           iteTransMap = transformationMapping_[idxTrans].end();
+    TransformationWeightMap::const_iterator itbTransWeight = transformationWeight_[idxTrans].begin(), itTransWeight;
+
+    // Build mapping between global source element index and global destination element index.
+    itTransWeight = itbTransWeight;
+    for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight)
+    {
+      const std::vector<int>& srcIndex = itTransMap->second;
+      for (int idx = 0; idx < srcIndex.size(); ++idx)
+      {
+        indexSrc(indexSrcSize) = srcIndex[idx];
+        ++indexSrcSize;
+      }
+    }
+
+    if (!isTransPosEmpty)
+    {
+      TransformationPositionMap::const_iterator itPosMap = transformationPosition_[idxTrans].begin();
+      transPos(idxTrans) = itPosMap->second[0];
+    }
+  }
+
+  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
+  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
+  CArray<bool,1> axisDomainDstOrder = gridDst->axis_domain_order;
+  std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();
+  std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();
+
+  // Find out global index source of transformed element on corresponding process.
+  std::vector<boost::unordered_map<int,std::vector<size_t> > > globalElementIndexOnProc(axisDomainDstOrder.numElements());
+  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc;
+  int axisIndex = 0, domainIndex = 0;
+  for (int idx = 0; idx < axisDomainDstOrder.numElements(); ++idx)
+  {
+    if (idx == elementPositionInGrid)
+      computeExchangeGlobalIndex(indexSrc, globalIndexOfTransformedElementOnProc); //globalElementIndexOnProc[idx]);
+    if (axisDomainDstOrder(idx)) // It's domain
+    {
+      if (idx != elementPositionInGrid)
+        computeExchangeDomainIndex(domainListDestP[domainIndex],
+                                   domainListSrcP[domainIndex],
+                                   transPos,
+                                   globalElementIndexOnProc[idx]);
+      ++domainIndex;
+
+    }
+    else //it's an axis
+    {
+      if (idx != elementPositionInGrid)
+        computeExchangeAxisIndex(axisListDestP[axisIndex],
+                                 axisListSrcP[axisIndex],
+                                 transPos,
+                                 globalElementIndexOnProc[idx]);
+      ++axisIndex;
+
+    }
+  }
+
+  if (!isTransPosEmpty)
+  {
+    for (int idx = 0; idx < globalElementIndexOnProc.size(); ++idx)
+    {
+      if (idx != elementPositionInGrid)
+      {
+        boost::unordered_map<int,std::vector<size_t> >::iterator itb = globalElementIndexOnProc[idx].begin(), it,
+                                                                 ite = globalElementIndexOnProc[idx].end();
+        for (it = itb; it != ite; ++it) it->second.resize(1);
+      }
+    }
+  }
+
   for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans)
   {
@@ -127,14 +220,7 @@
     src2DstMap.rehash(std::ceil(transformationMapping_[idxTrans].size()/src2DstMap.max_load_factor()));
 
-    int indexSrcSize = 0;
-    itTransWeight = itbTransWeight;
-    for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight)
-    {
-       indexSrcSize += (itTransMap->second).size();
-    }
-
-    CArray<size_t,1> indexSrc(indexSrcSize);
-    int indexSrcIndex = 0;
     // Build mapping between global source element index and global destination element index.
+    boost::unordered_map<int,std::vector<size_t> >().swap(globalElementIndexOnProc[elementPositionInGrid]);
+    boost::unordered_map<int,int> tmpCounter;
     itTransWeight = itbTransWeight;
     for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight)
@@ -145,56 +231,28 @@
       {
         src2DstMap[srcIndex[idx]].push_back(make_pair(itTransMap->first, weight[idx]));
-        indexSrc(indexSrcIndex) = srcIndex[idx];
-        ++indexSrcIndex;
+        if (1 == globalIndexOfTransformedElementOnProc.count(srcIndex[idx]) && (0 == tmpCounter.count(srcIndex[idx])))
+        {
+          tmpCounter[srcIndex[idx]] = 1;
+          std::vector<int>& srcProc = globalIndexOfTransformedElementOnProc[srcIndex[idx]];
+          for (int j = 0; j < srcProc.size(); ++j)
+            globalElementIndexOnProc[elementPositionInGrid][srcProc[j]].push_back(srcIndex[idx]);
+        }
       }
     }
 
-    std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-    std::vector<CDomain*> domainListDestP = gridDst->getDomains();
-    CArray<bool,1> axisDomainDstOrder = gridDst->axis_domain_order;
-    std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();
-    std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();
-    CArray<bool,1> axisDomainSrcOrder = gridDst->axis_domain_order;
-
-    CArray<size_t,1> transPos;
     if (!isTransPosEmpty)
     {
-      transPos.resize(transformationPosition_[idxTrans].size());
-      TransformationPositionMap::const_iterator itPosMap = transformationPosition_[idxTrans].begin(),
-                                               itePosMap = transformationPosition_[idxTrans].end();
-      for (int idx = 0; itPosMap != itePosMap; ++itPosMap, ++idx)
-        transPos(idx) = itPosMap->second[0];
-    }
-    // Find out global index source of transformed element on corresponding process.
-    std::vector<boost::unordered_map<int,std::vector<size_t> > > globalElementIndexOnProc(axisDomainDstOrder.numElements());
-    int axisIndex = 0, domainIndex = 0;
-    for (int idx = 0; idx < axisDomainDstOrder.numElements(); ++idx)
-    {
-      if (idx == elementPositionInGrid)
-        computeExchangeGlobalIndex(indexSrc, globalElementIndexOnProc[idx]);
-      if (axisDomainDstOrder(idx)) // It's domain
+      for (int idx = 0; idx < globalElementIndexOnProc.size(); ++idx)
       {
         if (idx != elementPositionInGrid)
-          computeExchangeDomainIndex(domainListDestP[domainIndex],
-                                     domainListSrcP[domainIndex],
-                                     transPos,
-                                     globalElementIndexOnProc[idx]);
-        ++domainIndex;
-
+        {
+          boost::unordered_map<int,std::vector<size_t> >::iterator itb = globalElementIndexOnProc[idx].begin(), it,
+                                                                   ite = globalElementIndexOnProc[idx].end();
+          for (it = itb; it != ite; ++it) it->second[0] = transPos(idxTrans);
+        }
       }
-      else //it's an axis
-      {
-        if (idx != elementPositionInGrid)
-          computeExchangeAxisIndex(axisListDestP[axisIndex],
-                                   axisListSrcP[axisIndex],
-                                   transPos,
-                                   globalElementIndexOnProc[idx]);
-        ++axisIndex;
-
-      }
     }
 
     std::vector<std::vector<bool> > elementOnProc(axisDomainDstOrder.numElements(), std::vector<bool>(nbClient, false));
-
     boost::unordered_map<int,std::vector<size_t> >::const_iterator it, itb, ite;
     for (int idx = 0; idx < globalElementIndexOnProc.size(); ++idx)
@@ -431,17 +489,29 @@
   int clientSize = client->clientSize;
 
-  int niGlob = domainSrc->ni_glo.getValue();
-  int njGlob = domainSrc->nj_glo.getValue();
+  int niGlobSrc = domainSrc->ni_glo.getValue();
   size_t globalIndex;
-  int nIndexSize = domainSrc->i_index.numElements(), i_ind, j_ind;
+  int i_ind, j_ind;
+  int nIndexSize = (destGlobalIndexPositionInGrid.isEmpty()) ? domainSrc->i_index.numElements()
+                                                             : destGlobalIndexPositionInGrid.numElements();
   CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;
   globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));
-  for (int idx = 0; idx < nIndexSize; ++idx)
-  {
-    i_ind=domainSrc->i_index(idx) ;
-    j_ind=domainSrc->j_index(idx) ;
-
-    globalIndex = i_ind + j_ind * niGlob;
-    globalIndex2ProcRank[globalIndex].push_back(clientRank);
+  if (destGlobalIndexPositionInGrid.isEmpty())
+  {
+    for (int idx = 0; idx < nIndexSize; ++idx)
+    {
+      i_ind=domainSrc->i_index(idx) ;
+      j_ind=domainSrc->j_index(idx) ;
+
+      globalIndex = i_ind + j_ind * niGlobSrc;
+      globalIndex2ProcRank[globalIndex].resize(1);
+      globalIndex2ProcRank[globalIndex][0] = clientRank;
+    }
+  }
+  else
+  {
+    for (int idx = 0; idx < nIndexSize; ++idx)
+    {
+      globalIndex2ProcRank[destGlobalIndexPositionInGrid(idx)].push_back(clientRank);
+    }
   }
 
@@ -449,4 +519,5 @@
   if (destGlobalIndexPositionInGrid.isEmpty())
   {
+    int niGlobDst = domainDst->ni_glo.getValue();
     globalDomainIndex.resize(domainDst->i_index.numElements());
     nIndexSize = domainDst->i_index.numElements();
@@ -457,14 +528,10 @@
       j_ind=domainDst->j_index(idx) ;
 
-      globalDomainIndex(idx) = i_ind + j_ind * niGlob;
+      globalDomainIndex(idx) = i_ind + j_ind * niGlobDst;
     }
   }
   else
   {
-    globalDomainIndex  = destGlobalIndexPositionInGrid;
-//    for (int idx = 0; idx < destGlobalIndexPositionInGrid.size(); ++idx)
-//    {
-//      globalDomainIndex(idx) = destGlobalIndexPositionInGrid[idx];
-//    }
+    globalDomainIndex.reference(destGlobalIndexPositionInGrid);
   }
 
Index: /XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
===================================================================
--- /XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 865)
+++ /XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp	(revision 866)
@@ -13,4 +13,5 @@
 #include <set>
 #include "array_new.hpp"
+#include "client_client_dht_template.hpp"
 
 namespace xios {
@@ -88,5 +89,5 @@
 
   virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalElementIndex,
-                                          boost::unordered_map<int,std::vector<size_t> >& globalElementIndexOnProc) = 0;
+                                          CClientClientDHTInt::Index2VectorInfoTypeMap& globalElementIndexOnProc) = 0;
 
   void computeGlobalGridIndexMapping(int elementPositionInGrid,
