Index: XIOS/dev/branch_openmp/src/node/axis.cpp
===================================================================
--- XIOS/dev/branch_openmp/src/node/axis.cpp	(revision 1545)
+++ XIOS/dev/branch_openmp/src/node/axis.cpp	(revision 1642)
@@ -14,6 +14,4 @@
 #include "distribution_client.hpp"
 
-using namespace ep_lib;
-
 namespace xios {
 
@@ -28,5 +26,5 @@
       , transformationMap_(), hasValue(false), hasLabel(false)
       , computedWrittenIndex_(false)
-      , clients()
+	  , clients()
    {
    }
@@ -40,5 +38,5 @@
       , transformationMap_(), hasValue(false), hasLabel(false)
       , computedWrittenIndex_(false)
-      , clients()
+	  , clients()
    {
    }
@@ -47,10 +45,12 @@
    { /* Ne rien faire de plus */ }
 
-   std::map<StdString, ETranformationType> *CAxis::transformationMapList_ptr = 0;
-
+   std::map<StdString, ETranformationType> CAxis::transformationMapList_ = std::map<StdString, ETranformationType>();
+   bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_);
    bool CAxis::initializeTransformationMap(std::map<StdString, ETranformationType>& m)
+   TRY
    {
      m["zoom_axis"] = TRANS_ZOOM_AXIS;
      m["interpolate_axis"] = TRANS_INTERPOLATE_AXIS;
+     m["extract_axis"] = TRANS_EXTRACT_AXIS;
      m["inverse_axis"] = TRANS_INVERSE_AXIS;
      m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_AXIS;
@@ -59,45 +59,42 @@
      m["temporal_splitting"] = TRANS_TEMPORAL_SPLITTING;
      m["duplicate_scalar"] = TRANS_DUPLICATE_SCALAR_TO_AXIS;
-   }
-
-   bool CAxis::initializeTransformationMap()
-   {
-     if(CAxis::transformationMapList_ptr == 0) CAxis::transformationMapList_ptr = new std::map<StdString, ETranformationType>();
-     (*CAxis::transformationMapList_ptr)["zoom_axis"]        = TRANS_ZOOM_AXIS;
-     (*CAxis::transformationMapList_ptr)["interpolate_axis"] = TRANS_INTERPOLATE_AXIS;
-     (*CAxis::transformationMapList_ptr)["inverse_axis"]     = TRANS_INVERSE_AXIS;
-     (*CAxis::transformationMapList_ptr)["reduce_domain"]    = TRANS_REDUCE_DOMAIN_TO_AXIS;
-     (*CAxis::transformationMapList_ptr)["extract_domain"]   = TRANS_EXTRACT_DOMAIN_TO_AXIS;
-     (*CAxis::transformationMapList_ptr)["reduce_axis"]      = TRANS_REDUCE_AXIS_TO_AXIS;
-     (*CAxis::transformationMapList_ptr)["temporal_splitting"] = TRANS_TEMPORAL_SPLITTING;
-     (*CAxis::transformationMapList_ptr)["duplicate_scalar"] = TRANS_DUPLICATE_SCALAR_TO_AXIS;
-   }
+
+   }
+   CATCH
 
    ///---------------------------------------------------------------
 
    const std::set<StdString> & CAxis::getRelFiles(void) const
+   TRY
    {
       return (this->relFiles);
    }
+   CATCH
 
    bool CAxis::IsWritten(const StdString & filename) const
+   TRY
    {
       return (this->relFiles.find(filename) != this->relFiles.end());
    }
+   CATCH
 
    bool CAxis::isWrittenCompressed(const StdString& filename) const
+   TRY
    {
       return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end());
    }
+   CATCH
 
    bool CAxis::isDistributed(void) const
+   TRY
    {
       bool distributed = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) ||
              (!this->n.isEmpty() && (this->n != this->n_glo));
-      // A same stupid condition to make sure that if there is only one client, axis
+      // A condition to make sure that if there is only one client, axis
       // should be considered to be distributed. This should be a temporary solution     
       distributed |= (1 == CContext::getCurrent()->client->clientSize);
       return distributed;
    }
+   CATCH
 
    /*!
@@ -107,17 +104,23 @@
     */
    bool CAxis::isCompressible(void) const
+   TRY
    {
       return isCompressible_;
    }
+   CATCH
 
    void CAxis::addRelFile(const StdString & filename)
