Index: XIOS/dev/dev_trunk_omp/src/node/grid.cpp
===================================================================
--- XIOS/dev/dev_trunk_omp/src/node/grid.cpp	(revision 1598)
+++ XIOS/dev/dev_trunk_omp/src/node/grid.cpp	(revision 1646)
@@ -82,11 +82,14 @@
 
    StdSize CGrid::getDimension(void)
+   TRY
    {
       return getGlobalDimension().size();
    }
+   CATCH_DUMP_ATTR
 
    //---------------------------------------------------------------
 
    StdSize CGrid::getDataSize(void) const
+   TRY
    {
      StdSize retvalue = 1;
@@ -98,4 +101,5 @@
      return retvalue;
    }
+   CATCH
 
    /*!
@@ -106,4 +110,5 @@
     */
    std::map<int, StdSize> CGrid::getAttributesBufferSize(CContextClient* client, bool bufferForWriting)
+   TRY
    {
      std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(client);
@@ -147,4 +152,5 @@
      return attributesSizes;
   }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -156,4 +162,5 @@
     */
    std::map<int, StdSize> CGrid::getDataBufferSize(CContextClient* client, const std::string& id /*= ""*/, bool bufferForWriting /*= "false"*/)
+   TRY
    {     
      // The record index is sometimes sent along with the data but we always
@@ -180,6 +187,8 @@
      return dataSizes;
    }
+   CATCH_DUMP_ATTR
 
    size_t CGrid::getGlobalWrittenSize(void)
+   TRY
    {
 	 std::vector<CDomain*> domainP = this->getDomains();
@@ -191,7 +200,8 @@
      return globalGridSize ;
    }
-   
+   CATCH_DUMP_ATTR
    
    void CGrid::checkAttributesAfterTransformation()
+   TRY
    {
       setAxisList();
@@ -228,4 +238,5 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //---------------------------------------------------------------
@@ -237,19 +248,25 @@
     */
    bool CGrid::isCompressible(void) const
+   TRY
    {
       return isCompressible_;
    }
+   CATCH
 
    //---------------------------------------------------------------
 
    void CGrid::addRelFileCompressed(const StdString& filename)
+   TRY
    {
       this->relFilesCompressed.insert(filename);
    }
+   CATCH_DUMP_ATTR
 
    bool CGrid::isWrittenCompressed(const StdString& filename) const
+   TRY
    {
       return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end());
    }
+   CATCH
 
    //---------------------------------------------------------------
@@ -258,4 +275,5 @@
    */
    void CGrid::solveDomainAxisRef(bool areAttributesChecked)
+   TRY
    {
      if (this->isDomainAxisChecked) return;
@@ -266,4 +284,5 @@
      this->isDomainAxisChecked = areAttributesChecked;
    }
+   CATCH_DUMP_ATTR
 
    /*
@@ -272,4 +291,5 @@
    */
    void CGrid::solveDomainAxisBaseRef()
+   TRY
    {
      if (this->hasDomainAxisBaseRef_) return;
@@ -297,12 +317,16 @@
      this->hasDomainAxisBaseRef_ = true;
    }
+   CATCH_DUMP_ATTR
 
    void CGrid::checkEligibilityForCompressedOutput()
+   TRY
    {
      // We don't check if the mask is valid here, just if a mask has been defined at this point.
      isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty();
    }
+   CATCH_DUMP_ATTR
 
    void CGrid::checkMaskIndex(bool doSendingIndex)
+   TRY
    {
      CContext* context = CContext::getCurrent();
@@ -339,4 +363,12 @@
       this->isChecked = true;
    }
+   CATCH_DUMP_ATTR
+   bool CGrid::hasMask() const
+   TRY
+   {
+     return (!mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty() ||
+             !mask_4d.isEmpty() || !mask_5d.isEmpty() || !mask_6d.isEmpty() || !mask_7d.isEmpty());
+   }
+   CATCH
 
    /*
@@ -344,4 +376,5 @@
    */
    void CGrid::createMask(void)
+   TRY
    {
       using namespace std;
@@ -381,4 +414,5 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    /*
@@ -386,4 +420,5 @@
    */
    void CGrid::checkMask(void)
+   TRY
    {
       using namespace std;
@@ -423,50 +458,6 @@
       }
    }
