Index: /XIOS/dev/dev_olga/src/io/nc4_data_output.cpp
===================================================================
--- /XIOS/dev/dev_olga/src/io/nc4_data_output.cpp	(revision 1142)
+++ /XIOS/dev/dev_olga/src/io/nc4_data_output.cpp	(revision 1143)
@@ -379,6 +379,4 @@
                      if (domain->hasLonLat)
                      {
-                       // SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count);
-                       // SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count);
                        SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count);
                        SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count);
@@ -396,7 +394,4 @@
                          start[0]=0 ;
                          count[0]=0 ;
-                         // SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count);
-                         // SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count);
-
                          SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count);
                          SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count);
@@ -405,12 +400,10 @@
                        { 
                          start[0]=domain->zoom_jbegin-domain->global_zoom_jbegin;
-                         count[0]=domain->zoom_nj;
-                         // CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,domain->zoom_ni));
+                         count[0]=domain->zoom_nj;                         
                          CArray<double,1> lat = writtenLat(Range(fromStart,toEnd,domain->zoom_ni));
                          SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count);
 
                          start[0]=domain->zoom_ibegin-domain->global_zoom_ibegin;
-                         count[0]=domain->zoom_ni;
-                         // CArray<double,1> lon=domain->lonvalue(Range(0,domain->zoom_ni-1));
+                         count[0]=domain->zoom_ni;                         
                          CArray<double,1> lon = writtenLon(Range(0,domain->zoom_ni-1));
                          SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count);
@@ -439,7 +432,5 @@
                      count[0] = domain->zoom_nj;
                    }
-
-                 // SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0, &start, &count);
-                 // SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0, &start, &count);
+                 
                    SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0, &start, &count);
                    SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0, &start, &count);
@@ -463,6 +454,5 @@
                      count[0] = domain->zoom_nj;
                    }
-
-                   // SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count);
+                   
                    SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0, &start, &count);
                  }
@@ -1390,14 +1380,15 @@
            SuperClassWriter::addAttribute("compress", compress.str(), &varId);
 
-           grid->computeCompressedIndex();
+           // grid->computeCompressedIndex();
 
            CArray<int, 1> indexes(grid->getNumberWrittenIndexes());
-           std::map<int, CArray<size_t, 1> >::const_iterator it;
-           for (it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it)
-           {
-             const CArray<size_t, 1> compressedIndexes = grid->compressedOutIndexFromClient[it->first];
-             for (int i = 0; i < it->second.numElements(); i++)
-               indexes(compressedIndexes(i)) = it->second(i);
-           }
+           indexes = grid->localIndexToWriteOnServer;
+           // std::map<int, CArray<size_t, 1> >::const_iterator it;
+           // for (it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it)
+           // {
+           //   const CArray<size_t, 1> compressedIndexes = grid->compressedOutIndexFromClient[it->first];
+           //   for (int i = 0; i < it->second.numElements(); i++)
+           //     indexes(compressedIndexes(i)) = it->second(i);
+           // }
 
            switch (SuperClass::type)
@@ -1456,8 +1447,11 @@
                }
 
-               const std::vector<int>& indexesToWrite = domain->getIndexesToWrite();
-               indexes.resize(indexesToWrite.size());
-               for (int n = 0; n < indexes.numElements(); ++n)
-                 indexes(n) = indexesToWrite[n];
+               // const std::vector<int>& indexesToWrite = domain->getIndexesToWrite();
+               // indexes.resize(indexesToWrite.size());
+               // for (int n = 0; n < indexes.numElements(); ++n)
+               //   indexes(n) = indexesToWrite[n];
+
+               indexes.resize(domain->compressedIndexToWriteOnServer.numElements());
+               indexes = domain->compressedIndexToWriteOnServer;
 
                isDistributed = domain->isDistributed();
@@ -1484,8 +1478,11 @@
                compress = axisId;
 