+   TRY
    {
       this->relFiles.insert(filename);
    }
+   CATCH_DUMP_ATTR
 
    void CAxis::addRelFileCompressed(const StdString& filename)
+   TRY
    {
       this->relFilesCompressed.insert(filename);
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
@@ -128,4 +131,5 @@
    */
    int CAxis::getNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom)
+   TRY
    {
      int writtenSize;
@@ -133,4 +137,5 @@
      return numberWrittenIndexes_[writtenSize];
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -139,4 +144,5 @@
    */
    int CAxis::getTotalNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom)
+   TRY
    {
      int writtenSize;
@@ -144,4 +150,5 @@
      return totalNumberWrittenIndexes_[writtenSize];
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -150,4 +157,5 @@
    */
    int CAxis::getOffsetWrittenIndexes(ep_lib::MPI_Comm writtenCom)
+   TRY
    {
      int writtenSize;
@@ -155,6 +163,8 @@
      return offsetWrittenIndexes_[writtenSize];
    }
+   CATCH_DUMP_ATTR
 
    CArray<int, 1>& CAxis::getCompressedIndexToWriteOnServer(ep_lib::MPI_Comm writtenCom)
+   TRY
    {
      int writtenSize;
@@ -162,4 +172,6 @@
      return compressedIndexToWriteOnServer[writtenSize];
    }
+   CATCH_DUMP_ATTR
+
    //----------------------------------------------------------------
 
@@ -171,4 +183,5 @@
    std::map<int, StdSize> CAxis::getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid,
                                                          CServerDistributionDescription::ServerDistributionType distType)
+   TRY
    {
 
@@ -234,7 +247,7 @@
        }
      }
-
      return attributesSizes;
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
@@ -247,8 +260,10 @@
 
    CAxis* CAxis::createAxis()
+   TRY
    {
      CAxis* axis = CAxisGroup::get("axis_definition")->createChild();
      return axis;
    }
+   CATCH
 
    /*!
@@ -257,6 +272,9 @@
    */
    void CAxis::checkAttributes(void)
-   {
-      if (this->n_glo.isEmpty())
+   TRY
+   {
+     CContext* context=CContext::getCurrent();
+
+     if (this->n_glo.isEmpty())
         ERROR("CAxis::checkAttributes(void)",
               << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] "
@@ -298,12 +316,16 @@
       }
 
-      // Remove this check because it doen't make sense in case of a hole or overlapping axes
       if (!this->value.isEmpty())
       {
-//        StdSize true_size = value.numElements();
-//        if (this->n.getValue() != true_size)
-//          ERROR("CAxis::checkAttributes(void)",
-//                << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] "
-//                << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size << ") than the one defined by the \'size\' attribute (" << n.getValue() << ").");
+        // Avoid this check at writing because it fails in case of a hole
+        if (context->hasClient)
+        {
+          StdSize true_size = value.numElements();
+          if (this->n.getValue() != true_size)
+            ERROR("CAxis::checkAttributes(void)",
+                << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] "
+                << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size
+                << ") than the one defined by the \'size\' attribute (" << n.getValue() << ").");
+        }
         this->hasValue = true;
       }
@@ -311,18 +333,18 @@
       this->checkBounds();
 
-      CContext* context=CContext::getCurrent();
       if (context->hasClient)
       {
+        this->checkMask();
         this->checkData();
-        this->checkZoom();
-        this->checkMask();
         this->checkLabel();
       }
    }
+   CATCH_DUMP_ATTR
 
    /*!
-      Check the validity of data and fill in values if any.
+      Check the validity of data, fill in values if any, and apply mask.
    */
    void CAxis::checkData()