-
-
-/*!
-  A grid can have multiple dimension, so can its mask in the form of multi-dimension array.
-It's not a good idea to store all multi-dimension arrays corresponding to each mask.
-One of the ways is to convert this array into 1-dimension one and every process is taken place on it.
-  \param [in] multi-dimension array grid mask
-*/
-
-  void CGrid::getLocalMask(CArray<bool,1>& localMask)
-  {
-      std::vector<CDomain*> domainP = this->getDomains();
-      std::vector<CAxis*> axisP = this->getAxis();
-      int dim = domainP.size() * 2 + axisP.size();
-
-      switch (dim)
-      {
-        case 0:
-          getLocalMask(mask_0d, localMask);
-          break;
-        case 1:
-          getLocalMask(mask_1d, localMask);
-          break;
-        case 2:
-          getLocalMask(mask_2d, localMask);
-          break;
-        case 3:
-          getLocalMask(mask_3d, localMask);
-          break;
-        case 4:
-          getLocalMask(mask_4d, localMask);
-          break;
-        case 5:
-          getLocalMask(mask_5d, localMask);
-          break;
-        case 6:
-          getLocalMask(mask_6d, localMask);
-          break;
-        case 7:
-          getLocalMask(mask_7d, localMask);
-          break;
-        default:
-          break;
-      }
-  }
-      
+   CATCH_DUMP_ATTR
+
    /*
      Modify value of mask in a certain index
@@ -476,4 +467,5 @@
    */
    void CGrid::modifyMask(const CArray<int,1>& indexToModify, bool modifyValue)
