Index: XIOS/dev/dev_trunk_omp/src/transformation/generic_algorithm_transformation.cpp
===================================================================
--- XIOS/dev/dev_trunk_omp/src/transformation/generic_algorithm_transformation.cpp	(revision 1601)
+++ XIOS/dev/dev_trunk_omp/src/transformation/generic_algorithm_transformation.cpp	(revision 1646)
@@ -34,4 +34,5 @@
                                             std::vector<bool>& flagInitial,
                                             bool ignoreMissingValue, bool firstPass  )
+TRY
 {
   int nbLocalIndex = localIndex.size();   
@@ -61,6 +62,8 @@
   }
 }
+CATCH
 
 void CGenericAlgorithmTransformation::computePositionElements(CGrid* dst, CGrid* src)
+TRY
 {
   int idxScalar = 0, idxAxis = 0, idxDomain = 0;
@@ -108,6 +111,8 @@
   }
 }
+CATCH
 
 bool CGenericAlgorithmTransformation::isDistributedTransformation(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst)
+TRY
 {
 
@@ -147,5 +152,7 @@
   }
   return isDistributed_ ;
-}  
+}
+CATCH
+
 /*!
   This function computes the global indexes of grid source, which the grid destination is in demand.
@@ -160,4 +167,5 @@
                                                                CGrid* gridDst,
                                                                SourceDestinationIndexMap& globaIndexWeightFromSrcToDst)
+TRY
  {
   CContext* context = CContext::getCurrent();
@@ -443,4 +451,5 @@
   }  
  }
+CATCH
 
 /*!
@@ -461,4 +470,5 @@
                                                                    std::vector<std::unordered_map<int,std::vector<size_t> > >& globalElementIndexOnProc,
                                                                    SourceDestinationIndexMap& globaIndexWeightFromSrcToDst)
+TRY
 {
   SourceDestinationIndexMap globaIndexWeightFromSrcToDst_tmp ;
@@ -640,6 +650,6 @@
        }
      }
-
-}
+}
+CATCH
 
 /*!
@@ -654,4 +664,5 @@
                                                                  CArray<size_t,1>& destGlobalIndexPositionInGrid,
                                                                  std::unordered_map<int,std::vector<size_t> >& globalScalarIndexOnProc)
+TRY
 {
   CContext* context = CContext::getCurrent();
@@ -666,4 +677,5 @@
   }
 }
+CATCH
 
 /*!
@@ -678,4 +690,5 @@
                                                                CArray<size_t,1>& destGlobalIndexPositionInGrid,
                                                                std::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc)
+TRY
 {
   CContext* context = CContext::getCurrent();
@@ -735,4 +748,5 @@
   }
 }
+CATCH
 
 /*!
@@ -747,4 +761,5 @@
                                                                  CArray<size_t,1>& destGlobalIndexPositionInGrid,
                                                                  std::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc)
+TRY
 {
   CContext* context = CContext::getCurrent();
@@ -838,12 +853,10 @@
   }
 }
-
-
-
-
-
+CATCH
 
 void CGenericAlgorithmTransformation::computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst,
-                                                                                 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, vector<bool>& localMaskOnGridDest)
+                                                                                 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight,
+                                                                                 int& nlocalIndexDest)
+TRY
 {
 
@@ -871,5 +884,6 @@
     
   int nlocalIndexSrc=1 ;
-  int nlocalIndexDest=1 ;
+//  int nlocalIndexDest=1 ;
+  nlocalIndexDest=1 ;
   CArray<bool,1> maskScalar(1) ;
   maskScalar  = true ;
@@ -933,9 +947,4 @@
     nlocalIndexDest=nlocalIndexDest*nIndexDst[i] ;
   }
-
-
-
-
-
 
   vector<int> dstLocalInd ;
@@ -985,17 +994,4 @@
   }
 
-// just get the local src mask
-  CArray<bool,1> localMaskOnSrcGrid;
-  gridSrc->getLocalMask(localMaskOnSrcGrid) ;
-// intermediate grid, mask is not initialized => set up mask to true
-  if (localMaskOnSrcGrid.isEmpty())
-  {
-    localMaskOnSrcGrid.resize(nlocalIndexSrc) ;
-    localMaskOnSrcGrid=true ;
-  }
-  
-
-  localMaskOnGridDest.resize(nlocalIndexDest,false) ;
-
   vector<vector<vector<pair<int,double> > > > dstIndWeight(transformationMapping_.size()) ;
    
@@ -1024,11 +1020,16 @@
   
   nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight,  
-                               currentInd,localSrc,localDst,weight, localMaskOnSrcGrid, localMaskOnGridDest );
+                               currentInd,localSrc,localDst,weight);
                
 }
-
-
-void CGenericAlgorithmTransformation::nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid, vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst, int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc, int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd,
-                    vector<int>& localSrc, vector<int>& localDst, vector<double>& weight,  CArray<bool,1>& localMaskOnGridSrc, vector<bool>& localMaskOnGridDest )
+CATCH
+
+
+void CGenericAlgorithmTransformation::nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid,
+                                                                   vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst,
+                                                                   int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc,
+                                                                   int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd,
+                                                                   vector<int>& localSrc, vector<int>& localDst, vector<double>& weight)
+TRY
 {
   int masked_ ;
@@ -1043,5 +1044,6 @@
         masked_=masked ;
         if (!mask(i)) masked_=false ;
-        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, currentInd, localSrc, localDst, weight, localMaskOnGridSrc, localMaskOnGridDest) ;
+        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t,
+                                     dstIndWeight, currentInd, localSrc, localDst, weight);
       }
     }
@@ -1057,16 +1059,12 @@
             for(vector<pair<int,double> >::iterator it = dstIndWeight[t][currentInd].begin(); it!=dstIndWeight[t][currentInd].end(); ++it)
             {
-              if (localMaskOnGridSrc(srcInd))
-              {
-                localSrc.push_back(srcIndCompressed) ;
-                localDst.push_back(it->first) ;
-                weight.push_back(it->second) ;
-                localMaskOnGridDest[it->first]=true ;
-              }
+              localSrc.push_back(srcIndCompressed) ;
+              localDst.push_back(it->first) ;
+              weight.push_back(it->second) ;
               (it->first)++ ;
             }
           }
           if (t < dstIndWeight.size()-1) t++ ;
-          if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ;
+            srcIndCompressed ++ ;
         }
         srcInd++ ;
@@ -1086,5 +1084,6 @@
         masked_=masked ;
         if (!mask(i)) masked_=false ; 
-        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight , i,  localSrc, localDst, weight, localMaskOnGridSrc, localMaskOnGridDest) ;
+        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd,
+                                     srcIndCompressed, nIndexSrc, t, dstIndWeight , i,  localSrc, localDst, weight);
       }
     }
@@ -1100,16 +1099,12 @@
             for(vector<pair<int,double> >::iterator it = dstIndWeight[t][i].begin(); it!=dstIndWeight[t][i].end(); ++it)
             {
-              if (localMaskOnGridSrc(srcInd))
-              {
-                localSrc.push_back(srcIndCompressed) ;
-                localDst.push_back(it->first) ;
-                weight.push_back(it->second) ;
-                localMaskOnGridDest[it->first]=true ;
-              }
+              localSrc.push_back(srcIndCompressed) ;
+              localDst.push_back(it->first) ;
+              weight.push_back(it->second) ;
               (it->first)++ ;
             }
            }
           if (t < dstIndWeight.size()-1) t++ ;
-          if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ;
+          srcIndCompressed ++ ;
         }
         srcInd++ ;
@@ -1119,14 +1114,5 @@
 
 }
-
-
-
-
-
-
-
-
-
-
+CATCH
 
 /*!
@@ -1136,17 +1122,23 @@
 */
 void CGenericAlgorithmTransformation::computeIndexSourceMapping(const std::vector<CArray<double,1>* >& dataAuxInputs)
+TRY
 {
   computeIndexSourceMapping_(dataAuxInputs);
 }
+CATCH
 
 std::vector<StdString> CGenericAlgorithmTransformation::getIdAuxInputs()
+TRY
 {
   return idAuxInputs_;
 }
+CATCH
 
 CGenericAlgorithmTransformation::AlgoTransType CGenericAlgorithmTransformation::type()
+TRY
 {
   return type_;
 }
-
-}
+CATCH
+
+}