+   TRY
    {
       if (data_begin.isEmpty()) data_begin.setValue(0);
@@ -342,27 +364,38 @@
       {
         data_index.resize(data_n);
-        for (int i = 0; i < data_n; ++i) data_index(i) = i;
-      }
-   }
-
-   /*!
-     Check validity of zoom info and fill in values if any.
-   */
-   void CAxis::checkZoom(void)
-   {
-     if (global_zoom_begin.isEmpty()) global_zoom_begin.setValue(0);
-     if (global_zoom_n.isEmpty()) global_zoom_n.setValue(n_glo.getValue());
-     if (zoom_index.isEmpty())
-     {
-       zoom_index.setValue(index.getValue());
-     }
-     if (zoom_n.isEmpty()) zoom_n.setValue(n);
-     if (zoom_begin.isEmpty()) zoom_begin.setValue(begin);
-   }
+        for (int i = 0; i < data_n; ++i)
+        {
+          if ((i+data_begin) >= 0 && (i+data_begin<n))
+          {
+            if (mask(i+data_begin))
+              data_index(i) = i+data_begin;
+            else
+              data_index(i) = -1;
+          }
+          else
+            data_index(i) = -1;
+        }
+      }
+      else
+      {
+        if (data_index.numElements() != data_n)
+        {
+          ERROR("CAxis::checkData(void)",
+                << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+                << "The size of data_index = "<< data_index.numElements() << "is not equal to the data size data_n = " << data_n.getValue() << ").");
+        }
+        for (int i = 0; i < data_n; ++i)
+        {
+          if ((i+data_begin) >= 0 && (i+data_begin<n) && !mask(i+data_begin))
+            data_index(i) = -1;
+        }
+      }
+
+   }
+   CATCH_DUMP_ATTR
 
     size_t CAxis::getGlobalWrittenSize(void)
     {
-      if (zoomByIndex()) return  global_zoom_index.numElements();
-      else return global_zoom_n ;
+      return n_glo ;
     }
 
@@ -371,23 +404,24 @@
    */
    void CAxis::checkMask()
+   TRY
    {
       if (!mask.isEmpty())
       {
-         if (mask.extent(0) != n)
-           ERROR("CAxis::checkMask(void)",
-                 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-                 << "The mask does not have the same size as the local domain." << std::endl
-                 << "Local size is " << n.getValue() << "." << std::endl
-                 << "Mask size is " << mask.extent(0) << ".");
-      }
-      else // (mask.isEmpty())
-      { // If no mask was defined, we create a default one without any masked point.
-         mask.resize(n);
-         for (int i = 0; i < n; ++i)
-         {
-           mask(i) = true;
-         }
-      }
-   }
+        if (mask.extent(0) != n)
+        {
+          ERROR("CAxis::checkMask(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "The mask does not have the same size as the local domain." << std::endl
+              << "Local size is " << n.getValue() << "." << std::endl
+              << "Mask size is " << mask.extent(0) << ".");
+        }
+      }
+      else
+      {
+        mask.resize(n);
+        mask = true;
+      }
+   }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -395,4 +429,5 @@
    */
    void CAxis::checkBounds()
+   TRY
    {
      if (!bounds.isEmpty())
@@ -407,6 +442,8 @@
      else hasBounds = false;
    }
+   CATCH_DUMP_ATTR
 
   void CAxis::checkLabel()
+  TRY
   {
     if (!label.isEmpty())
@@ -421,4 +458,5 @@
     else hasLabel = false;
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -426,17 +464,10 @@
   */
   void CAxis::checkEligibilityForCompressedOutput()
+  TRY
   {
     // We don't check if the mask is valid here, just if a mask has been defined at this point.
     isCompressible_ = !mask.isEmpty();
   }
-
-  /*
-    Check whether we do zooming by indexing
-    return true if do zooming by index
-  */
-  bool CAxis::zoomByIndex()
-  {
-    return (!global_zoom_index.isEmpty() && (0 != global_zoom_index.numElements()));
-  }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -444,4 +475,5 @@
   */
   bool CAxis::dispatchEvent(CEventServer& event)
+  TRY
   {
      if (SuperClass::dispatchEvent(event)) return true;
@@ -469,4 +501,5 @@
      }
   }
+  CATCH
 
    /*!
@@ -474,4 +507,5 @@
    */
    void CAxis::checkAttributesOnClient()
+   TRY
    {
      if (this->areClientAttributesChecked_) return;
@@ -482,4 +516,5 @@
      this->areClientAttributesChecked_ = true;
    }
