Index: XIOS/trunk/src/client_server_mapping_distributed.cpp
===================================================================
--- XIOS/trunk/src/client_server_mapping_distributed.cpp	(revision 584)
+++ XIOS/trunk/src/client_server_mapping_distributed.cpp	(revision 585)
@@ -17,7 +17,7 @@
 
 CClientServerMappingDistributed::CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer,
-                                                                 const MPI_Comm& clientIntraComm)
+                                                                 const MPI_Comm& clientIntraComm, bool isDataDistributed)
   : CClientServerMapping(), indexClientHash_(), countIndexGlobal_(0), countIndexServer_(0),
-    indexGlobalBuffBegin_(), indexServerBuffBegin_(), requestRecvIndexServer_()
+    indexGlobalBuffBegin_(), indexServerBuffBegin_(), requestRecvIndexServer_(), isDataDistributed_(isDataDistributed)
 {
   clientIntraComm_ = clientIntraComm;
@@ -35,18 +35,4 @@
    Compute mapping global index of server which client sends to.
    \param [in] globalIndexOnClient global index client has
-*/
-//void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient)
-//{
-//  int ssize = globalIndexOnClient.numElements();
-//  CArray<int,1>* localIndexOnClient = new CArray<int,1>(ssize);
-//  for (int i = 0; i < ssize; ++i) (*localIndexOnClient)(i) = i;
-//
-//  this->computeServerIndexMapping(globalIndexOnClient, *localIndexOnClient);
-//  delete localIndexOnClient;
-//}
-
-/*!
-   Compute mapping global index of server which client sends to.
-   \param [in] globalIndexOnClient global index client has
    \param [in] localIndexOnClient local index on client
 */
@@ -61,5 +47,4 @@
   std::map<int, std::vector<size_t> > client2ClientIndexGlobal;
   std::map<int, std::vector<int> > client2ClientIndexServer;
-//  std::map<int, std::vector<int> > clientLocalIndex;
 
   // Number of global index whose mapping server can be found out thanks to index-server mapping
@@ -81,5 +66,4 @@
       {
         (indexGlobalOnServer_[globalIndexToServerMapping_[globalIndexClient]]).push_back(globalIndexClient);
-//        (localIndexSend2Server_[globalIndexToServerMapping_[globalIndexClient]]).push_back(localIndexOnClient(i));
         ++nbIndexAlreadyOnClient;
       }
@@ -87,5 +71,4 @@
       {
         client2ClientIndexGlobal[indexClient].push_back(globalIndexClient);
-//        clientLocalIndex[indexClient].push_back(i);
         ++nbIndexSendToOthers;
       }
@@ -106,4 +89,5 @@
          sendIndexGlobalToClients(it->first, it->second, clientIntraComm_, sendRequest);
 
+  int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0;
   // Receiving demand as well as the responds from other clients
   // The demand message contains global index; meanwhile the responds have server index information
@@ -112,4 +96,6 @@
   int maxNbIndexDemandedFromOthers = (nbIndexAlreadyOnClient >= globalIndexToServerMapping_.size())
                                    ? 0 : (globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient);
+  if (!isDataDistributed_) maxNbIndexDemandedFromOthers = nbDemandingClient * globalIndexToServerMapping_.size(); // Not very optimal but it's general
+
   if (0 != maxNbIndexDemandedFromOthers)
     recvBuffIndexGlobal = new unsigned long[maxNbIndexDemandedFromOthers];
@@ -118,11 +104,11 @@
   int* recvBuffIndexServer = 0;
   int nbIndexReceivedFromOthers = nbIndexSendToOthers;
+//  int nbIndexReceivedFromOthers = globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient;
   if (0 != nbIndexReceivedFromOthers)
     recvBuffIndexServer = new int[nbIndexReceivedFromOthers];
 
-  resetReceivingRequestAndCount();
   std::map<int, MPI_Request>::iterator itRequest;
   std::vector<int> demandAlreadyReceived, repondAlreadyReceived;
-  int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0;
+
 
   resetReceivingRequestAndCount();
@@ -180,9 +166,7 @@
         int* beginBuff = indexServerBuffBegin_[clientSourceRank];
         std::vector<size_t>& globalIndexTmp = client2ClientIndexGlobal[clientSourceRank];
-//        std::vector<int>& localIndexTmp = clientLocalIndex[clientSourceRank];
         for (int i = 0; i < count; ++i)
         {
           (indexGlobalOnServer_[*(beginBuff+i)]).push_back(globalIndexTmp[i]);
-//          (localIndexSend2Server_[*(beginBuff+i)]).push_back(localIndexOnClient(localIndexTmp[i]));
         }
         nbIndexServerReceived += count;
@@ -224,6 +208,6 @@
   Compute distribution of global index for servers
   Each client already holds a piece of information about global index and the corresponding server.
-This information is redistributed into size_t sipace in which each client possesses a specific range of index.
-Afterh the redistribution, each client as long as its range of index contains all necessary information about server.
+This information is redistributed into size_t space in which each client possesses a specific range of index.
+After the redistribution, each client as well as its range of index contains all necessary information about server.
   \param [in] globalIndexOfServer global index and the corresponding server
   \param [in] clientIntraComm client joining distribution process.
Index: XIOS/trunk/src/client_server_mapping_distributed.hpp
===================================================================
--- XIOS/trunk/src/client_server_mapping_distributed.hpp	(revision 584)
+++ XIOS/trunk/src/client_server_mapping_distributed.hpp	(revision 585)
@@ -34,5 +34,5 @@
     /** Default constructor */
     CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer,
-                                    const MPI_Comm& clientIntraComm);
+                                    const MPI_Comm& clientIntraComm, bool isDataDistributed = true);
 
     virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClientSendToServer);