-               const std::vector<int>& indexesToWrite = axis->getIndexesToWrite();
-               indexes.resize(indexesToWrite.size());
-               for (int n = 0; n < indexes.numElements(); ++n)
-                 indexes(n) = indexesToWrite[n];
+               // const std::vector<int>& indexesToWrite = axis->getIndexesToWrite();
+               // indexes.resize(indexesToWrite.size());
+               // for (int n = 0; n < indexes.numElements(); ++n)
+               //   indexes(n) = indexesToWrite[n];
+
+               indexes.resize(axis->compressedIndexToWriteOnServer.numElements());
+               indexes = axis->compressedIndexToWriteOnServer;
 
                isDistributed = axis->isDistributed();
@@ -1534,6 +1531,6 @@
            }
 
-           if (!dims.empty())
-             grid->computeCompressedIndex();
+           // if (!dims.empty())
+           //   grid->computeCompressedIndex();
          }
 
@@ -2181,76 +2178,4 @@
               case (ONE_FILE) :
               {
-                // const std::vector<int>& nZoomBeginGlobal = grid->getDistributionServer()->getZoomBeginGlobal();
-                // const std::vector<int>& nZoomBeginServer = grid->getDistributionServer()->getZoomBeginServer();
-                // const std::vector<int>& nZoomSizeServer  = grid->getDistributionServer()->getZoomSizeServer();
-
-                // std::vector<StdSize> start, count;
-
-                // if (field->getUseCompressedOutput())
-                // {
-                //   if (grid->isCompressible())
-                //   {
-                //     start.push_back(grid->getOffsetWrittenIndexes());
-                //     count.push_back(grid->getNumberWrittenIndexes());
-                //   }
-                //   else
-                //   {
-                //     CArray<int,1> axisDomainOrder = grid->axis_domain_order;
-                //     std::vector<StdString> domainList = grid->getDomainList();
-                //     std::vector<StdString> axisList   = grid->getAxisList();
-                //     int numElement = axisDomainOrder.numElements();
-                //     int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1;
-                //     int idx = nZoomBeginGlobal.size() - 1;
-
-                //     start.reserve(nZoomBeginGlobal.size());
-                //     count.reserve(nZoomBeginGlobal.size());
-
-
-                //     for (int i = numElement - 1; i >= 0; --i)
-                //     {
-                //       if (2 == axisDomainOrder(i))
-                //       {
-                //         CDomain* domain = CDomain::get(domainList[idxDomain]);
-
-                //         if (domain->isCompressible())
-                //         {
-                //           start.push_back(domain->getOffsetWrittenIndexes());
-                //           count.push_back(domain->getNumberWrittenIndexes());
-                //           idx -= 2;
-                //         }
-                //         else
-                //         {
-                //           if ((domain->type) != CDomain::type_attr::unstructured)
-                //           {
-                //             start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                //             count.push_back(nZoomSizeServer[idx]);
-                //           }
-                //           --idx;
-                //           start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                //           count.push_back(nZoomSizeServer[idx]);
-                //           --idx;
-                //         }
-                //         --idxDomain;
-                //       }
-                //       else if (1 == axisDomainOrder(i))
-                //       {
-                //         CAxis* axis = CAxis::get(axisList[idxAxis]);
-
-                //         if (axis->isCompressible())
-                //         {
-                //           start.push_back(axis->getOffsetWrittenIndexes());
-                //           count.push_back(axis->getNumberWrittenIndexes());
-                //         }
-                //         else
-                //         {
-                //           start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                //           count.push_back(nZoomSizeServer[idx]);
-                //         }
-
-                //         --idxAxis;
-                //         --idx;
-                //       }
-                //     }
-                //   }
                 const std::vector<int>& nZoomBeginGlobal = grid->getDistributionServer()->getZoomBeginGlobal();
                 const std::vector<int>& nZoomBeginServer = grid->getDistributionServer()->getZoomBeginServer();
@@ -2328,45 +2253,4 @@
                 else
                 {
-                  // CArray<int,1> axisDomainOrder = grid->axis_domain_order;
-                  // std::vector<StdString> domainList = grid->getDomainList();
-                  // std::vector<StdString> axisList   = grid->getAxisList();
-                  // int numElement = axisDomainOrder.numElements();
-                  // int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1;
-                  // int idx = nZoomBeginGlobal.size() - 1;
-
-                  // start.reserve(nZoomBeginGlobal.size());
-                  // count.reserve(nZoomBeginGlobal.size());
-
-                  // for (int i = numElement - 1; i >= 0; --i)
-                  // {
-                  //   if (2 == axisDomainOrder(i))
-                  //   {
-                  //     CDomain* domain = CDomain::get(domainList[idxDomain]);
-                  //     if ((domain->type) != CDomain::type_attr::unstructured)
-                  //     {
-                  //       start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                  //       count.push_back(nZoomSizeServer[idx]);
-                  //     }
-                  //     --idx ;
-                  //     start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                  //     count.push_back(nZoomSizeServer[idx]);
-                  //     --idx ;
-                  //     --idxDomain;
-                  //   }
-                  //   else if (1 == axisDomainOrder(i))
-                  //   {
-                  //     start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                  //     count.push_back(nZoomSizeServer[idx]);
-                  //     --idx;
-                  //   }
-                  //   else
-                  //   {
-                  //     if (1 == axisDomainOrder.numElements())
-                  //     {
-                  //       start.push_back(0);
-                  //       count.push_back(1);
-                  //     }
-                  //     --idx;
-                  //   }
                   CArray<int,1> axisDomainOrder = grid->axis_domain_order;
                   std::vector<StdString> domainList = grid->getDomainList();
@@ -2386,16 +2270,9 @@
                       if ((domain->type) != CDomain::type_attr::unstructured)
                       {
-                        // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                        // count.push_back(nZoomSizeServer[idx]);
-                        // start.push_back((domain->getStartWriteIndex())[idx]);
-                        // count.push_back((domain->getCountWriteIndex())[idx]);
                         start.push_back(domain->zoom_jbegin - domain->global_zoom_jbegin);
                         count.push_back(domain->zoom_nj);
                       }
                       --idx ;
-                      // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
-                      // count.push_back(nZoomSizeServer[idx]);
-                      // start.push_back((domain->getStartWriteIndex())[idx]);
-                      // count.push_back((domain->getCountWriteIndex())[idx]);
+
                         start.push_back(domain->zoom_ibegin - domain->global_zoom_ibegin);
                         count.push_back(domain->zoom_ni);
@@ -2405,7 +2282,5 @@
                     else if (1 == axisDomainOrder(i))
                     {
-                      CAxis* axis = CAxis::get(axisList[idxAxis]);
-                      // start.push_back(axis->getStartWriteIndex());
-                      // count.push_back(axis->getCountWriteIndex());
+                        CAxis* axis = CAxis::get(axisList[idxAxis]);
                         start.push_back(axis->zoom_begin - axis->global_zoom_begin);
                         count.push_back(axis->zoom_n);
Index: /XIOS/dev/dev_olga/src/node/axis.cpp
===================================================================
--- /XIOS/dev/dev_olga/src/node/axis.cpp	(revision 1142)
+++ /XIOS/dev/dev_olga/src/node/axis.cpp	(revision 1143)
@@ -25,5 +25,5 @@
       , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false)
       , isClientAfterTransformationChecked(false)
-      , isDistributed_(false), hasBounds_(false), isCompressible_(false)
+      , hasBounds_(false), isCompressible_(false)
       , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0)
       , transformationMap_(), hasValue(false), doZoomByIndex_(false)
@@ -36,5 +36,5 @@
       , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false)
       , isClientAfterTransformationChecked(false)
