Index: XIOS/trunk/src/node/grid.hpp
===================================================================
--- XIOS/trunk/src/node/grid.hpp	(revision 1564)
+++ XIOS/trunk/src/node/grid.hpp	(revision 1622)
@@ -372,4 +372,5 @@
    template <int n>
    void CGrid::inputField(const CArray<double,n>& field, CArray<double,1>& stored) const
+   TRY
    {
 //#ifdef __XIOS_DEBUG
@@ -383,7 +384,9 @@
       this->storeField_arr(field.dataFirst(), stored);
    }
+   CATCH
 
    template <int n>
    void CGrid::outputField(const CArray<double,1>& stored, CArray<double,n>& field) const
+   TRY
    {
 //#ifdef __XIOS_DEBUG
@@ -397,4 +400,5 @@
       this->restoreField_arr(stored, field.dataFirst());
    }
+   CATCH
 
    /*!
@@ -406,7 +410,9 @@
    template <int N>
    void CGrid::uncompressField(const CArray<double,N>& data, CArray<double,1>& outData) const
+   TRY
    {      
      uncompressField_arr(data.dataFirst(), outData);
    }
+   CATCH
 
    template<int N>
@@ -416,4 +422,5 @@
                              const CArray<int,1>& axisDomainOrder,
                              bool createMask)
+   TRY
    {
      if (!gridMask.isEmpty() || createMask)
@@ -515,4 +522,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    template<int N>
@@ -520,4 +528,5 @@
                                   const std::vector<int>& eachDimSize,
                                   bool newValue)
+   TRY
    {
       if (N != eachDimSize.size())
@@ -534,4 +543,5 @@
       gridMask = newValue;
    }
+   CATCH_DUMP_ATTR
                                  
 
@@ -543,4 +553,5 @@
    template<int N>
    void CGrid::modifyGridMask(CArray<bool,N>& gridMask, const CArray<int,1>& indexToModify, bool valueToModify)
+   TRY
    {     
      int num = indexToModify.numElements();
@@ -550,48 +561,51 @@
      }
    }
+   CATCH_DUMP_ATTR
+
    ///--------------------------------------------------------------
 
-
-/*!
-  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
-*/
-template<int N>
-void CGrid::getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask)
-{
-  if (gridMask.isEmpty()) return ;
-  int dim = gridMask.dimensions();
-  std::vector<int> dimensionSizes(dim);
-  for (int i = 0; i < dim; ++i) dimensionSizes[i] = gridMask.extent(i);
-
-  std::vector<int> idxLoop(dim,0);
-  int ssize = gridMask.numElements(), idx = 0;
-  localMask.resize(ssize);
-  while (idx < ssize)
+  /*!
+    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
+  */
+  template<int N>
+  void CGrid::getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask)
+  TRY
   {
-    for (int i = 0; i < dim-1; ++i)
+    if (gridMask.isEmpty()) return ;
+    int dim = gridMask.dimensions();
+    std::vector<int> dimensionSizes(dim);
+    for (int i = 0; i < dim; ++i) dimensionSizes[i] = gridMask.extent(i);
+
+    std::vector<int> idxLoop(dim,0);
+    int ssize = gridMask.numElements(), idx = 0;
+    localMask.resize(ssize);
+    while (idx < ssize)
     {
-      if (idxLoop[i] == dimensionSizes[i])
+      for (int i = 0; i < dim-1; ++i)
       {
-        idxLoop[i] = 0;
-        ++idxLoop[i+1];
+        if (idxLoop[i] == dimensionSizes[i])
+        {
+          idxLoop[i] = 0;
+          ++idxLoop[i+1];
+        }
       }
+
+      int maskIndex = idxLoop[0];
+      int mulDim = 1;
+      for (int k = 1; k < dim; ++k)
+      {
+        mulDim *= dimensionSizes[k-1];
+        maskIndex += idxLoop[k]*mulDim;
+      }
+      localMask(maskIndex) = *(gridMask.dataFirst()+maskIndex);
+
+      ++idxLoop[0];
+      ++idx;
     }
-
-    int maskIndex = idxLoop[0];
-    int mulDim = 1;
-    for (int k = 1; k < dim; ++k)
-    {
-      mulDim *= dimensionSizes[k-1];
-      maskIndex += idxLoop[k]*mulDim;
-    }
-    localMask(maskIndex) = *(gridMask.dataFirst()+maskIndex);
-
-    ++idxLoop[0];
-    ++idx;
   }
-}
+   CATCH_DUMP_ATTR
 
    // Declare/Define CGridGroup and CGridDefinition