+   CATCH_DUMP_ATTR
 
    /*
@@ -489,4 +524,5 @@
    void CAxis::checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid,
                                                           CServerDistributionDescription::ServerDistributionType distType)
+   TRY
    {
      CContext* context=CContext::getCurrent() ;
@@ -502,4 +538,5 @@
      this->isClientAfterTransformationChecked = true;
    }
+   CATCH_DUMP_ATTR
 
    /*
@@ -512,4 +549,5 @@
    void CAxis::sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
                                      CServerDistributionDescription::ServerDistributionType distType)
+   TRY
    {
      if (!this->areClientAttributesChecked_) checkAttributesOnClient();
@@ -522,4 +560,5 @@
      this->isChecked = true;
    }
+   CATCH_DUMP_ATTR
 
   /*!
@@ -530,4 +569,5 @@
   void CAxis::sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
                              CServerDistributionDescription::ServerDistributionType distType)
+  TRY
   {
      sendDistributionAttribute(globalDim, orderPositionInGrid, distType);
@@ -544,4 +584,5 @@
      }     
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -555,4 +596,5 @@
   void CAxis::computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid,
                                      CServerDistributionDescription::ServerDistributionType distType)
+  TRY
   {
     CContext* context = CContext::getCurrent();
@@ -574,6 +616,4 @@
         size_t ni = this->n.getValue();
         size_t ibegin = this->begin.getValue();
-        size_t global_zoom_end = global_zoom_begin+global_zoom_n-1;
-        size_t nZoomCount = 0;
         size_t nbIndex = index.numElements();
 
@@ -588,19 +628,18 @@
 
         // Calculate the compressed index if any
-        std::set<int> writtenInd;
-        if (isCompressible_)
-        {
-          for (int idx = 0; idx < data_index.numElements(); ++idx)
-          {
-            int ind = CDistributionClient::getAxisIndex(data_index(idx), data_begin, ni);
-
-            if (ind >= 0 && ind < ni && mask(ind))
-            {
-              ind += ibegin;
-              if (ind >= global_zoom_begin && ind <= global_zoom_end)
-                writtenInd.insert(ind);
-            }
-          }
-        }
+//        std::set<int> writtenInd;
+//        if (isCompressible_)
+//        {
+//          for (int idx = 0; idx < data_index.numElements(); ++idx)
+//          {
+//            int ind = CDistributionClient::getAxisIndex(data_index(idx), data_begin, ni);
+//
+//            if (ind >= 0 && ind < ni && mask(ind))
+//            {
+//              ind += ibegin;
+//              writtenInd.insert(ind);
+//            }
+//          }
+//        }
 
         // Compute the global index of the current client (process) hold
@@ -635,5 +674,5 @@
 
         CServerDistributionDescription serverDescription(nGlobAxis, nbServer, distType);
-
+      
         std::vector<int> serverZeroIndex;
         serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t&,size_t&>(indexBegin, indexEnd), 0);
@@ -654,12 +693,8 @@
         if (distType==CServerDistributionDescription::ROOT_DISTRIBUTION)
         {
-          for(int i=1; i<nbServer; ++i) 
-          {
-            indSrv_[nbServer].insert(pair<int, vector<size_t> >(i,indSrv_[nbServer][0]) ) ;
-          }
-
+          for(int i=1; i<nbServer; ++i) indSrv_[nbServer].insert(pair<int, vector<size_t> >(i,indSrv_[nbServer][0]) ) ;
           serverZeroIndexLeader.clear() ;
         }
-
+         
         CClientServerMapping::GlobalIndexMap::const_iterator it  = indSrv_[nbServer].begin(),
                                                              ite = indSrv_[nbServer].end();
@@ -675,5 +710,5 @@
           connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize);
 
-         nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]);
+        nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]);
 
         delete clientServerMap;
@@ -681,4 +716,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -688,4 +724,5 @@
   */
   void CAxis::computeWrittenIndex()
+  TRY
   {  
     if (computedWrittenIndex_) return;
@@ -697,6 +734,6 @@
     // We describe the distribution of client (server) on which data are written
     std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1);
-    nBegin[0]       = zoom_begin;
-    nSize[0]        = zoom_n;   
+    nBegin[0]       = begin;
+    nSize[0]        = n;
     nBeginGlobal[0] = 0; 
     nGlob[0]        = n_glo;
@@ -711,56 +748,26 @@
     CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(),
                                      itSrve = writtenGlobalIndex.end(), itSrv;  