-      , isDistributed_(false), hasBounds_(false), isCompressible_(false)
+      , hasBounds_(false), isCompressible_(false)
       , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0)
       , transformationMap_(), hasValue(false), doZoomByIndex_(false)
@@ -76,5 +76,6 @@
    bool CAxis::isDistributed(void) const
    {
-      return isDistributed_;
+      return (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) ||
+             (!this->n.isEmpty() && (this->n != this->n_glo));;
    }
 
@@ -266,8 +267,5 @@
       this->checkZoom();
       this->checkMask();
-      this->checkBounds();
-
-      isDistributed_ = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) ||
-                       (!this->n.isEmpty() && (this->n != this->n_glo));
+      this->checkBounds();      
    }
 
@@ -613,6 +611,6 @@
       computedWrittenIndex_ = true;
 
-      CContext* context=CContext::getCurrent() ;
-      CContextClient* client = context->client; 
+      CContext* context=CContext::getCurrent();      
+      CContextServer* server = context->server; 
 
       std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1);
@@ -621,5 +619,5 @@
       nBeginGlobal[0] = 0; 
       nGlob[0]        = n_glo;
-      CDistributionServer srvDist(client->clientSize, nBegin, nSize, nBeginGlobal, nGlob); 
+      CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 
       const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex();
 