+   TRY
    {
       using namespace std;
@@ -511,4 +503,5 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    /*
@@ -518,4 +511,5 @@
    */
    void CGrid::modifyMaskSize(const std::vector<int>& newDimensionSize, bool newValue)
+   TRY
    {      
       std::vector<CDomain*> domainP = this->getDomains();
@@ -552,8 +546,10 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //---------------------------------------------------------------
 
    void CGrid::solveDomainRef(bool sendAtt)
+   TRY
    {
       setDomainList();
@@ -568,8 +564,10 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //---------------------------------------------------------------
 
    void CGrid::solveAxisRef(bool sendAtt)
+   TRY
    {
       setAxisList();
@@ -599,8 +597,10 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //---------------------------------------------------------------
 
    void CGrid::solveScalarRef(bool sendAtt)
+   TRY
    {
       setScalarList();
@@ -616,4 +616,5 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -621,4 +622,5 @@
    */
    void CGrid::computeWrittenIndex()
+   TRY
    {      
       if (computedWrittenIndex_) return;
@@ -680,4 +682,5 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    //---------------------------------------------------------------
@@ -690,4 +693,5 @@
    */
    void CGrid::computeClientIndex()
+   TRY
    {
      CContext* context = CContext::getCurrent();
@@ -698,7 +702,11 @@
      clientDistribution_ = new CDistributionClient(rank, this);
      // Get local data index on client
-     storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size());
-     int nbStoreIndex = storeIndex_client.numElements();
+     int nbStoreIndex = clientDistribution_->getLocalDataIndexOnClient().size();
+     int nbStoreGridMask = clientDistribution_->getLocalMaskIndexOnClient().size();
+     // nbStoreGridMask = nbStoreIndex if grid mask is defined, and 0 otherwise
+     storeIndex_client.resize(nbStoreIndex);
+     storeMask_client.resize(nbStoreGridMask);
      for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx];
+     for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMask_client(idx) = (clientDistribution_->getLocalMaskIndexOnClient())[idx];
 
      if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed();
@@ -746,4 +754,5 @@
       }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -751,4 +760,5 @@
    */
    void CGrid::computeConnectedClients()
+   TRY
    {
      CContext* context = CContext::getCurrent();
@@ -840,8 +850,36 @@
           connectedServerRank_[receiverSize].push_back(client->clientRank % client->serverSize);
 
+         // Now check if all servers have data to receive. If not, master client will send empty data.
+         // This ensures that all servers will participate in collective calls upon receiving even if they have no date to receive.
+         std::vector<int> counts (client->clientSize);
+         std::vector<int> displs (client->clientSize);
+         displs[0] = 0;
+         int localCount = connectedServerRank_[receiverSize].size() ;
+         ep_lib::MPI_Gather(&localCount, 1, MPI_INT, &counts[0], 1, MPI_INT, 0, client->intraComm) ;
+         
+         for (int i = 0; i < client->clientSize-1; ++i)
+         {
+           displs[i+1] = displs[i] + counts[i];
+         }
+         std::vector<int> allConnectedServers(displs[client->clientSize-1]+counts[client->clientSize-1]);
+
+         ep_lib::MPI_Gatherv(&(connectedServerRank_[receiverSize])[0], localCount, MPI_INT, &allConnectedServers[0], &counts[0], &displs[0], MPI_INT, 0, client->intraComm);
+
+
+         if ((allConnectedServers.size() != receiverSize) && (client->clientRank == 0))
+         {
+           std::vector<bool> isSrvConnected (receiverSize, false);
+           for (int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] = true;
+           for (int i = 0; i < receiverSize; ++i)
+           {
+             if (!isSrvConnected[i]) connectedServerRank_[receiverSize].push_back(i);
+           }
+         }
+
          nbSenders[receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]);
        }
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -853,4 +891,5 @@
    */
    void CGrid::computeIndex(void)
+   TRY
    {
      CContext* context = CContext::getCurrent();
@@ -879,4 +918,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -892,4 +932,5 @@
                                      const CContextClient* client,
                                      CClientServerMapping::GlobalIndexMap& globalIndexOnServer)
+   TRY
    {
      int serverSize = client->serverSize;
@@ -1058,7 +1099,9 @@
     }
    }
-   //----------------------------------------------------------------
+   CATCH_DUMP_ATTR
+//----------------------------------------------------------------
 
    CGrid* CGrid::createGrid(CDomain* domain)
+   TRY
    {
       std::vector<CDomain*> vecDom(1, domain);
@@ -1067,7 +1110,9 @@
       return createGrid(vecDom, vecAxis);
    }
+   CATCH
 
    CGrid* CGrid::createGrid(CDomain* domain, CAxis* axis)
-   {
+   TRY
+  {
       std::vector<CDomain*> vecDom(1, domain);
       std::vector<CAxis*> vecAxis(1, axis);
@@ -1075,20 +1120,26 @@
       return createGrid(vecDom, vecAxis);
    }
+   CATCH
 
    CGrid* CGrid::createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                             const CArray<int,1>& axisDomainOrder)
+   TRY
    {
      std::vector<CScalar*> vecScalar;
      return createGrid(generateId(domains, axis, vecScalar, axisDomainOrder), domains, axis, vecScalar, axisDomainOrder);
    }
+   CATCH
 
    CGrid* CGrid::createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                             const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder)
+   TRY
    {
      return createGrid(generateId(domains, axis, scalars, axisDomainOrder), domains, axis, scalars, axisDomainOrder);
    }
+   CATCH
 
    CGrid* CGrid::createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                             const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder)
+   TRY
    {
       if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size()))
@@ -1132,6 +1183,8 @@
       return grid;
    }
+   CATCH
 
    CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc)
+   TRY
    {
      std::vector<CDomain*> domainSrcTmp = gridSrc->getDomains(), domainSrc;
@@ -1173,7 +1226,9 @@
       return grid;
    }
+   CATCH
 
    StdString CGrid::generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis,
                                const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder)
+   TRY
    {
       if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size()))
@@ -1216,6 +1271,8 @@
       return id.str();
    }
+   CATCH
 
    StdString CGrid::generateId(const CGrid* gridSrc, const CGrid* gridDest)
+   TRY
    {
      StdString idSrc  = gridSrc->getId();
@@ -1227,21 +1284,28 @@
      return id.str();
    }
+   CATCH
 
    //----------------------------------------------------------------
 
    CDomainGroup* CGrid::getVirtualDomainGroup() const
+   TRY
    {
      return this->vDomainGroup_;
    }
+   CATCH
 
    CAxisGroup* CGrid::getVirtualAxisGroup() const
+   TRY
    {
      return this->vAxisGroup_;
    }
+   CATCH
 
    CScalarGroup* CGrid::getVirtualScalarGroup() const