-    if (!zoomByIndex())
-    {   
-      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
-      {
-        indGlo = *itSrv;
-        if (ite != globalLocalIndexMap_.find(indGlo))
-        {          
-          ++nbWritten;
-        }                 
-      }
-
-      localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements());
-//      localIndexToWriteOnServer.resize(nbWritten);
-
-      nbWritten = 0;
-      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
-      {
-        indGlo = *itSrv;
-        if (ite != globalLocalIndexMap_.find(indGlo))
-        {
-          localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo];
-          ++nbWritten;
-        }                 
-      }
-    }
-    else
-    {
-      nbWritten = 0;
-      std::unordered_map<size_t,size_t>::const_iterator itb = globalLocalIndexMap_.begin(),
-                                                          ite = globalLocalIndexMap_.end(), it;
-      for (int i = 0; i < zoom_index.numElements(); ++i)
-      {
-         if (ite != globalLocalIndexMap_.find(zoom_index(i)))
-          ++nbWritten;
-      }
-
-      localIndexToWriteOnServer.resize(nbWritten);
-
-      nbWritten = 0;
-      for (int i = 0; i < zoom_index.numElements(); ++i)
-      {
-         if (ite != globalLocalIndexMap_.find(zoom_index(i)))
-         {
-           localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[zoom_index(i)];
-           ++nbWritten;
-         }
-      }
-    }
-
-  }
+
+    localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements());
+    nbWritten = 0;
+    for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+    {
+      indGlo = *itSrv;
+      if (ite != globalLocalIndexMap_.find(indGlo))
+      {
+        localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo];
+      }
+      else
+      {
+        localIndexToWriteOnServer(nbWritten) = -1;
+      }
+      ++nbWritten;
+    }
+
+  }
+  CATCH_DUMP_ATTR
 
   void CAxis::computeWrittenCompressedIndex(ep_lib::MPI_Comm writtenComm)
+  TRY
   {
     int writtenCommSize;
@@ -777,6 +784,6 @@
       // We describe the distribution of client (server) on which data are written
       std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1);
-      nBegin[0]       = zoom_begin;
-      nSize[0]        = zoom_n;   
+      nBegin[0]       = 0;
+      nSize[0]        = n;
       nBeginGlobal[0] = 0; 
       nGlob[0]        = n_glo;
@@ -798,4 +805,24 @@
         }                 
       }
+//
+//      nbWritten = 0;
+//      for (int idx = 0; idx < data_index.numElements(); ++idx)
+//      {
+//        if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
+//        {
+//          ++nbWritten;
+//        }
+//      }
+//
+//      compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten);
+//      nbWritten = 0;
+//      for (int idx = 0; idx < data_index.numElements(); ++idx)
+//      {
+//        if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
+//        {
+//          compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_index(idx)];
+//          ++nbWritten;
+//        }
+//      }
 
       nbWritten = 0;
@@ -823,6 +850,6 @@
       {
              
-        ep_lib::MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
-        ep_lib::MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
+        ep_lib::MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, EP_INT, EP_SUM, writtenComm);
+        ep_lib::MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, EP_INT, EP_SUM, writtenComm);
         offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize];
       }
@@ -831,4 +858,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -841,4 +869,5 @@
   void CAxis::sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid,
                                         CServerDistributionDescription::ServerDistributionType distType)