@@ -118,4 +118,7 @@
     //! Mapping client rank and the begining position of receiving buffer for message of server index from this client
     std::map<int, int*> indexServerBuffBegin_;
+
+    //! Flag to specify whether data is distributed or not
+    bool isDataDistributed_;
 };
 
Index: XIOS/trunk/src/node/domain.cpp
===================================================================
--- XIOS/trunk/src/node/domain.cpp	(revision 584)
+++ XIOS/trunk/src/node/domain.cpp	(revision 585)
@@ -744,5 +744,5 @@
       for (int i = 0; i < nb; ++i)
       {
-        if (std::binary_search(itbVec, iteVec, globalIndexDomainZoom(i)))
+        if (iteVec != std::find(itbVec, iteVec, globalIndexDomainZoom(i)))
         {
           indSrv_[rank].push_back(globalIndexDomainZoom(i));
Index: XIOS/trunk/src/node/grid.cpp
===================================================================
--- XIOS/trunk/src/node/grid.cpp	(revision 584)
+++ XIOS/trunk/src/node/grid.cpp	(revision 585)
@@ -336,5 +336,6 @@
      // Finally, compute index mapping between client(s) and server(s)
      clientServerMap_ = new CClientServerMappingDistributed(serverDistributionDescription_->getGlobalIndexRange(),
-                                                            client->intraComm);
+                                                            client->intraComm,
+                                                            clientDistribution_->isDataDistributed());
 
      clientServerMap_->computeServerIndexMapping(clientDistribution_->getGlobalIndex());
@@ -501,28 +502,32 @@
     if (!doGridHaveDataDistributed())
     {
-//      if (0 == client->clientRank)
-//      {
-//       for (int ns = 0; itGlobal != iteMap; ++itGlobal, ++itLocal, ++ns)
-//        {
-//          rank = itGlobal->first;
-//          int nb = (itGlobal->second).size();
-//
-//          CArray<size_t, 1> outGlobalIndexOnServer(nb);
-//          CArray<int, 1> outLocalIndexToServer(nb);
-//          for (int k = 0; k < nb; ++k)
-//          {
-//            outGlobalIndexOnServer(k) = itGlobal->second.at(k);
-//            outLocalIndexToServer(k)  = itLocal->second.at(k);
-//          }
-//
-//          storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer) ));
-//          listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer));
-//
-//          list_msg.push_back(shared_ptr<CMessage>(new CMessage));
-//          *list_msg.back()<<getId()<<*listOutIndex.back();
-//          event.push(rank, 1, *list_msg.back());
-//        }
-//        client->sendEvent(event);
-//      } else client->sendEvent(event);
+      if (0 == client->clientRank)
+      {
+        for (rank = 0; rank < client->serverSize; ++rank)
+        {
+          int nb = 0;
+          if (globalIndexTmp.end() != globalIndexTmp.find(rank))
+            nb = globalIndexTmp[rank].size();
+
+          CArray<size_t, 1> outGlobalIndexOnServer(nb);
+          CArray<int, 1> outLocalIndexToServer(nb);
+          for (int k = 0; k < nb; ++k)
+          {
+            outGlobalIndexOnServer(k) = globalIndexTmp[rank].at(k);
+            outLocalIndexToServer(k)  = localIndexTmp[rank].at(k);
+          }
+
+          storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer) ));
+          listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer));
+
+          list_msg.push_back(shared_ptr<CMessage>(new CMessage));
+          *list_msg.back()<<getId()<<*listOutIndex.back();
+
+          event.push(rank, 1, *list_msg.back());
+        }
+        client->sendEvent(event);
+      }
+      else
+        client->sendEvent(event);
     }
     else