+   TRY
    {
      return this->vScalarGroup_;
    }
+   CATCH
 
 /*
@@ -1279,4 +1343,5 @@
 
    void CGrid::storeField_arr(const double* const data, CArray<double, 1>& stored) const
+   TRY
    {
       const StdSize size = storeIndex_client.numElements();
@@ -1285,6 +1350,8 @@
       for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)];
    }
+   CATCH
 
    void CGrid::restoreField_arr(const CArray<double, 1>& stored, double* const data) const
+   TRY
    {
       const StdSize size = storeIndex_client.numElements();
@@ -1292,6 +1359,20 @@
       for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i);
    }
+   CATCH
+
+   void CGrid::maskField_arr(const double* const data, CArray<double, 1>& stored) const
+   {
+      const StdSize size = storeIndex_client.numElements();
+      stored.resize(size);
+      const double nanValue = std::numeric_limits<double>::quiet_NaN();
+
+      if (storeMask_client.numElements() != 0)
+        for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_client(i)) ? data[storeIndex_client(i)] : nanValue;
+      else
+        for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)];
+   }
 
    void CGrid::uncompressField_arr(const double* const data, CArray<double, 1>& out) const
+   TRY
    {
       const std::vector<int>& localMaskedDataIndex = clientDistribution_->getLocalMaskedDataIndexOnClient();
@@ -1299,7 +1380,8 @@
       for(int i = 0; i < size; ++i) out(localMaskedDataIndex[i]) = data[i];
    }
-
+   CATCH
 
   void CGrid::computeClientIndexScalarGrid()
+  TRY
   {
     CContext* context = CContext::getCurrent();    
@@ -1335,6 +1417,8 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::computeConnectedClientsScalarGrid()
+  TRY
   {
     CContext* context = CContext::getCurrent();    
@@ -1381,6 +1465,8 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::sendIndexScalarGrid()
+  TRY
   {
     CContext* context = CContext::getCurrent();
@@ -1446,6 +1532,8 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::sendIndex(void)
+  TRY
   {
     CContext* context = CContext::getCurrent();
@@ -1567,6 +1655,8 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::recvIndex(CEventServer& event)
+  TRY
   {
     string gridId;
@@ -1584,6 +1674,8 @@
     get(gridId)->recvIndex(ranks, buffers);
   }
+  CATCH
 
   void CGrid::recvIndex(vector<int> ranks, vector<CBufferIn*> buffers)
+  TRY
   {
     CContext* context = CContext::getCurrent();
@@ -1748,40 +1840,4 @@
           nGlob.push_back(1);  
         }
-
-        modifyMaskSize(nSize, false);
-
-        // These below codes are reserved for future
-        CDistributionServer srvDist(server->intraCommRank, nBegin, nSize, nBeginGlobal, nGlob); 
-        map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(),
-                                               ite = outGlobalIndexFromClient.end(), it;  
-        const CDistributionServer::GlobalLocalMap&  globalLocalMask = srvDist.getGlobalLocalIndex();
-        CDistributionServer::GlobalLocalMap::const_iterator itSrv;
-        size_t nb = 0;
-        for (it = itb; it != ite; ++it)
-        {
-          CArray<size_t,1>& globalInd = it->second;
-          for (size_t idx = 0; idx < globalInd.numElements(); ++idx)
-          {
-            if (globalLocalMask.end() != globalLocalMask.find(globalInd(idx))) ++nb;
-          }
-        }
-        
-        CArray<int,1> indexToModify(nb);
-        nb = 0;    
-        for (it = itb; it != ite; ++it)
-        {
-          CArray<size_t,1>& globalInd = it->second;
-          for (size_t idx = 0; idx < globalInd.numElements(); ++idx)
-          {
-            itSrv = globalLocalMask.find(globalInd(idx));
-            if (globalLocalMask.end() != itSrv) 
-            {
-              indexToModify(nb) = itSrv->second;
-              ++nb;
-            }
-          }
-        }
-
-        modifyMask(indexToModify, true);
       }
 
@@ -1791,4 +1847,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*
@@ -1806,5 +1863,6 @@
                                         const std::vector<CScalar*> scalars,
                                         const CArray<int,1>& axisDomainOrder)
-  {
+  TRY
+ {
  //   globalDim.resize(domains.size()*2+axis.size()+scalars.size());
     globalDim.resize(domains.size()*2+axis.size());
@@ -1846,7 +1904,9 @@
     return positionDimensionDistributed;
   }
+  CATCH_DUMP_ATTR
 
   // Retrieve the global dimension of grid
   std::vector<int> CGrid::getGlobalDimension()
+  TRY
   {
     std::vector<int> globalDim;
@@ -1855,16 +1915,21 @@
     return globalDim;
   }
+  CATCH_DUMP_ATTR
 
   // Retrieve dimension on which we do distribution (Very often, it should be 2nd dimension)
   int CGrid::getDistributedDimension()
+  TRY
   {
     std::vector<int> globalDim;
     return computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order);    
   }
+  CATCH_DUMP_ATTR
 
   bool CGrid::isScalarGrid() const
+  TRY
   {
     return (axisList_.empty() && domList_.empty());
   }
+  CATCH
 
   /*!
@@ -1874,7 +1939,9 @@
   */
   bool CGrid::doGridHaveDataToWrite()