+  TRY
   {
     std::list<CContextClient*>::iterator it;
@@ -865,10 +894,9 @@
           const int begin = serverIndexBegin[*itRank][orderPositionInGrid];
           const int ni    = serverDimensionSizes[*itRank][orderPositionInGrid];
-          const int end   = begin + ni - 1;          
 
           msgs.push_back(CMessage());
           CMessage& msg = msgs.back();
           msg << this->getId();
-          msg << ni << begin << end;          
+          msg << ni << begin;
           msg << isCompressible_;                    
 
@@ -880,4 +908,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -886,4 +915,5 @@
   */
   void CAxis::recvDistributionAttribute(CEventServer& event)
+  TRY
   {
     CBufferIn* buffer = event.subEvents.begin()->buffer;
@@ -892,4 +922,5 @@
     get(axisId)->recvDistributionAttribute(*buffer);
   }
+  CATCH
 
   /*
@@ -898,13 +929,8 @@
   */
   void CAxis::recvDistributionAttribute(CBufferIn& buffer)
-  {
-    int ni_srv, begin_srv, end_srv;
-    int global_zoom_end, zoom_end;
-    bool zoomIndex = zoomByIndex();
-    
-    std::vector<int> zoom_index_tmp;
-    std::vector<int>::iterator itZoomBegin, itZoomEnd, itZoom;
-
-    buffer >> ni_srv >> begin_srv >> end_srv;    
+  TRY
+  {
+    int ni_srv, begin_srv;
+    buffer >> ni_srv >> begin_srv;
     buffer >> isCompressible_;            
 
@@ -912,44 +938,6 @@
     n.setValue(ni_srv);
     begin.setValue(begin_srv);
-
-    // If we have zoom by index then process it
-    if (zoomIndex)
-    {
-      zoom_index_tmp.resize(global_zoom_index.numElements());
-      std::copy(global_zoom_index.begin(), global_zoom_index.end(), zoom_index_tmp.begin());
-      std::sort(zoom_index_tmp.begin(), zoom_index_tmp.end());
-      itZoomBegin = std::lower_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), begin_srv);
-      itZoomEnd   = std::upper_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), end_srv);      
-      int sz = std::distance(itZoomBegin, itZoomEnd);
-      zoom_index.resize(sz);
-      itZoom = itZoomBegin;
-      for (int i = 0; i < sz; ++i, ++itZoom)
-      {
-        zoom_index(i) = *(itZoom);
-      }
-    }
-
-    global_zoom_begin = zoomIndex ? 0 : global_zoom_begin ;
-    global_zoom_n     = zoomIndex ? zoom_index_tmp.size() : global_zoom_n;
-    global_zoom_end   = global_zoom_begin + global_zoom_n - 1;
-
-    zoom_begin = zoomIndex ? std::distance(zoom_index_tmp.begin(), itZoomBegin)
-                           : global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ;
-    zoom_end   = zoomIndex ? std::distance(zoom_index_tmp.begin(), itZoomEnd) - 1 
-                           : global_zoom_end < end_srv ? global_zoom_end : end_srv ;
-    zoom_n     = zoom_end - zoom_begin + 1;
-
-    if (zoom_n<=0)
-    {
-      zoom_n = 0; zoom_begin=global_zoom_begin; //0; zoom_begin = 0; 
-    }
-
-    if (n_glo == n)
-    {
-      zoom_begin = zoomIndex ? std::distance(itZoomBegin, zoom_index_tmp.begin())
-                             : global_zoom_begin;      
-      zoom_n     = zoomIndex ? zoom_index_tmp.size() : global_zoom_n;
-    }
-  }
+  }
+  CATCH_DUMP_ATTR
 
   /*
@@ -959,9 +947,10 @@
   */
   void CAxis::sendNonDistributedAttributes()