@@ -628,6 +626,18 @@
                                                           ite = globalLocalIndexMap_.end(), it;          
       CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(),
-                                       itSrve = writtenGlobalIndex.end(), itSrv;
-      localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements());
+                                       itSrve = writtenGlobalIndex.end(), itSrv;      
+
+      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+      {
+        indGlo = *itSrv;
+        if (ite != globalLocalIndexMap_.find(indGlo))
+        {          
+          ++nbWritten;
+        }                 
+      }
+
+      localIndexToWriteOnServer.resize(nbWritten);
+
+      nbWritten = 0;
       for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
       {
@@ -638,4 +648,50 @@
           ++nbWritten;
         }                 
+      }
+
+      if (isCompressible())
+      {
+        nbWritten = 0;
+        boost::unordered_map<size_t,size_t> localGlobalIndexMap;
+        for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+        {
+          indGlo = *itSrv;
+          if (ite != globalLocalIndexMap_.find(indGlo))
+          {
+            localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo;
+            ++nbWritten;
+          }                 
+        }
+
+        nbWritten = 0;
+        for (int idx = 0; idx < data_index.numElements(); ++idx)
+        {
+          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
+          {
+            ++nbWritten;
+          }
+        }
+
+        compressedIndexToWriteOnServer.resize(nbWritten);
+        nbWritten = 0;
+        for (int idx = 0; idx < data_index.numElements(); ++idx)
+        {
+          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
+          {
+            compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_index(idx)];
+            ++nbWritten;
+          }
+        }
+
+        numberWrittenIndexes_ = nbWritten;
+        if (isDistributed())
+        {
+               
+          MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+          MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+          offsetWrittenIndexes_ -= numberWrittenIndexes_;
+        }
+        else
+          totalNumberWrittenIndexes_ = numberWrittenIndexes_;
       }
 
Index: /XIOS/dev/dev_olga/src/node/axis.hpp
===================================================================
--- /XIOS/dev/dev_olga/src/node/axis.hpp	(revision 1142)
+++ /XIOS/dev/dev_olga/src/node/axis.hpp	(revision 1143)
@@ -131,4 +131,5 @@
         int orderPosInGrid;
         CArray<size_t,1> localIndexToWriteOnServer;
+        CArray<int, 1> compressedIndexToWriteOnServer;
 
       private:
@@ -159,6 +160,5 @@
          bool isClientAfterTransformationChecked;
          std::set<StdString> relFiles, relFilesCompressed;
-         TransMapTypes transformationMap_;
-         bool isDistributed_;
+         TransMapTypes transformationMap_;         
          //! True if and only if the data defined on the axis can be outputted in a compressed way
          bool isCompressible_;
Index: /XIOS/dev/dev_olga/src/node/domain.cpp
===================================================================
--- /XIOS/dev/dev_olga/src/node/domain.cpp	(revision 1142)
+++ /XIOS/dev/dev_olga/src/node/domain.cpp	(revision 1143)
@@ -31,5 +31,5 @@
       : CObjectTemplate<CDomain>(), CDomainAttributes()
       , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_()
-      , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false)
+      , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false)
       , isClientAfterTransformationChecked(false), hasLonLat(false)
       , isRedistributed_(false), hasPole(false), doZoomByIndex_(false)
@@ -42,5 +42,5 @@
       : CObjectTemplate<CDomain>(id), CDomainAttributes()
       , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_()