+  TRY
   {
      return (0 != writtenDataSize_);
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -1885,7 +1952,9 @@
   */
   size_t CGrid::getWrittenDataSize() const
+  TRY
   {
     return writtenDataSize_;
   }
+  CATCH
 
   /*!
@@ -1894,7 +1963,9 @@
   */
   int CGrid::getNumberWrittenIndexes() const
+  TRY
   {
     return numberWrittenIndexes_;
   }
+  CATCH
 
   /*!
@@ -1903,7 +1974,9 @@
   */
   int CGrid::getTotalNumberWrittenIndexes() const
+  TRY
   {
     return totalNumberWrittenIndexes_;
   }
+  CATCH
 
   /*!
@@ -1912,19 +1985,26 @@
   */
   int CGrid::getOffsetWrittenIndexes() const
+  TRY
   {
     return offsetWrittenIndexes_;
   }
+  CATCH
 
   CDistributionServer* CGrid::getDistributionServer()
+  TRY
   {
     return serverDistribution_;
   }
+  CATCH_DUMP_ATTR
 
   CDistributionClient* CGrid::getDistributionClient()
+  TRY
   {
     return clientDistribution_;
   }
+  CATCH_DUMP_ATTR
 
   bool CGrid::doGridHaveDataDistributed(CContextClient* client)
+  TRY
   {
     if (isScalarGrid()) return false;
@@ -1936,4 +2016,5 @@
       return isDataDistributed_;    
   }
+  CATCH_DUMP_ATTR
 
    /*!
@@ -1945,4 +2026,5 @@
    */
   bool CGrid::dispatchEvent(CEventServer& event)
+  TRY
   {
 
@@ -1978,8 +2060,10 @@
     }
   }
+  CATCH
 
    ///---------------------------------------------------------------
 
    CDomain* CGrid::addDomain(const std::string& id)
+   TRY
    {
      order_.push_back(2);
@@ -1988,6 +2072,8 @@
      return vDomainGroup_->createChild(id);
    }
+   CATCH_DUMP_ATTR
 
    CAxis* CGrid::addAxis(const std::string& id)
+   TRY
    {
      order_.push_back(1);
@@ -1996,6 +2082,8 @@
      return vAxisGroup_->createChild(id);
    }
+   CATCH_DUMP_ATTR
 
    CScalar* CGrid::addScalar(const std::string& id)
+   TRY
    {
      order_.push_back(0);
@@ -2004,22 +2092,29 @@
      return vScalarGroup_->createChild(id);
    }
+   CATCH_DUMP_ATTR
 
    //! Change virtual field group to a new one
    void CGrid::setVirtualDomainGroup(CDomainGroup* newVDomainGroup)
+   TRY
    {
       this->vDomainGroup_ = newVDomainGroup;
    }
+   CATCH_DUMP_ATTR
 
    //! Change virtual variable group to new one
    void CGrid::setVirtualAxisGroup(CAxisGroup* newVAxisGroup)
+   TRY
    {
       this->vAxisGroup_ = newVAxisGroup;
    }
+   CATCH_DUMP_ATTR
 
    //! Change virtual variable group to new one
    void CGrid::setVirtualScalarGroup(CScalarGroup* newVScalarGroup)