+  TRY
   {
     std::list<CContextClient*>::iterator it;
     for (it=clients.begin(); it!=clients.end(); ++it)
-    {
-      CContextClient* client = *it;
+	{
+	  CContextClient* client = *it;
 
       CEventClient event(getType(), EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES);
@@ -1012,4 +1001,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1018,4 +1008,5 @@
   */
   void CAxis::recvNonDistributedAttributes(CEventServer& event)
+  TRY
   {
     list<CEventServer::SSubEvent>::iterator it;
@@ -1028,4 +1019,5 @@
     }
   }
+  CATCH
 
   /*
@@ -1035,6 +1027,7 @@
   */
   void CAxis::recvNonDistributedAttributes(int rank, CBufferIn& buffer)
+  TRY
   { 
-    CArray<int,1> tmp_index, tmp_data_index, tmp_zoom_index;
+    CArray<int,1> tmp_index, tmp_data_index;
     CArray<bool,1> tmp_mask;
     CArray<double,1> tmp_val;
@@ -1076,13 +1069,15 @@
     for (int idx = 0; idx < index.numElements(); ++idx) globalLocalIndexMap_[index(idx)] = idx;
   }
+  CATCH_DUMP_ATTR
 
   /*
-    Send attributes of axis from a group of client to other group of clients/servers 
-    on supposing that these attributes are distributed among the clients of the sending group
-    In the future, if new attributes are added, they should also be processed in this function
+    Send axis attributes from a group of clients to another group of clients/servers
+    supposing that these attributes are distributed among the clients of the sending group
+    In future, if new attributes are added, they should also be processed in this function
   */
   void CAxis::sendDistributedAttributes(void)
-  {
-    int ns, n, i, j, ind, nv, idx;
+  TRY
+  {
+    int ind, idx;
     std::list<CContextClient*>::iterator it;
 
@@ -1095,10 +1090,10 @@
 
       list<CMessage> listData;
-      list<CArray<int,1> > list_indi, list_dataInd, list_zoomInd;
-      list<CArray<bool,1> > list_mask;
+      list<CArray<int,1> > list_indi, list_dataInd;
       list<CArray<double,1> > list_val;
       list<CArray<double,2> > list_bounds;
       list<CArray<string,1> > list_label;
 
+      // Cut off the ghost points
       int nbIndex = index.numElements();
       CArray<int,1> dataIndex(nbIndex);
@@ -1107,5 +1102,5 @@
       {
         if (0 <= data_index(idx) && data_index(idx) < nbIndex)
-          dataIndex(idx) = 1;
+          dataIndex(data_index(idx)) = 1;
       }
 
@@ -1114,5 +1109,5 @@
       for (int k = 0; k < connectedServerRank_[nbServer].size(); ++k)
       {
-        int nbData = 0;
+        int nbData = 0, nbDataCount = 0;
         int rank = connectedServerRank_[nbServer][k];
         it = indSrv_[nbServer].find(rank);
@@ -1121,6 +1116,5 @@
 
         list_indi.push_back(CArray<int,1>(nbData));
-        list_dataInd.push_back(CArray<int,1>(nbData));        
-        list_mask.push_back(CArray<bool,1>(nbData));
+        list_dataInd.push_back(CArray<int,1>(nbData));
 
         if (hasValue)
@@ -1134,8 +1128,8 @@
 
         CArray<int,1>& indi = list_indi.back();
-        CArray<int,1>& dataIndi = list_dataInd.back();        
-        CArray<bool,1>& maskIndi = list_mask.back();
-
-        for (n = 0; n < nbData; ++n)
+        CArray<int,1>& dataIndi = list_dataInd.back();
+        dataIndi = -1;
+
+        for (int n = 0; n < nbData; ++n)
         {
           idx = static_cast<int>(it->second[n]);
@@ -1144,5 +1138,4 @@
           ind = globalLocalIndexMap_[idx];
           dataIndi(n) = dataIndex(ind);
-          maskIndi(n) = mask(ind);
 
           if (hasValue)
@@ -1168,5 +1161,5 @@
         listData.push_back(CMessage());
         listData.back() << this->getId()
-                        << list_indi.back() << list_dataInd.back() << list_mask.back();
+                        << list_indi.back() << list_dataInd.back();
 
         listData.back() << hasValue;
@@ -1188,4 +1181,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1194,4 +1188,5 @@
   */
   void CAxis::recvDistributedAttributes(CEventServer& event)
+  TRY
   {
     string axisId;
@@ -1209,4 +1204,5 @@
     get(axisId)->recvDistributedAttributes(ranks, buffers);
   }
+  CATCH
 
   /*
@@ -1216,8 +1212,8 @@
   */
   void CAxis::recvDistributedAttributes(vector<int>& ranks, vector<CBufferIn*> buffers)
+  TRY
   {
     int nbReceived = ranks.size(), idx, ind, gloInd, locInd;
-    vector<CArray<int,1> > vec_indi(nbReceived), vec_dataInd(nbReceived), vec_zoomInd(nbReceived);    
-    vector<CArray<bool,1> > vec_mask(nbReceived);
+    vector<CArray<int,1> > vec_indi(nbReceived), vec_dataInd(nbReceived);
     vector<CArray<double,1> > vec_val(nbReceived);
     vector<CArray<double,2> > vec_bounds(nbReceived);
@@ -1229,5 +1225,4 @@
       buffer >> vec_indi[idx];
       buffer >> vec_dataInd[idx];      
-      buffer >> vec_mask[idx];
 
       buffer >> hasValue;
@@ -1256,4 +1251,5 @@
     globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor()));
     nbIndexGlob = 0;
+    int nbIndLoc = 0;
     for (idx = 0; idx < nbReceived; ++idx)
     {
@@ -1262,8 +1258,9 @@
       {
          gloInd = tmp(ind);
+         nbIndLoc = (gloInd % n_glo)-begin;
          if (0 == globalLocalIndexMap_.count(gloInd))
          {
-           index(nbIndexGlob) = gloInd % n_glo;           
-           globalLocalIndexMap_[gloInd] = nbIndexGlob;  
+           index(nbIndexGlob) = gloInd % n_glo;
+           globalLocalIndexMap_[gloInd] = nbIndexGlob;
            ++nbIndexGlob;
          } 
@@ -1278,5 +1275,6 @@
     CArray<int,1> nonCompressedData(nbData);
     nonCompressedData = -1;   
-    mask.resize(nbData);
+    // Mask is incorporated into data_index and is not sent/received anymore
+    mask.resize(0);
     if (hasValue)
       value.resize(nbData);
@@ -1291,5 +1289,4 @@
       CArray<int,1>& indi = vec_indi[idx];
       CArray<int,1>& dataIndi = vec_dataInd[idx];
-      CArray<bool,1>& maskIndi = vec_mask[idx];
       int nb = indi.numElements();
       for (int n = 0; n < nb; ++n)
@@ -1299,7 +1296,4 @@
         nonCompressedData(locInd) = (-1 == nonCompressedData(locInd)) ? dataIndi(n) : nonCompressedData(locInd);
 
-        if (!mask(locInd)) // Only rewrite mask if it's not true
-          mask(locInd) = maskIndi(n);
-        
         if (hasValue)
           value(locInd) = vec_val[idx](n);
@@ -1316,9 +1310,9 @@
     }
     
-    int nbCompressedData = 0; 
+    int nbCompressedData = 0;
     for (idx = 0; idx < nonCompressedData.numElements(); ++idx)
     {
       if (0 <= nonCompressedData(idx))
-        ++nbCompressedData;        
+        ++nbCompressedData;
     }
 
@@ -1330,10 +1324,12 @@
       {
         data_index(nbCompressedData) = idx % n;
-        ++nbCompressedData;        
+        ++nbCompressedData;
       }
     }
 
     data_begin.setValue(0);
-  }
+    data_n.setValue(data_index.numElements());
+  }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -1345,4 +1341,5 @@
   */
   bool CAxis::isEqual(CAxis* obj)
+  TRY
   {
     vector<StdString> excludedAttr;
@@ -1368,4 +1365,5 @@
     return objEqual;
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1375,8 +1373,10 @@
   */
   CTransformation<CAxis>* CAxis::addTransformation(ETranformationType transType, const StdString& id)
+  TRY
   {
     transformationMap_.push_back(std::make_pair(transType, CTransformation<CAxis>::createTransformation(transType,id)));
     return transformationMap_.back().second;
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1384,7 +1384,9 @@
   */
   bool CAxis::hasTransformation()
+  TRY
   {
     return (!transformationMap_.empty());
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1393,7 +1395,9 @@
   */
   void CAxis::setTransformations(const TransMapTypes& axisTrans)
+  TRY
   {
     transformationMap_ = axisTrans;
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1402,7 +1406,9 @@
   */
   CAxis::TransMapTypes CAxis::getAllTransformations(void)
+  TRY
   {
     return transformationMap_;
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1411,4 +1417,5 @@
   */
   void CAxis::duplicateTransformation(CAxis* src)
+  TRY
   {
     if (src->hasTransformation())
@@ -1417,4 +1424,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -1422,4 +1430,5 @@
    */
   void CAxis::solveInheritanceTransformation()
+  TRY
   {
     if (hasTransformation() || !hasDirectAxisReference())
@@ -1438,6 +1447,8 @@
         refAxis[i]->setTransformations(axis->getAllTransformations());
   }
+  CATCH_DUMP_ATTR
 
   void CAxis::setContextClient(CContextClient* contextClient)
+  TRY
   {
     if (clientsSet.find(contextClient)==clientsSet.end())
@@ -1446,7 +1457,9 @@
       clientsSet.insert(contextClient);
     }
-}
+  }
+  CATCH_DUMP_ATTR
 
   void CAxis::parse(xml::CXMLNode & node)
+  TRY
   {
     SuperClass::parse(node);
@@ -1462,8 +1475,6 @@
 
         nodeElementName = node.getElementName();
-
-        if(transformationMapList_ptr == 0) initializeTransformationMap();
-        std::map<StdString, ETranformationType>::const_iterator ite = (*CAxis::transformationMapList_ptr).end(), it;
-        it = (*CAxis::transformationMapList_ptr).find(nodeElementName);
+        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it;
+        it = transformationMapList_.find(nodeElementName);
         if (ite != it)
         {
@@ -1481,4 +1492,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   DEFINE_REF_FUNC(Axis,axis)