-      , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false)
+      , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false)
       , isClientAfterTransformationChecked(false), hasLonLat(false)
       , isRedistributed_(false), hasPole(false), doZoomByIndex_(false)
@@ -235,5 +235,6 @@
    bool CDomain::isDistributed(void) const
    {
-      return isDistributed_;
+      return !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) ||
+              (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo));
    }
 
@@ -741,7 +742,4 @@
      }     
      checkZoom();
-
-     isDistributed_ = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) ||
-                        (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo));
    }
 
@@ -1835,6 +1833,6 @@
       computedWrittenIndex_ = true;
 
-      CContext* context=CContext::getCurrent() ;
-      CContextClient* client = context->client; 
+      CContext* context=CContext::getCurrent();      
+      CContextServer* server = context->server;  
 
       std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2);
@@ -1843,5 +1841,5 @@
       nBeginGlobal[0] = 0; nBeginGlobal[1] = 0;
       nGlob[0]        = ni_glo;   nGlob[1] = nj_glo;
-      CDistributionServer srvDist(client->clientSize, nBegin, nSize, nBeginGlobal, nGlob); 
+      CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 
       const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex();
 
@@ -1851,5 +1849,17 @@
       CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(),
                                        itSrve = writtenGlobalIndex.end(), itSrv;
-      localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements());
+
+      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+      {
+        indGlo = *itSrv;
+        if (ite != globalLocalIndexMap_.find(indGlo))
+        {          
+          ++nbWritten;
+        }                 
+      }
+
+      localIndexToWriteOnServer.resize(nbWritten);
+
+      nbWritten = 0;
       for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
       {
@@ -1861,4 +1871,49 @@
         }                 
       }
+      
+      if (isCompressible())
+      {
+        nbWritten = 0;
+        boost::unordered_map<size_t,size_t> localGlobalIndexMap;
+        for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+        {
+          indGlo = *itSrv;
+          if (ite != globalLocalIndexMap_.find(indGlo))
+          {
+            localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo;
+            ++nbWritten;
+          }                 
+        }
+
+        nbWritten = 0;
+        for (int idx = 0; idx < data_i_index.numElements(); ++idx)
+        {
+          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
+          {
+            ++nbWritten;
+          }
+        }
+
+        compressedIndexToWriteOnServer.resize(nbWritten);
+        nbWritten = 0;
+        for (int idx = 0; idx < data_i_index.numElements(); ++idx)
+        {
+          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
+          {
+            compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)];
+            ++nbWritten;
+          }
+        }
+
+        numberWrittenIndexes_ = nbWritten;
+        if (isDistributed())
+        {            
+          MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+          MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+          offsetWrittenIndexes_ -= numberWrittenIndexes_;
+        }
+        else
+          totalNumberWrittenIndexes_ = numberWrittenIndexes_;
+      }      
    }
 
@@ -2988,5 +3043,5 @@
     CArray<int,1> dataIIndex(nbIndex), dataJIndex(nbIndex);
     dataIIndex = -1; dataJIndex = -1;
-
+     
     nbIndex = 0;
     for (i = 0; i < nbReceived; ++i)
Index: /XIOS/dev/dev_olga/src/node/domain.hpp
===================================================================
--- /XIOS/dev/dev_olga/src/node/domain.hpp	(revision 1142)
+++ /XIOS/dev/dev_olga/src/node/domain.hpp	(revision 1143)
@@ -108,4 +108,5 @@
          std::map<int, StdSize> getAttributesBufferSize();
          CArray<size_t,1> localIndexToWriteOnServer;
+         CArray<int, 1> compressedIndexToWriteOnServer;
 
          bool isEmpty(void) const;
@@ -221,6 +222,5 @@
          std::vector<int> recvClientRanks_, recvClientZoomRanks_;
          int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
-         std::vector<int> connectedServerRank_, connectedServerZoomRank_;
-         bool isDistributed_;
+         std::vector<int> connectedServerRank_, connectedServerZoomRank_;         
          //! True if and only if the data defined on the domain can be outputted in a compressed way
          bool isCompressible_;