+   TRY
    {
       this->vScalarGroup_ = newVScalarGroup;
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -2028,7 +2123,9 @@
    */
    void CGrid::sendAddDomain(const string& id)
-   {
+   TRY
+  {
       sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -2037,7 +2134,9 @@
    */
    void CGrid::sendAddAxis(const string& id)
+   TRY
    {
       sendAddItem(id, (int)EVENT_ID_ADD_AXIS);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -2046,7 +2145,9 @@
    */
    void CGrid::sendAddScalar(const string& id)
+   TRY
    {
       sendAddItem(id, (int)EVENT_ID_ADD_SCALAR);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -2055,4 +2156,5 @@
    */
    void CGrid::recvAddDomain(CEventServer& event)
+   TRY
    {
 
@@ -2062,4 +2164,5 @@
       get(id)->recvAddDomain(*buffer);
    }
+   CATCH
 
    /*!
@@ -2068,4 +2171,5 @@
    */
    void CGrid::recvAddDomain(CBufferIn& buffer)
+   TRY
    {
       string id;
@@ -2073,4 +2177,5 @@
       addDomain(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -2079,4 +2184,5 @@
    */
    void CGrid::recvAddAxis(CEventServer& event)
+   TRY
    {
 
@@ -2086,4 +2192,5 @@
       get(id)->recvAddAxis(*buffer);
    }
+   CATCH
 
    /*!
@@ -2092,4 +2199,5 @@
    */
    void CGrid::recvAddAxis(CBufferIn& buffer)
+   TRY
    {
       string id;
@@ -2097,4 +2205,5 @@
       addAxis(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -2103,4 +2212,5 @@
    */
    void CGrid::recvAddScalar(CEventServer& event)
+   TRY
    {
 
@@ -2110,4 +2220,5 @@
       get(id)->recvAddScalar(*buffer);
    }
+   CATCH
 
    /*!
@@ -2116,4 +2227,5 @@
    */
    void CGrid::recvAddScalar(CBufferIn& buffer)
+   TRY
    {
       string id;
@@ -2121,4 +2233,5 @@
       addScalar(id);
    }
+   CATCH_DUMP_ATTR
 
   /*!
@@ -2129,4 +2242,5 @@
   */
   void CGrid::solveDomainAxisRefInheritance(bool apply)
+  TRY
   {
     CContext* context = CContext::getCurrent();
@@ -2169,30 +2283,41 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   bool CGrid::isTransformed()
+  TRY
   {
     return isTransformed_;
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::setTransformed()
+  TRY
   {
     isTransformed_ = true;
   }
+  CATCH_DUMP_ATTR
 
   CGridTransformation* CGrid::getTransformations()
+  TRY
   {
     return transformations_;
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::addTransGridSource(CGrid* gridSrc)
+  TRY
   {
     if (gridSrc_.end() == gridSrc_.find(gridSrc))
       gridSrc_.insert(make_pair(gridSrc,make_pair(false,"")));
   }
+  CATCH_DUMP_ATTR
 
   std::map<CGrid*,std::pair<bool,StdString> >& CGrid::getTransGridSource()
+  TRY
   {
     return gridSrc_;
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2201,4 +2326,5 @@
   */
   void CGrid::completeGrid(CGrid* transformGridSrc)
+  TRY
   {
     if (0 != transformGridSrc)
@@ -2219,16 +2345,22 @@
     gridGenerate.completeGrid();
   }
+  CATCH_DUMP_ATTR
 
   bool CGrid::isGenerated()
+  TRY
   {
     return isGenerated_;
   }
+  CATCH
 
   void CGrid::setGenerated()
+  TRY
   {
     isGenerated_ = true;
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::transformGrid(CGrid* transformGridSrc)
+  TRY
   {
     if (!transformGridSrc)
@@ -2256,6 +2388,8 @@
     transformGridSrc->checkMaskIndex(false);
   }
+  CATCH_DUMP_ATTR
 
   bool CGrid::hasTransform()
+  TRY
   {
     if (hasTransform_) return hasTransform_;
@@ -2271,4 +2405,5 @@
     return hasTransform_;
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2277,4 +2412,5 @@
   */
   std::vector<CDomain*> CGrid::getDomains()
+  TRY
   {
     std::vector<CDomain*> domList;
@@ -2285,4 +2421,5 @@
     return domList;
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2291,4 +2428,5 @@
   */
   std::vector<CAxis*> CGrid::getAxis()
+  TRY
   {
     std::vector<CAxis*> aList;
@@ -2298,4 +2436,5 @@
     return aList;
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2304,4 +2443,5 @@
   */
   std::vector<CScalar*> CGrid::getScalars()
+  TRY
   {
     std::vector<CScalar*> sList;
@@ -2311,4 +2451,5 @@
     return sList;
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2317,4 +2458,5 @@
   */
   CDomain* CGrid::getDomain(int domainIndex)
+  TRY
   {
     std::vector<CDomain*> domainListP = this->getDomains();
@@ -2334,4 +2476,5 @@
     return domainListP[domainIndex];
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2340,4 +2483,5 @@
   */
   CAxis* CGrid::getAxis(int axisIndex)
+  TRY
   {
     std::vector<CAxis*> axisListP = this->getAxis();
@@ -2357,4 +2501,5 @@
     return axisListP[axisIndex];
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2363,4 +2508,5 @@
   */
   CScalar* CGrid::getScalar(int scalarIndex)
+  TRY
   {
     std::vector<CScalar*> scalarListP = this->getScalars();
@@ -2380,4 +2526,5 @@
     return scalarListP[scalarIndex];
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2386,4 +2533,5 @@
   */
   void CGrid::setDomainList(const std::vector<CDomain*> domains)
+  TRY
   {
     if (isDomListSet) return;
@@ -2406,6 +2554,6 @@
       isDomListSet = true;
     }
-
-  }
+  }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2414,4 +2562,5 @@
   */
   void CGrid::setAxisList(const std::vector<CAxis*> axis)
+  TRY
   {
     if (isAxisListSet) return;
@@ -2435,4 +2584,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2441,4 +2591,5 @@
   */
   void CGrid::setScalarList(const std::vector<CScalar*> scalars)
+  TRY
   {
     if (isScalarListSet) return;
@@ -2462,4 +2613,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2468,8 +2620,10 @@
   */
   std::vector<StdString> CGrid::getDomainList()
+  TRY
   {
     setDomainList();
     return domList_;
   }
+  CATCH
 
   /*!
@@ -2478,8 +2632,10 @@
   */
   std::vector<StdString> CGrid::getAxisList()
+  TRY
   {
     setAxisList();
     return axisList_;
   }
+  CATCH
 
   /*!
@@ -2488,8 +2644,10 @@
   */
   std::vector<StdString> CGrid::getScalarList()
+  TRY
   {
     setScalarList();
     return scalarList_;
   }
+  CATCH
 
   /*!
@@ -2497,4 +2655,5 @@
   */
   void CGrid::sendAllDomains()
+  TRY
   {
     std::vector<CDomain*> domList = this->getVirtualDomainGroup()->getAllChildren();
@@ -2506,4 +2665,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2511,4 +2671,5 @@
   */
   void CGrid::sendAllAxis()
+  TRY
   {
     std::vector<CAxis*> aList = this->getVirtualAxisGroup()->getAllChildren();
@@ -2521,4 +2682,5 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2526,4 +2688,5 @@
   */
   void CGrid::sendAllScalars()
+  TRY
   {
     std::vector<CScalar*> sList = this->getVirtualScalarGroup()->getAllChildren();
@@ -2536,6 +2699,8 @@
     }
   }
+  CATCH_DUMP_ATTR
 
   void CGrid::setContextClient(CContextClient* contextClient)
+  TRY
   {
     if (clientsSet.find(contextClient)==clientsSet.end())
@@ -2549,4 +2714,5 @@
     	this->getAxis()[i]->setContextClient(contextClient);
   }
+  CATCH_DUMP_ATTR
 
   /*!
@@ -2554,4 +2720,5 @@
   */
   void CGrid::parse(xml::CXMLNode& node)
+  TRY
   {
     SuperClass::parse(node);
@@ -2594,3 +2761,5 @@
     setScalarList();
    }
+  CATCH_DUMP_ATTR
+
 } // namespace xios