Index: /XIOS/dev/dev_olga/src/node/field.cpp
===================================================================
--- /XIOS/dev/dev_olga/src/node/field.cpp	(revision 1142)
+++ /XIOS/dev/dev_olga/src/node/field.cpp	(revision 1143)
@@ -1391,9 +1391,4 @@
    void CField::inputField(CArray<double,1>& fieldIn)
    {
-      // map<int, CArray<double,1> >::iterator it;
-      // for (it = data_srv.begin(); it != data_srv.end(); it++)
-      // {
-      //    grid->inputField(it->first, fieldOut.dataFirst(), it->second);
-      // }
       CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient;
       CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer;
@@ -1407,9 +1402,16 @@
    void CField::outputCompressedField(CArray<double,1>& fieldOut)
    {
-      map<int, CArray<double,1> >::iterator it;
-
-      for (it = data_srv.begin(); it != data_srv.end(); it++)
+      // map<int, CArray<double,1> >::iterator it;
+
+      // for (it = data_srv.begin(); it != data_srv.end(); it++)
+      // {
+      //    grid->outputCompressedField(it->first, it->second, fieldOut.dataFirst());
+      // }
+
+      CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient;
+      CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer;
+      for (size_t idx = 0; idx < outIndexServer.numElements(); ++idx)
       {
-         grid->outputCompressedField(it->first, it->second, fieldOut.dataFirst());
+        fieldOut((idx)) = recvDataSrv(outIndexClient(idx));
       }
    }
Index: /XIOS/dev/dev_olga/src/node/grid.cpp
===================================================================
--- /XIOS/dev/dev_olga/src/node/grid.cpp	(revision 1142)
+++ /XIOS/dev/dev_olga/src/node/grid.cpp	(revision 1143)
@@ -561,4 +561,18 @@
       localIndexToWriteOnClient.resize(nbWritten);  
       localIndexToWriteOnServer.resize(nbWritten);
+
+      // if (isCompressible())
+      {
+        numberWrittenIndexes_ = nbWritten;
+        if (isDataDistributed_)
+        {
+          CContextServer* server = CContext::getCurrent()->server;      
+          MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+          MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+          offsetWrittenIndexes_ -= numberWrittenIndexes_;
+        }
+        else
+          totalNumberWrittenIndexes_ = numberWrittenIndexes_;
+      }
 
       nbWritten = 0; 
@@ -1175,10 +1189,4 @@
 
       for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i);
-
-     // This is a solution for multilevel server      
-      // const StdSize size = indexFromClients.numElements();
-
-      // for(StdSize i = 0; i < size; i++) data[indexFromClients(i)] = stored(i);
-
    }
 
@@ -1504,5 +1512,5 @@
 //      CContextServer* server = (context->hasServer) ? context->server : context->serverPrimServer[p];
 //      CContextClient* client = (context->hasServer) ? context->client : context->clientPrimServer[p];
-      numberWrittenIndexes_ = totalNumberWrittenIndexes_ = offsetWrittenIndexes_ = 0;
+      // numberWrittenIndexes_ = totalNumberWrittenIndexes_ = offsetWrittenIndexes_ = 0;
       //connectedServerRank_[p] = ranks;
 
@@ -1602,5 +1610,5 @@
         // outIndexFromClient.insert(std::make_pair(rank, outIndex));
         // connectedDataSize_[p][rank] = outIndex.numElements();
-        numberWrittenIndexes_ += outIndex.numElements();
+        // numberWrittenIndexes_ += outIndex.numElements();
       }
 
@@ -1680,12 +1688,12 @@
       // if (isScalarGrid()) return;
 
-      if (isDataDistributed_)
-      {
-        MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
-        MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
-        offsetWrittenIndexes_ -= numberWrittenIndexes_;
-      }
-      else
-        totalNumberWrittenIndexes_ = numberWrittenIndexes_;
+      // if (isDataDistributed_)
+      // {
+      //   MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+      //   MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+      //   offsetWrittenIndexes_ -= numberWrittenIndexes_;
+      // }
+      // else
+      //   totalNumberWrittenIndexes_ = numberWrittenIndexes_;
 
       nbReadSenders[p] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks);
