Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/declare_ref_func.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/declare_ref_func.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/declare_ref_func.hpp	(revision 1984)
@@ -51,6 +51,4 @@
     SuperClassAttribute::setAttributes(refer_ptr, apply);              \
   }                                                                    \
-  if (this->hasAttribute("name") && this->name.isEmpty())              \
-    this->name.setValue(this->get##type##OutputName());                \
 }                                                                      \
                                                                        \
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp	(revision 1984)
@@ -29,11 +29,13 @@
       
       template<typename T>
-      void transfer(int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut)
+      void transfer(int repeat, int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut)
       {
         // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance)
-        dataOut.resize(dstSize_*sizeT) ;  
-        T* output = dataOut.dataFirst() ;
+        size_t dstSlice = dstSize_*sizeT ;
+        dataOut.resize(repeat* dstSlice) ;  
+        
         for(auto& data : dataIn)
         {
+          T* output = dataOut.dataFirst() ;
           int rank=data.first ;
           auto input  = data.second.dataFirst() ;
@@ -41,16 +43,27 @@
           auto& mask=mask_[rank] ;
           int size=mask.size() ;
-
-          for(int i=0, j=0 ;i<size;i++)
-          {
-            if (mask[i]) 
+          size_t srcSlice = size * sizeT ;
+          for(int l=0; l<repeat; l++)
+          {   
+            for(int i=0, j=0 ;i<size;i++)
             {
-              int cj = connector[j]*sizeT ;
-              int ci = i*sizeT ;
-              for (int k=0;k<sizeT;k++) output[cj+k] = input[ci+k] ;
-              j++ ;
+              if (mask[i]) 
+              {
+                int cj = connector[j]*sizeT ;
+                int ci = i*sizeT ;
+                for (int k=0;k<sizeT;k++) output[cj+k] = input[ci+k] ;
+                j++ ;
+              }
             }
+            input+=srcSlice ;
+            output+=dstSlice ;
           }
         }
+      }
+
+      template<typename T>
+      void transfer(int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut)
+      {
+        transfer(1, 1, dataIn, dataOut) ;
       }
     
@@ -101,5 +114,5 @@
       void transfer(map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut, T missingValue)
       {
-        transfer(1, dataIn, dataout, missingValue)
+        transfer(1, 1, dataIn, dataout, missingValue)
       }
       
@@ -107,7 +120,13 @@
       void transfer(int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut, T missingValue)
       {
-        dataOut.resize(dstSize_*sizeT) ;
+         transfer(1, sizeT, dataIn, dataOut, missingValue) ;
+      }
+
+      template<typename T>
+      void transfer(int repeat , int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut, T missingValue)
+      {
+        dataOut.resize(repeat*dstSize_*sizeT) ;
         dataOut=missingValue ;
-        transfer(sizeT, dataIn, dataOut) ;
+        transfer(1, sizeT, dataIn, dataOut) ;
       }
 
@@ -121,5 +140,5 @@
           (*subEvent.buffer) >> data ;
         }
-        transfer(sizeT, dataIn, dataOut) ;
+        transfer(1, sizeT, dataIn, dataOut) ;
       }
       
@@ -139,5 +158,5 @@
           (*subEvent.buffer) >> data ;
         }
-        transfer(sizeT, dataIn, dataOut, missingValue) ;
+        transfer(1, sizeT, dataIn, dataOut, missingValue) ;
       }
 
@@ -151,5 +170,5 @@
           (*subEvent.buffer) >> data ;
         }
-        transfer(1, dataIn, dataOut, missingValue) ;
+        transfer(1, 1, dataIn, dataOut, missingValue) ;
       }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.cpp	(revision 1984)
@@ -87,6 +87,14 @@
     srcView_[nSrc-1]->getGlobalIndex(srcGlobalIndex, sliceIndex, srcSliceSize.data(), srcView_.data(), nSrc-1) ;
     
-    CArray<size_t,1> srcGlobalIndexArray(srcGlobalIndex.data(), shape(srcGlobalIndex.size()),neverDeleteData) ;
-    dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ;
+    if (srcGlobalIndex.size()>0)
+    {
+      CArray<size_t,1> srcGlobalIndexArray(srcGlobalIndex.data(), shape(srcGlobalIndex.size()),neverDeleteData) ;
+      dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ;
+    }
+    else
+    {
+      CArray<size_t,1> srcGlobalIndexArray ;
+      dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ;
+    }
     const auto& returnInfo = dataRanks.getInfoIndexMap() ;
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/scatterer_connector.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/scatterer_connector.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/scatterer_connector.hpp	(revision 1984)
@@ -38,5 +38,5 @@
     void transfer(const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut)
     {
-      transfer(1, dataIn, dataOut) ;
+      transfer(1,1, dataIn, dataOut) ;
     }
 
@@ -44,5 +44,5 @@
     void transfer(const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut, T missingValue)
     {
-      transfer(1, dataIn, dataOut, missingValue) ;
+      transfer(1, 1, dataIn, dataOut, missingValue) ;
     }
 
@@ -50,5 +50,12 @@
     void transfer(int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut)
     {
+      transfer(1, sizeT, dataIn, dataOut)
+    }
+    
+    template<typename T, int n>
+    void transfer(int repeat, int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut)
+    {
       // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance)
+      size_t srcSlice = sizeT*srcSize_ ;
       for(auto& rankConnector : connector_)
       {
@@ -58,20 +65,27 @@
         int dstSize = mask.size() ;
         auto& data = dataOut[rank] ;
-        data.resize(dstSize * sizeT) ;
+        size_t dstSlice = dstSize*sizeT ;
+        data.resize(repeat*dstSlice) ;
         T* dstData = data.dataFirst() ;
         const T* srcData = dataIn.dataFirst() ;
-        for(int i=0, j=0; i<dstSize; i++)
-          if (mask[i]) 
-          {
-            for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ;
-            j++ ;
-          }
-      }
-    }
-
-    template<typename T, int n>
-    void transfer(int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut, T missingValue)
+        for(int l=0; l<repeat; l++)
+        {
+          for(int i=0, j=0; i<dstSize; i++)
+            if (mask[i]) 
+            {
+              for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ;
+              j++ ;
+            }
+          dstData+=dstSlice ;
+          srcData+=srcSlice ;
+        }
+      }
+    }
+
+    template<typename T, int n>
+    void transfer(int repeat, int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut, T missingValue)
     {
       // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance)
+      size_t srcSlice = sizeT*srcSize_ ;
       for(auto& rankConnector : connector_)
       {
@@ -81,18 +95,24 @@
         int dstSize = mask.size() ;
         auto& data = dataOut[rank] ;
-        data.resize(dstSize * sizeT) ;
+        size_t dstSlice = dstSize*sizeT ;
+        data.resize(repeat * dstSlice) ;
         T* dstData = data.dataFirst() ;
         const T* srcData = dataIn.dataFirst() ;
-        for(int i=0, j=0; i<dstSize; i++)
-          if (mask[i]) 
-          {
-            for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ;
-            j++ ;
-          }
-          else 
-          {
-            for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = missingValue ;
-            j++ ;
-          }
+        for(int l=0; l<repeat; l++)
+        {
+          for(int i=0, j=0; i<dstSize; i++)
+            if (mask[i]) 
+            {
+              for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ;
+              j++ ;
+            }
+            else 
+            {
+              for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = missingValue ;
+              j++ ;
+            }
+          dstData+=dstSlice ;
+          srcData+=srcSlice ;
+        }
       }
     }
@@ -101,5 +121,5 @@
     void transfer(const CArray<T,n>& dataIn, CContextClient* client, CEventClient& event, const CMessage& messageHeader)
     {
-      transfer(1, dataIn, client, event, messageHeader) ;
+      transfer( 1, dataIn, client, event, messageHeader) ;
     }
 
@@ -107,5 +127,5 @@
     void transfer(const CArray<T,n>& dataIn, T missingValue, CContextClient* client, CEventClient& event, const CMessage& messageHeader)
     {
-      transfer(1, dataIn, missingValue, client, event, messageHeader) ;
+      transfer( 1, dataIn, missingValue, client, event, messageHeader) ;
     }
 
@@ -114,5 +134,5 @@
     {
       map<int, CArray<T,1>> dataOut ;
-      transfer(sizeT, dataIn, dataOut) ;
+      transfer(1, sizeT, dataIn, dataOut) ;
       sendToServer(dataOut, client, event, messageHeader) ;
     }
@@ -122,5 +142,5 @@
     {
       map<int, CArray<T,1>> dataOut ;
-      transfer(sizeT, dataIn, dataOut, missingValue) ;
+      transfer(1, sizeT, dataIn, dataOut, missingValue) ;
       sendToServer(dataOut, client, event, messageHeader) ;
     }
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.cpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.cpp	(revision 1984)
@@ -0,0 +1,106 @@
+#include "transform_connector.hpp"
+#include "element.hpp"
+#include "scatterer_connector.hpp"
+#include "gatherer_connector.hpp"
+#include "client_client_dht_template.hpp"
+
+
+namespace xios
+{
+  void CTransformConnector::computeConnector(void)
+  {
+     CClientClientDHTTemplate<int>::Index2VectorInfoTypeMap info ;
+     
+     // first, insert destination global index into DHT
+     int rank ;
+     MPI_Comm_rank(localComm_, &rank) ;
+     CArray<size_t,1> globalIndex ;
+     dstView_->getGlobalIndexView(globalIndex) ;
+     for(int i=0;i<globalIndex.numElements();i++) info[globalIndex(i)].push_back(rank) ;  
+     CClientClientDHTTemplate<int> dataRanks(info, localComm_) ;
+
+    // get global src index from src view.
+    set<size_t> setGlobalIndex ; // all global index from src
+    srcView_->getGlobalIndexView(globalIndex) ;
+    for(int i=0;i<globalIndex.numElements();i++) setGlobalIndex.insert(globalIndex((i))) ;
+    
+    CArray<size_t,1> srcGlobalIndex(setGlobalIndex.size()) ;
+    int i=0 ;
+    for(auto& globalIndex : setGlobalIndex) 
+    {
+      srcGlobalIndex(i) = globalIndex ;
+      i++ ;
+    }
+   
+    dataRanks.computeIndexInfoMapping(srcGlobalIndex) ;
+    const auto& returnInfo = dataRanks.getInfoIndexMap() ;
+
+    map<int,vector<size_t>> vectorIndex ;
+    for(auto& rankIndGlo : returnInfo)
+    {
+      size_t indGlo = rankIndGlo.first ;
+      auto& listRank = rankIndGlo.second ;
+      for (auto& rank : listRank)  vectorIndex[rank].push_back(indGlo);
+    }
+
+    // convert vectorIndex into array    
+    map<int,CArray<size_t,1>> dstArrayIndex ;
+    for(auto& rankIndGlo : vectorIndex)
+    {
+      int rank = rankIndGlo.first ;
+      auto& indexVector = rankIndGlo.second ;
+      auto& arrayIndex = dstArrayIndex[rank] ;
+      CArray<size_t,1> arrayTmp(indexVector.data(), shape(indexVector.size()), duplicateData) ;
+      dstArrayIndex[rank].reference(arrayTmp) ;
+    }
+
+    // distributed element : where to send data
+    CDistributedElement dstElement(srcView_->getGlobalSize(), dstArrayIndex) ;
+    dstElement.addFullView() ;
+    
+    // create scatterer connector
+    int commSize ;
+    MPI_Comm_size(localComm_, &commSize) ;
+    scattererConnector_ = new CScattererConnector(srcView_, dstElement.getView(CElementView::FULL), localComm_, commSize ) ;
+    scattererConnector_->computeConnector() ;
+
+    // how much sender ?
+    vector<int> nbSenders(commSize) ;
+    int nbSender ;
+    for(auto& it : dstArrayIndex) nbSenders[it.first]=1 ;
+    vector<int> recvCounts(commSize,1) ;
+    MPI_Reduce_scatter(nbSenders.data(), &nbSender, recvCounts.data(), MPI_INT, MPI_SUM, localComm_) ;
+    
+    // transfer global index
+    map<int,CArray<size_t,1>> remoteArrayIndex ;
+    
+    vector<MPI_Request> sendReq ;
+    for(auto& it : dstArrayIndex)
+    {
+      MPI_Request req ;
+      MPI_Isend(it.second.dataFirst(), it.second.numElements(), MPI_SIZE_T, it.first,0, localComm_,&req) ;
+      sendReq.push_back(req) ;
+    }
+
+    for(int i=0; i<nbSender; i++) 
+    {
+      int size ;
+      MPI_Status status ;
+      MPI_Probe(MPI_ANY_SOURCE, 0, localComm_, &status ) ;
+      MPI_Get_count(&status, MPI_SIZE_T, &size) ;
+      vector<size_t> recvBuff(size) ;
+      MPI_Recv(recvBuff.data(), size, MPI_SIZE_T, status.MPI_SOURCE,0,localComm_,&status) ;
+      CArray<size_t,1> arrayTmp(recvBuff.data(), shape(recvBuff.size()), duplicateData) ;
+      remoteArrayIndex[status.MPI_SOURCE].reference(arrayTmp) ;
+      recvRankSize_[status.MPI_SOURCE] = size ;
+    }
+    vector<MPI_Status> sendStatus(sendReq.size()) ;
+    MPI_Waitall(sendReq.size(),sendReq.data(),sendStatus.data()) ;
+
+    CDistributedElement remoteElement(dstView_->getGlobalSize(), remoteArrayIndex) ;
+    remoteElement.addFullView() ;
+    gathererConnector_=new CGathererConnector(remoteElement.getView(CElementView::FULL),dstView_) ;
+    gathererConnector_->computeConnector() ;
+
+  }
+}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.hpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.hpp	(revision 1984)
@@ -0,0 +1,80 @@
+#ifndef __TRANSFORM_CONNECTOR_HPP__
+#define __TRANSFORM_CONNECTOR_HPP__
+
+#include "xios_spl.hpp"
+#include "array_new.hpp"
+#include "distributed_view.hpp"
+#include "local_view.hpp"
+#include "scatterer_connector.hpp"
+#include "gatherer_connector.hpp"
+#include "mpi.hpp"
+
+namespace xios
+{
+ 
+  
+  class CTransformConnector
+  {
+     
+    public:
+      CTransformConnector(CLocalView* srcView, CLocalView* dstView, MPI_Comm localComm) 
+                          : srcView_(srcView), dstView_(dstView), localComm_(localComm) {}
+    
+      void computeConnector(void) ; 
+    private:
+
+      MPI_Comm localComm_ ;
+      CLocalView* srcView_ ;
+      CLocalView* dstView_ ;
+      map<int,int> recvRankSize_ ;
+      CScattererConnector* scattererConnector_=nullptr ;
+      CGathererConnector*  gathererConnector_=nullptr ;
+   
+    public:
+      template<typename T> 
+      void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut)
+      {
+        map<int,CArray<T,1>> tmpArrayIn ;
+        scattererConnector_->transfer(repeat, sizeT, dataIn, tmpArrayIn) ;
+        vector<MPI_Request> requests ;
+        MPI_Request request ;
+        for(auto it : tmpArrayIn)
+        {
+          auto& array = it.second ; 
+          MPI_Issend(array.dataFirst(), array.numElements(), MPI_GetType<T>(), it.first, 0, localComm_, &request) ;
+          requests.push_back(request) ;
+        }
+        
+        map<int,CArray<T,1>> tmpArrayOut ;
+        for(auto it : recvRankSize_)
+        {
+          auto& array = tmpArrayOut[it.first] ;
+          array.resize(it.second*repeat*sizeT) ;
+          MPI_Irecv(array.dataFirst(), array.numElements(), MPI_GetType<T>(), it.first, 0, localComm_, &request) ;
+          requests.push_back(request) ;
+        }
+        
+        vector<MPI_Status> status(requests.size()) ;
+        MPI_Waitall(requests.size(), requests.data(),status.data()) ;
+        
+        const double nanValue = std::numeric_limits<double>::quiet_NaN();
+        gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, nanValue) ;
+      }
+
+      template<typename T> 
+      void transfer(int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut)
+      {
+        transfer(1, sizeT, dataIn, dataOut) ;
+      }
+   
+      template<typename T> 
+      void transfer(const CArray<T,1>& dataIn, CArray<T,1>& dataOut)
+      {
+        transfer(1, 1, dataIn, dataOut) ;
+      }
+
+  };
+
+}
+
+#endif
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.cpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.cpp	(revision 1984)
@@ -0,0 +1,41 @@
+#include "weight_transform_connector.hpp"
+
+namespace xios
+{
+
+  CWeightTransformConnector::CWeightTransformConnector(CLocalView* srcView, CLocalView* dstView, unordered_map<int, std::vector<int>>& indexMap, 
+                                                   unordered_map<int, std::vector<double>>& weightMap) : srcView_(srcView), dstView_(dstView)
+  {
+    computeConnector(indexMap, weightMap) ;
+  }
+
+  void CWeightTransformConnector::computeConnector(unordered_map<int, std::vector<int>>& indexMap, 
+                                                   unordered_map<int, std::vector<double>>& weightMap)
+  {
+    CArray<size_t,1> dstGlobalIndex ;
+    CArray<size_t,1> srcGlobalIndex ;
+    dstView_->getGlobalIndexView(dstGlobalIndex) ;
+    srcView_->getGlobalIndexView(srcGlobalIndex) ;
+    unordered_map<size_t,int> srcMapIndex ;
+    srcSize_ = srcGlobalIndex.numElements() ;
+    dstSize_ = dstGlobalIndex.numElements() ;
+
+    for(int i=0;i<srcSize_;i++) srcMapIndex[srcGlobalIndex(i)]=i ;
+    for(int i=0; i< dstSize_;i++) 
+    {
+      if (indexMap.count(dstGlobalIndex(i))!=0 && weightMap.count(dstGlobalIndex(i))!=0)
+      {
+        auto& vectIndex  = indexMap[dstGlobalIndex(i)] ;
+        auto& vectWeight = weightMap[dstGlobalIndex(i)] ;
+        nWeights_.push_back(vectIndex.size()) ;
+        for(int j=0; j<vectIndex.size();j++)
+        {
+          connector_.push_back(srcMapIndex[vectIndex[j]]) ;
+          weights_.push_back(vectWeight[j]) ;
+        }
+      }
+      else nWeights_.push_back(0) ;
+    }
+  }
+
+}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.hpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.hpp	(revision 1984)
@@ -0,0 +1,69 @@
+#ifndef __WEIGHT_TRANSFORM_CONNECTOR_HPP__
+#define __WEIGHT_TRANSFORM_CONNECTOR_HPP__
+
+#include "xios_spl.hpp"
+#include "array_new.hpp"
+#include "local_view.hpp"
+
+
+
+namespace xios
+{
+  
+  class CWeightTransformConnector
+  {
+    
+    private:
+      CLocalView* srcView_;
+      CLocalView* dstView_;
+
+      vector<double> weights_; //  sizeof sum(nWeights_)  
+      vector<int> connector_;  //  sizeof sum(nWeights_)  
+      vector<int> nWeights_ ;  //  sizeof dstSize_ 
+      int srcSize_ ;
+      int dstSize_ ;
+
+     void computeConnector(unordered_map<int, std::vector<int>>& indexMap, unordered_map<int, std::vector<double>>& weightMap) ;
+      
+    public:
+
+    CWeightTransformConnector(CLocalView* srcView, CLocalView* dstView, unordered_map<int, std::vector<int>>& indexMap, 
+                              unordered_map<int, std::vector<double>>& weightMap) ;
+ 
+    void transfer(int repeat, int sizeT, const CArray<double,1>& dataIn, CArray<double,1>& dataOut)
+    {
+      int dstSlice = dstSize_*sizeT ;
+      int srcSlice = srcSize_*sizeT ;
+      dataOut.resize(repeat* dstSlice) ;
+      dataOut=0 ; // what to do about missing value => next step ?
+
+      const double* input = dataIn.dataFirst()  ;
+      double* output = dataOut.dataFirst()  ;
+
+      for(int r=0;r<repeat;r++, input+=srcSlice, output+=dstSlice)
+      {
+        const double* in = input;
+        double* out = output ;
+        int k=0 ;
+        for(int i=0; i<dstSize_; i++, out+=sizeT)
+          for(int j=0 ; j<nWeights_[i] ; j++,k++)
+            for(int l=0; l<sizeT; l++) out[l] += in[connector_[k]*sizeT+l]*weights_[k] ;
+      }
+    }
+
+    void transfer(int sizeT, const CArray<double,1>& dataIn, CArray<double,1>& dataOut)
+    { 
+      transfer(1,sizeT, dataIn, dataOut) ;
+    }
+    
+    void transfer(const CArray<double,1>& dataIn, CArray<double,1>& dataOut)
+    {
+      transfer(1,1,dataIn, dataOut) ;
+    }
+
+  
+  };
+
+}
+
+#endif
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/client_to_server_store_filter.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/client_to_server_store_filter.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/client_to_server_store_filter.cpp	(revision 1984)
@@ -25,5 +25,5 @@
     CMessage message ;
     message<<field_->getId() << data[0]->timestamp ;
-    field_->getGrid()->getClientToServerConnector(client_)->transfer(data[0]->data, client_, event, message) ;
+    field_->getSentGrid()->getClientToServerConnector(client_)->transfer(data[0]->data, client_, event, message) ;
     CTimer::get("Field : send data").suspend();
   }
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.cpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.cpp	(revision 1984)
@@ -0,0 +1,28 @@
+#include "transform_filter.hpp"
+
+namespace xios
+{
+  
+  CTransformFilter::CTransformFilter( CGarbageCollector& gc, CGenericAlgorithmTransformation* algo, int dimBefore, int dimAfter, 
+                                      bool detectMissingValues, double defaultValue) 
+                                    : CFilter(gc, 1, this), algorithm_(algo), dimBefore_(dimBefore), dimAfter_(dimAfter), 
+                                      detectMissingValues_(detectMissingValues), defaultValue_(defaultValue)
+  {
+
+  }
+
+  CDataPacketPtr CTransformFilter::apply(std::vector<CDataPacketPtr> data)
+  {
+    // for now, no auxilliairy field
+    CDataPacketPtr packet(new CDataPacket);
+    packet->date = data[0]->date;
+    packet->timestamp = data[0]->timestamp;
+    packet->status = data[0]->status;
+
+    if (packet->status == CDataPacket::NO_ERROR) algorithm_->apply(dimBefore_, dimAfter_, data[0]->data, packet->data);
+    return packet;
+  }
+
+
+
+}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.hpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.hpp	(revision 1984)
@@ -0,0 +1,40 @@
+#ifndef __XIOS_TRANSFORM_FILTER_HPP__
+#define __XIOS_TRANSFORM_FILTER_HPP__
+
+#include "filter.hpp"
+#include "generic_algorithm_transformation.hpp"
+
+namespace xios
+{
+  
+  /*!
+   * A generic filter with multiple input slots wrapping any type of spatial transformations.
+   */
+  class CTransformFilter : public CFilter, IFilterEngine
+  {
+    public:
+
+      CTransformFilter(CGarbageCollector& gc, CGenericAlgorithmTransformation* algo, int dimBefore, int dimAfter, 
+                              bool detectMissingValues, double defaultValue) ;
+
+    protected:
+      /*!
+        Overriding this function to process transformations with auxillary inputs
+      */
+      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data) ;
+      void apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest);
+
+    private :
+     
+     CGenericAlgorithmTransformation* algorithm_ ;
+     int dimBefore_ ;
+     int dimAfter_ ;
+     bool detectMissingValues_ ;
+     bool defaultValue_ ;
+
+  }; // class CTransformFilter
+
+
+} // namespace xios
+
+#endif //__XIOS_CSpatialTransformFilter__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.cpp	(revision 1984)
@@ -26,3 +26,4 @@
     return ret ;
   }
+
 }
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.hpp	(revision 1984)
@@ -1,3 +1,4 @@
 #ifndef __XIOS_MPI_TOOLS_HPP__
+#define __XIOS_MPI_TOOLS_HPP__
 
 #include <string>
@@ -7,4 +8,30 @@
 
   int MPI_Bcast_string(std::string& str, int root, MPI_Comm comm) ;
+
+  template<typename T> 
+  MPI_Datatype MPI_GetType(void) ;
+
+  template<>
+  MPI_Datatype MPI_GetType<char>(void) { return MPI_CHAR ;}
+
+  template<>
+  MPI_Datatype MPI_GetType<short int>(void) { return MPI_SHORT ;}
+
+  template<>
+  MPI_Datatype MPI_GetType<int>(void) { return MPI_INT ;}
+
+  template<>
+  MPI_Datatype MPI_GetType<size_t>(void) { return MPI_SIZE_T ;}
+
+  template<>
+  MPI_Datatype MPI_GetType<float>(void) { return MPI_FLOAT ;}
+
+  template<>
+  MPI_Datatype MPI_GetType<double>(void) { return MPI_DOUBLE ;}
+
+  template<>
+  MPI_Datatype MPI_GetType<long double>(void) { return MPI_LONG_DOUBLE ;}
+
+
 } 
 #endif
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp	(revision 1984)
@@ -555,5 +555,5 @@
    * Go through the hierarchy to find the axis from which the transformations must be inherited
    */
-  void CAxis::solveInheritanceTransformation()
+  void CAxis::solveInheritanceTransformation_old()
   TRY
   {
@@ -572,4 +572,41 @@
       for (size_t i = 0; i < refAxis.size(); ++i)
         refAxis[i]->setTransformations(axis->getAllTransformations());
+  }
+  CATCH_DUMP_ATTR
+
+  void CAxis::solveInheritanceTransformation()
+  TRY
+  {
+    if (solveInheritanceTransformation_done_) return;
+    else solveInheritanceTransformation_done_=true ;
+
+    CAxis* axis = this;
+    std::list<CAxis*> refAxis;
+    bool out=false ;
+    vector<StdString> excludedAttr;
+    excludedAttr.push_back("axis_ref");
+    
+    refAxis.push_front(axis) ;
+    while (axis->hasDirectAxisReference() && !out)
+    {
+      CAxis* lastAxis=axis ;
+      axis = axis->getDirectAxisReference();
+      axis->solveRefInheritance() ;
+      if (!axis->SuperClass::isEqual(lastAxis,excludedAttr)) out=true ;
+      refAxis.push_front(axis) ;
+    }
+
+    CTransformationPaths::TPath path ;
+    auto& pathList = std::get<2>(path) ;
+    std::get<0>(path) = EElement::AXIS ;
+    std::get<1>(path) = refAxis.front()->getId() ;
+    for (auto& axis : refAxis)
+    {
+      CAxis::TransMapTypes transformations = axis->getAllTransformations();
+      for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), 
+                                                                      transformation.second->getId()}) ;
+    }
+    transformationPaths_.addPath(path) ;
+
   }
   CATCH_DUMP_ATTR
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp	(revision 1984)
@@ -16,4 +16,5 @@
 #include "transformation.hpp"
 #include "transformation_enum.hpp"
+#include "transformation_path.hpp"
 #include "element.hpp"
 #include "local_connector.hpp"
@@ -21,7 +22,9 @@
 #include "gatherer_connector.hpp"
 #include "distribution_type.hpp"
-
-
-namespace xios {
+#include "generic_algorithm_transformation.hpp"
+
+
+namespace xios
+{
    /// ////////////////////// DÃ©clarations ////////////////////// ///
 
@@ -57,5 +60,4 @@
          typedef CAxisAttributes RelAttributes;
          typedef CAxisGroup      RelGroup;
-         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
 
       public:
@@ -79,5 +81,5 @@
          bool isDistributed(void) const;
         
-        public:
+      public:
         /*!
             \brief return if the axis can be written or not in a compressed way.
@@ -86,10 +88,10 @@
          */ 
          bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} 
-        private:
+      private:
          bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ 
          bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/
          void computeIsCompressible() ;
         
-        public:
+      public:
 
          /// Mutateur ///
@@ -119,9 +121,38 @@
          size_t getGlobalWrittenSize(void) ;
 
-         bool hasTransformation();
-         void solveInheritanceTransformation();
-         TransMapTypes getAllTransformations();         
-         void duplicateTransformation(CAxis*);
-         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
+      //////////////////////////
+      ///// transformations ////
+      //////////////////////////
+      public:
+        typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
+      private:
+        static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
+        static std::map<StdString, ETranformationType> transformationMapList_;
+        static bool dummyTransformationMapList_;
+        TransMapTypes transformationMap_;         
+
+      public:
+        CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
+        CTransformation<CAxis>* addTransformation(ETranformationType transType, CTransformation<CAxis>* transformation) ;
+        void setTransformations(const TransMapTypes&);         
+        void duplicateTransformation(CAxis*);
+        TransMapTypes getAllTransformations();
+        bool hasTransformation();
+        void solveInheritanceTransformation_old(); // to remove later
+        void solveInheritanceTransformation();
+      private:
+        bool solveInheritanceTransformation_done_= false ;
+      private:
+        CGenericAlgorithmTransformation* transformationAlgorithm_ = nullptr ;
+      public:
+        void setTransformationAlgorithm(CGenericAlgorithmTransformation* transformationAlgorithm) { transformationAlgorithm=transformationAlgorithm ;}
+        CGenericAlgorithmTransformation* getTransformationAlgorithm(void) { return transformationAlgorithm_ ;}   
+      private:
+        CTransformationPaths transformationPaths_ ;
+      public:
+        CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} 
+        void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;}
+
+      ////////////////////////////
          bool isEqual(CAxis* axis);
 
@@ -131,5 +162,5 @@
         bool hasLabel;
 
-       private:
+      private:
          void checkData();
          void checkMask();
@@ -145,6 +176,4 @@
          void makeAliasForCoupling(const string& fieldId, int posInGrid) ;
 
-      private:
-         void setTransformations(const TransMapTypes&);
 
       private:
@@ -177,14 +206,6 @@
          bool isChecked;
          std::set<StdString> relFiles, relFilesCompressed;
-         TransMapTypes transformationMap_;         
-
-         std::map<int, std::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server
+          std::map<int, std::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server
          std::map<int, std::vector<int> > connectedServerRank_;
-
-       private:
-         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
-         static std::map<StdString, ETranformationType> transformationMapList_;
-         static bool dummyTransformationMapList_;
-
 
        //////////////////////////////////////////////////////////////////////////////////////
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CComputeConnectivityDomain::registerTrans()
   {
-    registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, CComputeConnectivityDomain::create);
+    registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CComputeConnectivityDomain> SuperClass;
       typedef CComputeConnectivityDomainAttributes SuperClassAttribute;
+      typedef CComputeConnectivityDomain MyClass ;
+      typedef CTransformation<CDomain> SuperTransform ;
 
     public :
@@ -56,9 +58,14 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_COMPUTE_CONNECTIVITY_DOMAIN ;}
+      static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
-  }; // class CComputeConnectivityDomain
+    public:
+   }; // class CComputeConnectivityDomain
 
   DECLARE_GROUP(CComputeConnectivityDomain);
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp	(revision 1984)
@@ -1302,20 +1302,4 @@
    CATCH_DUMP_ATTR
 
-   void CContext::buildFilterGraphOfEnabledFields()
-   TRY
-   {
-     int size = this->enabledFiles.size();
-     for (int i = 0; i < size; ++i)
-     {
-       this->enabledFiles[i]->buildFilterGraphOfEnabledFields(garbageCollector);
-     }
-
-     size = this->enabledCouplerOut.size();
-     for (int i = 0; i < size; ++i)
-     {
-       this->enabledCouplerOut[i]->buildFilterGraphOfEnabledFields(garbageCollector);
-     }
-   }
-   CATCH_DUMP_ATTR
 
    void CContext::postProcessFilterGraph()
@@ -1380,20 +1364,5 @@
   CATCH_DUMP_ATTR
 
-  void CContext::solveAllRefOfFieldsWithReadAccess()
-  TRY
-  {
-    for (size_t i = 0; i < fieldsWithReadAccess_.size(); ++i)
-      fieldsWithReadAccess_[i]->solveAllReferenceEnabledField(false);
-  }
-  CATCH_DUMP_ATTR
-
-  void CContext::buildFilterGraphOfFieldsWithReadAccess()
-  TRY
-  {
-    for (size_t i = 0; i < fieldsWithReadAccess_.size(); ++i)
-      fieldsWithReadAccess_[i]->buildFilterGraph(garbageCollector, true);
-  }
-  CATCH_DUMP_ATTR
-
+  
    void CContext::solveAllInheritance(bool apply)
    TRY
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp	(revision 1984)
@@ -139,5 +139,4 @@
          void prepareTimeseries(void);
          void solveOnlyRefOfEnabledFields(void);         
-         void buildFilterGraphOfEnabledFields();
          void postProcessFilterGraph();
          void startPrefetchingOfEnabledReadModeFiles();
@@ -145,6 +144,4 @@
          void doPostTimestepOperationsForEnabledReadModeFiles();
          void findFieldsWithReadAccess(void);
-         void solveAllRefOfFieldsWithReadAccess();
-         void buildFilterGraphOfFieldsWithReadAccess();
          void triggerLateFields(void) ;
          void solveAllRefOfEnabledFieldsAndTransform(void);
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp	(revision 1984)
@@ -1,4 +1,3 @@
 #include "domain.hpp"
-
 #include "attribute_template.hpp"
 #include "object_template.hpp"
@@ -25,4 +24,5 @@
 #include "grid_scatterer_connector.hpp"
 #include "grid_gatherer_connector.hpp"
+#include "transformation_path.hpp"
 
 
@@ -77,20 +77,4 @@
      CDomain* domain = CDomainGroup::get("domain_definition")->createChild();
      return domain;
-   }
-   CATCH
-
-   std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>();
-   bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_);
-
-   bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m)
-   TRY
-   {
-     m["zoom_domain"] = TRANS_ZOOM_DOMAIN;
-     m["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN;
-     m["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN;
-     m["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN;
-     m["expand_domain"] = TRANS_EXPAND_DOMAIN;
-     m["reorder_domain"] = TRANS_REORDER_DOMAIN;
-     m["extract_domain"] = TRANS_EXTRACT_DOMAIN;
    }
    CATCH
@@ -2179,5 +2163,25 @@
   CATCH_DUMP_ATTR
 
- 
+/////////////////////////////////////////////////////////////////////////
+///////////////             TRANSFORMATIONS                    //////////
+/////////////////////////////////////////////////////////////////////////
+
+  std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>();
+  bool CDomain::dummyTransformationMapList_ = CDomain::initializeTransformationMap(CDomain::transformationMapList_);
+
+  bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m)
+  TRY
+  {
+    m["zoom_domain"] = TRANS_ZOOM_DOMAIN;
+    m["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN;
+    m["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN;
+    m["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN;
+    m["expand_domain"] = TRANS_EXPAND_DOMAIN;
+    m["reorder_domain"] = TRANS_REORDER_DOMAIN;
+    m["extract_domain"] = TRANS_EXTRACT_DOMAIN;
+  }
+  CATCH
+
+
   CTransformation<CDomain>* CDomain::addTransformation(ETranformationType transType, const StdString& id)
   TRY
@@ -2188,4 +2192,11 @@
   CATCH_DUMP_ATTR
 
+  CTransformation<CDomain>* CDomain::addTransformation(ETranformationType transType, CTransformation<CDomain>* transformation)
+  TRY
+  {
+    transformationMap_.push_back(std::make_pair(transType, transformation));
+    return transformationMap_.back().second;
+  }
+  CATCH_DUMP_ATTR
   /*!
     Check whether a domain has transformation
@@ -2234,5 +2245,5 @@
    * Go through the hierarchy to find the domain from which the transformations must be inherited
    */
-  void CDomain::solveInheritanceTransformation()
+  void CDomain::solveInheritanceTransformation_old()
   TRY
   {
@@ -2253,4 +2264,46 @@
   }
   CATCH_DUMP_ATTR
+
+
+  void CDomain::solveInheritanceTransformation()
+  TRY
+  {
+    if (solveInheritanceTransformation_done_) return;
+    else solveInheritanceTransformation_done_=true ;
+
+    CDomain* domain = this;
+    CDomain* Lastdomain ;
+    std::list<CDomain*> refDomains;
+    bool out=false ;
+    vector<StdString> excludedAttr;
+    excludedAttr.push_back("domain_ref");
+    
+    refDomains.push_front(domain) ;
+    while (domain->hasDirectDomainReference() && !out)
+    {
+      CDomain* lastDomain=domain ;
+      domain = domain->getDirectDomainReference();
+      domain->solveRefInheritance() ;
+      if (!domain->SuperClass::isEqual(lastDomain,excludedAttr)) out=true ;
+      refDomains.push_front(domain) ;
+    }
+
+    CTransformationPaths::TPath path ;
+    auto& pathList = std::get<2>(path) ;
+    std::get<0>(path) = EElement::DOMAIN ;
+    std::get<1>(path) = refDomains.front()->getId() ;
+    for (auto& domain : refDomains)
+    {
+      CDomain::TransMapTypes transformations = domain->getAllTransformations();
+      for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), 
+                                                                      transformation.second->getId()}) ;
+    }
+    transformationPaths_.addPath(path) ;
+
+  }
+  CATCH_DUMP_ATTR
+  
+/////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////// 
 
   void CDomain::setContextClient(CContextClient* contextClient)
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp	(revision 1984)
@@ -16,4 +16,5 @@
 #include "transformation.hpp"
 #include "transformation_enum.hpp"
+#include "transformation_path.hpp"
 #include "server_distribution_description.hpp"
 #include "mesh.hpp"
@@ -23,7 +24,9 @@
 #include "gatherer_connector.hpp"
 #include "distribution_type.hpp"
-
-
-namespace xios {
+#include "generic_algorithm_transformation.hpp"
+
+
+namespace xios
+{
 
    /// ////////////////////// DÃ©clarations ////////////////////// ///
@@ -61,6 +64,5 @@
          typedef CDomainAttributes RelAttributes;
          typedef CDomainGroup      RelGroup;
-         typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes;
-
+         
          /// Constructeurs ///
          CDomain(void);
@@ -82,10 +84,41 @@
          bool checkAttributes_done_ = false ;
 
-         bool hasTransformation();
-         void solveInheritanceTransformation();
-         TransMapTypes getAllTransformations();
+         
+      //////////////////////////
+      ///// transformations ////
+      //////////////////////////
+      public:
+        typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes;
+      private:
+        static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
+        static std::map<StdString, ETranformationType> transformationMapList_;
+        static bool dummyTransformationMapList_;
+        TransMapTypes transformationMap_;         
+
+      public:
+        CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id="");
+        CTransformation<CDomain>* addTransformation(ETranformationType transType, CTransformation<CDomain>* transformation) ;
+        void setTransformations(const TransMapTypes&);         
+        void duplicateTransformation(CDomain*);
+        TransMapTypes getAllTransformations();
+        bool hasTransformation();
+        void solveInheritanceTransformation_old(); // to remove later
+        void solveInheritanceTransformation();
+      private:
+        bool solveInheritanceTransformation_done_= false ;
+      private:
+        CGenericAlgorithmTransformation* transformationAlgorithm_ = nullptr ;
+      public:
+        void setTransformationAlgorithm(CGenericAlgorithmTransformation* transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;}
+        CGenericAlgorithmTransformation* getTransformationAlgorithm(void) { return transformationAlgorithm_ ;}   
+      private:
+        CTransformationPaths transformationPaths_ ;
+      public:
+        CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} 
+        void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;}
+
+      ////////////////////////////
+
          void redistribute(int nbLocalDomain);
-         void duplicateTransformation(CDomain*);
-         CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id="");
 
       public:
@@ -195,7 +228,4 @@
          void checkArea(void);
          void checkLonLat();
-
-         void setTransformations(const TransMapTypes&);         
-         void computeNGlobDomain();
          
        public:
@@ -239,13 +269,7 @@
 
          bool isRedistributed_;
-         TransMapTypes transformationMap_;         
          bool isUnstructed_;
 
        
-       private:
-         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
-         static std::map<StdString, ETranformationType> transformationMapList_;
-         static bool _dummyTransformationMapList;
-
        //////////////////////////////////////////////////////////////////////////////////////
        //  this part is related to distribution, element definition, views and connectors  //
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.cpp	(revision 1984)
@@ -28,5 +28,5 @@
   bool CDuplicateScalarToAxis::registerTrans()
   {
-    return registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, CDuplicateScalarToAxis::create);
+    return registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CDuplicateScalarToAxis> SuperClass;
       typedef CDuplicateScalarToAxisAttributes SuperClassAttribute;
+      typedef CDuplicateScalarToAxis MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_DUPLICATE_SCALAR_TO_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/element_type.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/element_type.hpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/element_type.hpp	(revision 1984)
@@ -0,0 +1,9 @@
+#ifndef __XIOS_ELEMENT_TYPE_HPP__
+#define __XIOS_ELEMENT_TYPE_HPP__
+
+namespace xios
+{
+  enum class EElement { DOMAIN, AXIS, SCALAR} ;   
+}
+
+#endif // __XIOS_ELEMENT_TYPE_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CExpandDomain::registerTrans()
   {
-    registerTransformation(TRANS_EXPAND_DOMAIN, CExpandDomain::create);
+    registerTransformation(TRANS_EXPAND_DOMAIN, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CExpandDomain> SuperClass;
       typedef CExpandDomainAttributes SuperClassAttribute;
+      typedef CExpandDomain MyClass ;
+      typedef CTransformation<CDomain> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_EXPAND_DOMAIN ;}
+      static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.cpp	(revision 1984)
@@ -26,5 +26,5 @@
   bool CExtractAxis::registerTrans()
   {
-    return registerTransformation(TRANS_EXTRACT_AXIS, CExtractAxis::create);
+    return registerTransformation(TRANS_EXTRACT_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CExtractAxis> SuperClass;
       typedef CExtractAxisAttributes SuperClassAttribute;
+      typedef CExtractAxis MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_EXTRACT_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.cpp	(revision 1984)
@@ -28,5 +28,5 @@
   bool CExtractAxisToScalar::registerTrans()
   {
-    return registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, CExtractAxisToScalar::create);
+    return registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CExtractAxisToScalar> SuperClass;
       typedef CExtractAxisToScalarAttributes SuperClassAttribute;
+      typedef CExtractAxisToScalar MyClass ;
+      typedef CTransformation<CScalar> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_EXTRACT_AXIS_TO_SCALAR ;}
+      static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CExtractDomain::registerTrans()
   {
-    registerTransformation(TRANS_EXTRACT_DOMAIN, CExtractDomain::create);
+    registerTransformation(TRANS_EXTRACT_DOMAIN, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CExtractDomain> SuperClass;
       typedef CExtractDomainAttributes SuperClassAttribute;
+      typedef CExtractDomain MyClass ;
+      typedef CTransformation<CDomain> SuperTransform ;
 
     public :
@@ -56,8 +58,12 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
-    private:
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_EXTRACT_DOMAIN ;}
+      static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
+     private:
       static bool registerTrans();
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
-      static bool _dummyRegistered;
+     static bool _dummyRegistered;
   }; // class CExtractDomain
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.cpp	(revision 1984)
@@ -28,5 +28,5 @@
   bool CExtractDomainToAxis::registerTrans()
   {
-    return registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, CExtractDomainToAxis::create);
+    return registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.hpp	(revision 1984)
@@ -41,5 +41,7 @@
       typedef CObjectTemplate<CExtractDomainToAxis> SuperClass;
       typedef CExtractDomainToAxisAttributes SuperClassAttribute;
-
+      typedef CExtractDomainToAxis MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
+ 
     public :
       /// Constructeurs ///
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_EXTRACT_DOMAIN_TO_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp	(revision 1984)
@@ -766,7 +766,22 @@
 
       CGrid* gridSrc=getDirectFieldReference()->getGrid() ;
+      std::shared_ptr<COutputPin> lastFilter ;
+      if (filterExpr) lastFilter=filterExpr ;
+      else lastFilter = inputFilter ;
+      CGrid* newGrid ;    
+      
       for(auto grid : gridPath)
       {
         grid->solveElementsRefInheritance() ;
+       
+        // new
+        
+        std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid->buildTransformationGraph(gc, gridSrc, detectMissingValues, defaultValue, newGrid) ;
+        lastFilter->connectOutput(filters.first, 0);
+        lastFilter = filters.second;
+        gridSrc = newGrid ;
+
+        // end new
+/*
         grid->completeGrid(gridSrc); // grid generation, to be checked
         grid->checkElementsAttributes() ;
@@ -775,6 +790,8 @@
           if (!CField::get(fieldId)->buildWorkflowGraph(gc)) return false ;
         gridSrc=grid ;
-      }
-      
+*/
+      }
+
+    /*  
       std::shared_ptr<COutputPin> lastFilter ;
       if (filterExpr) lastFilter=filterExpr ;
@@ -793,4 +810,7 @@
         }
       }
+    */
+      grid_=newGrid ;
+      grid_ref=grid_->getId() ; // for server 
       instantDataFilter = lastFilter ;
       
@@ -824,5 +844,9 @@
 
         grid_->solveElementsRefInheritance() ;
-        grid_->completeGrid(); // grid generation, to be checked
+        CGrid* newGrid ;
+        std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid_->buildTransformationGraph(gc, nullptr, detectMissingValues, defaultValue, newGrid) ;
+        grid_ = newGrid ;
+        grid_ref=grid_->getId() ; // for server 
+//        grid_->completeGrid(); // grid generation, to be checked => later
         grid_->checkElementsAttributes() ;
         instantDataFilter=inputFilter ;
@@ -1603,5 +1627,7 @@
     CContext::getCurrent()->sendContextToFileServer(client);
     getRelFile()->sendFileToFileServer(client);
-    grid_->sendGridToFileServer(client);
+    sentGrid_ = grid_-> duplicateSentGrid() ;
+    sentGrid_->sendGridToFileServer(client);
+    name = getFieldOutputName() ;
     this->sendAllAttributesToServer(client);
     this->sendAddAllVariables(client);
@@ -1697,5 +1723,5 @@
     if (grid_ref.isEmpty())
     {
-      grid_ref=grid_->getId() ;
+      grid_ref=sentGrid_->getId() ;
       SuperClass::sendAllAttributesToServer(client) ;
       domain_ref.reset() ;
@@ -1704,5 +1730,11 @@
       grid_ref.reset();
     }
-    else SuperClass::sendAllAttributesToServer(client) ;
+    else 
+    {
+      string tmp = grid_ref;
+      grid_ref = sentGrid_->getId() ;
+      SuperClass::sendAllAttributesToServer(client) ;
+      grid_ref = tmp ;
+    }
   }
   CATCH_DUMP_ATTR
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp	(revision 1984)
@@ -227,6 +227,5 @@
 
         bool hasGridMask(void) const;
-        CGrid* getGrid(void) { return grid_; } 
-
+        
         void connectToFileServer(CGarbageCollector& gc) ;
         void connectToCouplerOut(CGarbageCollector& gc) ;
@@ -268,4 +267,12 @@
 
          CGrid*  grid_=nullptr;
+         CGrid* getGrid(void) { return grid_; } 
+      
+      private:
+         CGrid* sentGrid_=nullptr ;
+      public:
+         CGrid* getSentGrid(void) { return sentGrid_; }    
+
+      public:
 //         CFile*  file;
          
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CGenerateRectilinearDomain::registerTrans()
   {
-    registerTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, create);
+    registerTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CGenerateRectilinearDomain> SuperClass;
       typedef CGenerateRectilinearDomainAttributes SuperClassAttribute;
+      typedef CGenerateRectilinearDomain MyClass ;
+      typedef CTransformation<CDomain> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_GENERATE_RECTILINEAR_DOMAIN ;}
+      static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp	(revision 1984)
@@ -24,7 +24,11 @@
 #include "grid_local_view.hpp"
 #include "grid_mask_connector.hpp"
-
-
-namespace xios {
+#include "transformation_path.hpp"
+#include "grid_transformation_factory_impl.hpp"
+#include "transform_filter.hpp"
+
+
+namespace xios
+{
 
    /// ////////////////////// Dfinitions ////////////////////// ///
@@ -236,5 +240,7 @@
      axis_domain_order.resize(order_.size());
      for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx];
-     return vDomainGroup_->createChild(id);
+     CDomain* domain = vDomainGroup_->createChild(id);
+     computeElements();
+     return domain ;
    }
    CATCH_DUMP_ATTR
@@ -246,5 +252,7 @@
      axis_domain_order.resize(order_.size());
      for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx];
-     return vAxisGroup_->createChild(id);
+     CAxis* axis=vAxisGroup_->createChild(id);
+     computeElements(); 
+     return axis ;
    }
    CATCH_DUMP_ATTR
@@ -256,5 +264,7 @@
      axis_domain_order.resize(order_.size());
      for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx];
-     return vScalarGroup_->createChild(id);
+     CScalar* scalar =  vScalarGroup_->createChild(id);
+     computeElements();
+     return scalar;
    }
    CATCH_DUMP_ATTR
@@ -518,4 +528,5 @@
     int idxDomain = 0, idxAxis=0 , idxScalar=0 ; 
  
+    elements_.clear() ;
     for(auto type : order_)
     {
@@ -572,4 +583,5 @@
     setAxisList();
     setScalarList();
+    computeElements() ;
    }
    CATCH_DUMP_ATTR
@@ -960,6 +972,4 @@
 
    
-//----------------------------------------------------------------
-
 
 
@@ -1871,9 +1881,4 @@
 
 
-
-
-
-
-
   bool CGrid::hasTransform()
   TRY
@@ -1892,4 +1897,262 @@
   }
   CATCH_DUMP_ATTR
+
+
+
+//**********************************************************
+//**************   New transformation method  **************
+//**********************************************************
+
+  std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > 
+  CGrid::buildTransformationGraph(CGarbageCollector& gc, CGrid* gridSrc, double detectMissingValues, double defaultValue, CGrid*& newGrid)
+  TRY
+  {
+    std::shared_ptr<CFilter> inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc));
+    std::shared_ptr<CFilter> outputFilter = inputFilter ;
+    
+    newGrid = CGrid::create() ; // give it an id later ??
+    bool hadTransform=false ;
+    bool hasTransform=false ;
+    CGenericAlgorithmTransformation* algo ;
+    int dimBefore=1 ;
+    int dimAfter=1 ;
+
+    for(int i=0 ; i<elements_.size(); i++)
+    {
+      CTransformationPaths transformationPath ;
+      auto dstElement = elements_[i] ;
+
+      if (dstElement.type==TYPE_DOMAIN)      transformationPath = dstElement.domain->getTransformationPaths() ;
+      else if (dstElement.type==TYPE_AXIS)   transformationPath = dstElement.axis->getTransformationPaths() ;
+      else if (dstElement.type==TYPE_SCALAR) transformationPath = dstElement.scalar->getTransformationPaths() ;
+
+      SElement srcElement  ;
+      if (gridSrc==nullptr) srcElement = this->elements_[i] ;
+      else srcElement = gridSrc->elements_[i] ;
+
+      if (gridSrc==nullptr) transformationPath.mergePaths() ;
+      else
+      {  
+        if (srcElement.type==TYPE_DOMAIN)      transformationPath.mergePaths(srcElement.domain->getTransformationPaths()) ;
+        else if (srcElement.type==TYPE_AXIS)   transformationPath.mergePaths(srcElement.axis->getTransformationPaths()) ;
+        else if (srcElement.type==TYPE_SCALAR) transformationPath.mergePaths(srcElement.scalar->getTransformationPaths()) ;
+      }
+
+      hasTransform=transformationPath.hasTransform()  ;
+      
+
+      if (hasTransform && !hadTransform)
+      {
+        EElement dstElementType=transformationPath.getNextElementType() ;
+        string dstElementId=transformationPath.getNextElementId() ;
+        string srcElementId=transformationPath.getNextElementSrcId() ;
+        auto transType = transformationPath.getNextTransformationType() ;
+        auto transId = transformationPath.getNextTransformationId() ;
+
+        CGrid* tmpGridSrc=CGrid::create(); // source grid 
+        if (srcElement.type==TYPE_DOMAIN)      tmpGridSrc->addDomain(srcElement.domain->getId()) ;
+        else if (srcElement.type==TYPE_AXIS)   tmpGridSrc->addAxis(srcElement.axis->getId()) ;
+        else if (srcElement.type==TYPE_SCALAR) tmpGridSrc->addScalar(srcElement.scalar->getId()) ;
+        tmpGridSrc->checkElementsAttributes() ;
+        CGrid* tmpGridDst=CGrid::create(); // destination Grid
+        map<int,int> posInGrid={{0,0}} ;
+               
+        cout<<"--> New transform from "<<srcElementId<<" to "<<dstElementId<<endl ;
+        if (dstElementType==EElement::DOMAIN)
+        {
+          CDomain* dstDomain ;
+          if (CDomain::has(dstElementId)) dstDomain = CDomain::get(dstElementId) ;
+          else
+          {
+            dstDomain = CDomain::create() ;
+            dstDomain->createAlias(dstElementId) ;
+            if (srcElementId=="" && srcElement.type==TYPE_DOMAIN)  dstDomain->duplicateAttributes(srcElement.domain) ; // make a copy
+            else dstDomain->duplicateAttributes(CDomain::get(srcElementId)) ; // make a copy
+            CTransformation<CDomain>* transformation = CTransformation<CDomain>::createTransformation(transType,"") ;
+            auto srcTransform = CTransformation<CDomain>::getTransformation(transType, transId) ;
+            transformation->inheritFrom(srcTransform) ;
+            tmpGridDst->addDomain(dstDomain->getId()) ;
+
+            //reuse existing algorithm interface for, now
+            algo = CGridTransformationFactory<CDomain>::createTransformation(transType, tmpGridDst, tmpGridSrc,
+                                                                             transformation, 0, 
+                                                                             posInGrid,posInGrid,posInGrid,
+                                                                             posInGrid,posInGrid,posInGrid );
+            dstDomain->setTransformationAlgorithm(algo) ;
+            transformationPath.removeNextTransform() ;
+            dstDomain->setTransformationPaths(transformationPath) ;
+            newGrid->addDomain(dstDomain->getId()) ;
+          }
+          algo = dstDomain->getTransformationAlgorithm() ;
+        }
+        else if (dstElementType==EElement::AXIS)
+        {
+          CAxis* dstAxis ;
+          if (CAxis::has(dstElementId)) dstAxis = CAxis::get(dstElementId) ;
+          else
+          {
+            dstAxis = CAxis::create() ;
+            dstAxis->createAlias(dstElementId) ;
+            if (srcElementId=="" && srcElement.type==TYPE_AXIS)  dstAxis->duplicateAttributes(srcElement.axis) ; // make a copy
+            else dstAxis->duplicateAttributes(CAxis::get(srcElementId)) ; // make a copy
+            CTransformation<CAxis>* transformation = CTransformation<CAxis>::createTransformation(transType,"") ;
+            auto srcTransform = CTransformation<CAxis>::getTransformation(transType, transId) ;
+            transformation->inheritFrom(srcTransform) ;
+            tmpGridDst->addAxis(dstAxis->getId()) ;
+
+            //reuse existing algorithm interface for, now
+            algo = CGridTransformationFactory<CAxis>::createTransformation(transType, tmpGridDst, tmpGridSrc,
+                                                                           transformation, 0, 
+                                                                           posInGrid,posInGrid,posInGrid,
+                                                                           posInGrid,posInGrid,posInGrid );
+            dstAxis->setTransformationAlgorithm(algo) ;
+            transformationPath.removeNextTransform() ;
+            dstAxis->setTransformationPaths(transformationPath) ;
+            newGrid->addAxis(dstAxis->getId()) ;
+          }
+          algo = dstAxis->getTransformationAlgorithm() ;
+        }
+        else if (dstElementType==EElement::SCALAR)
+        {
+          CScalar* dstScalar ;
+          if (CScalar::has(dstElementId)) dstScalar = CScalar::get(dstElementId) ;
+          else
+          {
+            dstScalar = CScalar::create() ;
+            dstScalar->createAlias(dstElementId) ;
+            if (srcElementId=="" && srcElement.type==TYPE_SCALAR)  dstScalar->duplicateAttributes(srcElement.scalar) ; // make a copy
+            else dstScalar->duplicateAttributes(CScalar::get(srcElementId)) ; // make a copy
+            CTransformation<CScalar>* transformation = CTransformation<CScalar>::createTransformation(transType,"") ;
+            auto srcTransform = CTransformation<CScalar>::getTransformation(transType, transId) ;
+            transformation->inheritFrom(srcTransform) ;
+            tmpGridDst->addScalar(dstScalar->getId()) ;
+
+            //reuse existing algorithm interface for, now
+            algo = CGridTransformationFactory<CScalar>::createTransformation(transType, tmpGridDst, tmpGridSrc,
+                                                                             transformation, 0, 
+                                                                             posInGrid,posInGrid,posInGrid,
+                                                                             posInGrid,posInGrid,posInGrid );
+            dstScalar->setTransformationAlgorithm(algo) ;
+            transformationPath.removeNextTransform() ;
+            dstScalar->setTransformationPaths(transformationPath) ;
+            newGrid->addScalar(dstScalar->getId()) ;
+          }
+          algo = dstScalar->getTransformationAlgorithm() ;          
+        }
+        // here create a new spatial filter with algo
+        
+        hadTransform=true ;
+        hasTransform=false ; 
+      }
+      else
+      {
+        string srcElementId=transformationPath.getNextElementSrcId() ;
+        if (srcElement.type==TYPE_DOMAIN)      
+        {
+          CDomain* domain ;
+          if (!CDomain::has(srcElementId)) 
+          {
+            domain=srcElement.domain ;
+            domain->createAlias(srcElementId) ;
+          }
+          else domain = CDomain::get(srcElementId) ;
+          domain->checkAttributes() ;
+         
+          if (hadTransform) dimBefore*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ;
+          else dimAfter*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ;
+          newGrid->addDomain(srcElementId) ;
+        }
+        else if (srcElement.type==TYPE_AXIS)
+        {   
+          CAxis* axis ;
+          if (!CAxis::has(srcElementId)) 
+          {
+            axis=srcElement.axis ;
+            axis->createAlias(srcElementId) ;
+          }
+          else axis = CAxis::get(srcElementId) ;
+          axis->checkAttributes() ;
+         
+          if (hadTransform) dimBefore*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ;
+          else dimAfter*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ;
+          newGrid->addAxis(srcElementId) ;
+        }
+        else if (srcElement.type==TYPE_SCALAR)
+        {
+          CScalar* scalar ;
+          if (!CScalar::has(srcElementId)) 
+          {
+            scalar=srcElement.scalar ;
+            scalar->createAlias(srcElementId) ;
+          }
+          else scalar = CScalar::get(srcElementId) ;
+          scalar->checkAttributes() ;
+         
+          if (hadTransform) dimBefore*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ;
+          else dimAfter*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ;
+          newGrid->addScalar(srcElementId) ;
+        }
+      }
+    }  
+    
+    if (hadTransform)
+    {
+      shared_ptr<CTransformFilter> transformFilter = shared_ptr<CTransformFilter>(new CTransformFilter(gc, algo, dimBefore, dimAfter, detectMissingValues, defaultValue)) ;
+      outputFilter->connectOutput(transformFilter,0) ;
+      outputFilter = transformFilter ;
+
+      gridSrc=newGrid ;
+      pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = gridSrc->buildTransformationGraph(gc, gridSrc, detectMissingValues, defaultValue, newGrid) ;
+      outputFilter->connectOutput(filters.first,0) ;
+      outputFilter=filters.second ;
+    }
+     
+    return {inputFilter,outputFilter} ;
+  }
+  CATCH_DUMP_ATTR
+
+
+//****************************************************************
+//****************************************************************
+
+//----------------------------------------------------------------
+
+  CGrid* CGrid::duplicateSentGrid(void)
+  {
+    CGrid* newGrid ;
+    string sentGridId="sent__"+getId() ;
+    if (has(sentGridId)) newGrid = get(sentGridId) ;
+    else
+    {
+      newGrid = CGrid::create(sentGridId) ;
+      for(auto element : elements_)
+      {
+        if (element.type==TYPE_DOMAIN)      
+        {
+          CDomain* domain = CDomain::create();
+          domain->duplicateAttributes(element.domain) ;
+          domain->name = element.domain->getId() ;
+          newGrid->addDomain(domain->getId()) ;
+        }
+        else if (element.type==TYPE_AXIS)      
+        {
+          CAxis* axis = CAxis::create();
+          axis->duplicateAttributes(element.axis) ;
+          axis->name = element.axis->getId() ;
+          newGrid->addAxis(axis->getId()) ;
+        }
+        else if (element.type==TYPE_SCALAR)      
+        {
+          CScalar* scalar = CScalar::create();
+          scalar->duplicateAttributes(element.scalar) ;
+          scalar->name = element.scalar->getId() ;
+          newGrid->addScalar(scalar->getId()) ;
+        }
+      }
+      newGrid->checkElementsAttributes() ;
+    }
+    return newGrid ;
+  }
+
 
   void CGrid::setContextClient(CContextClient* contextClient)
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp	(revision 1984)
@@ -20,4 +20,6 @@
 #include "grid_scatterer_connector.hpp"
 #include "grid_gatherer_connector.hpp"
+#include "transformation_path.hpp"
+#include "filter.hpp"
 
 
@@ -210,4 +212,8 @@
          bool doGridHaveDataDistributed(CContextClient* client = 0);
 
+         ///////////////////////////////////////////
+         ////////    TRANSFORMATIONS           /////
+         ///////////////////////////////////////////
+      public:
          CGridTransformation* getTransformations();
 
@@ -221,5 +227,7 @@
          
          std::vector<std::string> getAuxInputTransformGrid(void) ; 
-
+         std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource();
+         bool hasTransform();
+         void addTransGridSource(CGrid* gridSrc);
          void completeGrid(CGrid* transformGridSrc = 0);
          bool isTransformed();
@@ -227,8 +235,16 @@
          bool isGenerated();
          void setGenerated();
-         void addTransGridSource(CGrid* gridSrc);
-         std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource();
-         bool hasTransform();
-         size_t getGlobalWrittenSize(void) ;
+         void setTransformationAlgorithms();
+         pair<shared_ptr<CFilter>, shared_ptr<CFilter> > buildTransformationGraph(CGarbageCollector& gc, CGrid* gridSrc, double detectMissingValues,
+                                                                                  double defaultValue, CGrid*& newGrid) ;
+      private:
+         bool isTransformed_, isGenerated_;
+         CGridTransformation* transformations_;
+         bool hasTransform_;
+       
+        ///////////////////////////////////////////
+      public:
+
+        size_t getGlobalWrittenSize(void) ;
          
          bool isCompleted(void) ;
@@ -265,5 +281,4 @@
         CScalarGroup* getVirtualScalarGroup() const;
 
-        void setTransformationAlgorithms();
         int computeGridGlobalDimension(std::vector<int>& globalDim,
                                        const std::vector<CDomain*> domains,
@@ -310,5 +325,4 @@
         std::set<std::string> relFilesCompressed;
 
-        bool isTransformed_, isGenerated_;
         
         std::vector<int> axisPositionInGrid_;
@@ -317,12 +331,12 @@
         std::vector<int>& getAxisPositionInGrid(void) { if (!computeAxisPositionInGrid_done_) computeAxisPositionInGrid() ; return axisPositionInGrid_ ;}
 
-        CGridTransformation* transformations_;
         bool hasDomainAxisBaseRef_;        
         std::map<CGrid*, std::pair<bool,StdString> > gridSrc_;
-        bool hasTransform_;
 
      //////////////////////////////////////////////////////////////////////////////////////
      //  this part is related to distribution, element definition, views and connectors  //
      //////////////////////////////////////////////////////////////////////////////////////
+      public:
+       CGrid* duplicateSentGrid(void) ;
       private:
        static void recvMask(CEventServer& event) ;
@@ -336,5 +350,5 @@
 
       private:
-        CGridLocalConnector* modelToWorkflowConnector_ ;
+        CGridLocalConnector* modelToWorkflowConnector_ = nullptr ;
       public:
         void computeModelToWorkflowConnector(void) ;
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CInterpolateAxis::registerTrans()
   {
-    return registerTransformation(TRANS_INTERPOLATE_AXIS, CInterpolateAxis::create);
+    return registerTransformation(TRANS_INTERPOLATE_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CInterpolateAxis> SuperClass;
       typedef CInterpolateAxisAttributes SuperClassAttribute;
+      typedef CInterpolateAxis MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -58,4 +60,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_INTERPOLATE_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CInterpolateDomain::registerTrans()
   {
-    registerTransformation(TRANS_INTERPOLATE_DOMAIN, create);
+    registerTransformation(TRANS_INTERPOLATE_DOMAIN, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CInterpolateDomain> SuperClass;
       typedef CInterpolateDomainAttributes SuperClassAttribute;
+      typedef CInterpolateDomain MyClass ;
+      typedef CTransformation<CDomain> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_INTERPOLATE_DOMAIN ;}
+      static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.cpp	(revision 1984)
@@ -26,5 +26,5 @@
   bool CInverseAxis::registerTrans()
   {
-    return registerTransformation(TRANS_INVERSE_AXIS, CInverseAxis::create);
+    return registerTransformation(TRANS_INVERSE_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.hpp	(revision 1984)
@@ -39,4 +39,6 @@
       typedef CObjectTemplate<CInverseAxis> SuperClass;
       typedef CInverseAxisAttributes SuperClassAttribute;
+      typedef CInverseAxis MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -54,5 +56,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
-
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_INVERSE_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CReduceAxisToAxis::registerTrans()
   {
-    return registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, CReduceAxisToAxis::create);
+    return registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.hpp	(revision 1984)
@@ -40,4 +40,6 @@
       typedef CObjectTemplate<CReduceAxisToAxis> SuperClass;
       typedef CReduceAxisToAxisAttributes SuperClassAttribute;
+      typedef CReduceAxisToAxis MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -55,4 +57,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_REDUCE_AXIS_TO_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.cpp	(revision 1984)
@@ -26,5 +26,5 @@
   bool CReduceAxisToScalar::registerTrans()
   {
-    return registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, CReduceAxisToScalar::create);
+    return registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.hpp	(revision 1984)
@@ -40,4 +40,6 @@
       typedef CObjectTemplate<CReduceAxisToScalar> SuperClass;
       typedef CReduceAxisToScalarAttributes SuperClassAttribute;
+      typedef CReduceAxisToScalar MyClass ;
+      typedef CTransformation<CScalar> SuperTransform ;
 
     public :
@@ -55,4 +57,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_REDUCE_AXIS_TO_SCALAR ;}
+      static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.cpp	(revision 1984)
@@ -28,5 +28,5 @@
   bool CReduceDomainToAxis::registerTrans()
   {
-    return registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, CReduceDomainToAxis::create);
+    return registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CReduceDomainToAxis> SuperClass;
       typedef CReduceDomainToAxisAttributes SuperClassAttribute;
+      typedef CReduceDomainToAxis MyClass ;
+     typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -56,5 +58,9 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
-    private:
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_REDUCE_DOMAIN_TO_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
+     private:
       static bool registerTrans();
       static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node);
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.cpp	(revision 1984)
@@ -26,5 +26,5 @@
   bool CReduceDomainToScalar::registerTrans()
   {
-    return registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, CReduceDomainToScalar::create);
+    return registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CReduceDomainToScalar> SuperClass;
       typedef CReduceDomainToScalarAttributes SuperClassAttribute;
+      typedef CReduceDomainToScalar MyClass ;
+      typedef CTransformation<CScalar> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_REDUCE_DOMAIN_TO_SCALAR ;}
+      static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.cpp	(revision 1984)
@@ -26,5 +26,5 @@
   bool CReduceScalarToScalar::registerTrans()
   {
-    return registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, CReduceScalarToScalar::create);
+    return registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.hpp	(revision 1984)
@@ -40,4 +40,6 @@
       typedef CObjectTemplate<CReduceScalarToScalar> SuperClass;
       typedef CReduceScalarToScalarAttributes SuperClassAttribute;
+      typedef CReduceScalarToScalar MyClass ;
+      typedef CTransformation<CScalar> SuperTransform ;
 
     public :
@@ -55,4 +57,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_REDUCE_SCALAR_TO_SCALAR ;}
+      static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CReorderDomain::registerTrans()
   {
-    registerTransformation(TRANS_REORDER_DOMAIN, CReorderDomain::create);
+    registerTransformation(TRANS_REORDER_DOMAIN, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CReorderDomain> SuperClass;
       typedef CReorderDomainAttributes SuperClassAttribute;
+      typedef CReorderDomain MyClass ;
+      typedef CTransformation<CDomain> SuperTransform ;
 
     public :
@@ -56,5 +58,9 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
-    private:
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_REORDER_DOMAIN ;}
+      static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
+     private:
       static bool registerTrans();
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp	(revision 1984)
@@ -135,5 +135,5 @@
    * Go through the hierarchy to find the scalar from which the transformations must be inherited
    */
-  void CScalar::solveInheritanceTransformation()
+  void CScalar::solveInheritanceTransformation_old()
   {
     if (hasTransformation() || !hasDirectScalarReference())
@@ -153,4 +153,42 @@
   }
  
+  void CScalar::solveInheritanceTransformation()
+  TRY
+  {
+    if (solveInheritanceTransformation_done_) return;
+    else solveInheritanceTransformation_done_=true ;
+
+    CScalar* scalar = this;
+    CScalar* Lastscalar ;
+    std::list<CScalar*> refScalars;
+    bool out=false ;
+    vector<StdString> excludedAttr;
+    excludedAttr.push_back("scalar_ref");
+    
+    refScalars.push_front(scalar) ;
+    while (scalar->hasDirectScalarReference() && !out)
+    {
+      CScalar* lastScalar=scalar ;
+      scalar = scalar->getDirectScalarReference();
+      scalar->solveRefInheritance() ;
+      if (!scalar->SuperClass::isEqual(lastScalar,excludedAttr)) out=true ;
+      refScalars.push_front(scalar) ;
+    }
+
+    CTransformationPaths::TPath path ;
+    auto& pathList = std::get<2>(path) ;
+    std::get<0>(path) = EElement::SCALAR ;
+    std::get<1>(path) = refScalars.front()->getId() ;
+    for (auto& scalar : refScalars)
+    {
+      CScalar::TransMapTypes transformations = scalar->getAllTransformations();
+      for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), 
+                                                                      transformation.second->getId()}) ;
+    }
+    transformationPaths_.addPath(path) ;
+
+  }
+  CATCH_DUMP_ATTR
+
   /* obsolete, to remove after reimplementing coupling */
   void CScalar::sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid)
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp	(revision 1984)
@@ -13,5 +13,5 @@
 #include "transformation.hpp"
 #include "transformation_enum.hpp"
-
+#include "transformation_path.hpp"
 #include "element.hpp"
 #include "local_connector.hpp"
@@ -19,201 +19,218 @@
 #include "gatherer_connector.hpp"
 #include "distribution_type.hpp"
+#include "generic_algorithm_transformation.hpp"
 
 
 namespace xios
 {
-      /// ////////////////////// DÃ©clarations ////////////////////// ///
-
-      class CScalarGroup;
-      class CScalarAttributes;
-      class CScalar;
-      ///--------------------------------------------------------------
-
-      // Declare/Define CVarAttribute
-      BEGIN_DECLARE_ATTRIBUTE_MAP(CScalar)
+  /// ////////////////////// DÃ©clarations ////////////////////// ///
+
+  class CScalarGroup;
+  class CScalarAttributes;
+  class CScalar;
+  ///--------------------------------------------------------------
+
+  // Declare/Define CVarAttribute
+  BEGIN_DECLARE_ATTRIBUTE_MAP(CScalar)
 #include "scalar_attribute.conf"
-      END_DECLARE_ATTRIBUTE_MAP(CScalar)
-
-      ///--------------------------------------------------------------
-
-      class CScalar
-         : public CObjectTemplate<CScalar>
-         , public CScalarAttributes
+  END_DECLARE_ATTRIBUTE_MAP(CScalar)
+
+  ///--------------------------------------------------------------
+
+  class CScalar: public CObjectTemplate<CScalar>
+               , public CScalarAttributes
+  {
+      friend class CScalarGroup;
+
+      /// typedef ///
+      typedef CObjectTemplate<CScalar>   SuperClass;
+      typedef CScalarAttributes SuperClassAttribute;
+
+    public:
+      enum EEventId
       {
-           friend class CScalarGroup;
-
-            /// typedef ///
-            typedef CObjectTemplate<CScalar>   SuperClass;
-            typedef CScalarAttributes SuperClassAttribute;
-
-         public:
-           enum EEventId
-           {
-             EVENT_ID_SCALAR_DISTRIBUTION,
-             EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE,
-           } ;
-           static bool dispatchEvent(CEventServer& event);      
+        EVENT_ID_SCALAR_DISTRIBUTION,
+        EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE,
+      } ;
+      static bool dispatchEvent(CEventServer& event);      
            
 
-         public :
-
-            typedef CScalarAttributes RelAttributes;
-            typedef CScalarGroup      RelGroup;
-            typedef CTransformation<CScalar>::TransformationMapTypes TransMapTypes;
-
-            /// Constructeurs ///
-            CScalar(void);
-            explicit CScalar(const StdString & id);
-            CScalar(const CScalar & var);       // Not implemented yet.
-            CScalar(const CScalar * const var); // Not implemented yet.
-
-            /// Destructeur ///
-            virtual ~CScalar(void);
-
-         public :
-            /// Accesseurs statiques ///
-            static StdString GetName(void);
-            static StdString GetDefName(void);
-            static ENodeType GetType(void);
-
-         public:
-            static CScalar* createScalar();
-
-         public:
-            void checkAttributes(void);
-            bool checkAttributes_done_ = false ;
+    public :
+
+      typedef CScalarAttributes RelAttributes;
+      typedef CScalarGroup      RelGroup;
+
+      /// Constructeurs ///
+      CScalar(void);
+      explicit CScalar(const StdString & id);
+      CScalar(const CScalar & var);       // Not implemented yet.
+      CScalar(const CScalar * const var); // Not implemented yet.
+
+      /// Destructeur ///
+      virtual ~CScalar(void);
+
+    public :
+      /// Accesseurs statiques ///
+      static StdString GetName(void);
+      static StdString GetDefName(void);
+      static ENodeType GetType(void);
+
+    public:
+      static CScalar* createScalar();
+
+    public:
+      void checkAttributes(void);
+      bool checkAttributes_done_ = false ;
             
-            void addRelFile(const StdString& filename);
-            bool IsWritten(const StdString& filename) const;
-             virtual void parse(xml::CXMLNode & node);
+      void addRelFile(const StdString& filename);
+      bool IsWritten(const StdString& filename) const;
+      virtual void parse(xml::CXMLNode & node);
         
-         public:
-            void sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) ;
-         private:
-            std::set<CContextClient*> sendScalarToCouplerOut_done_ ;
+    public:
+      void sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) ;
+    private:
+      std::set<CContextClient*> sendScalarToCouplerOut_done_ ;
          
-         public:
-            void makeAliasForCoupling(const string& fieldId, int posInGrid) ;
-
-         public:
-           bool hasTransformation();
-           void solveInheritanceTransformation();
-           TransMapTypes getAllTransformations();
-           void duplicateTransformation(CScalar*);
-           CTransformation<CScalar>* addTransformation(ETranformationType transType, const StdString& id="");
-           bool isEqual(CScalar* scalar);
-        private:  
+    public:
+      void makeAliasForCoupling(const string& fieldId, int posInGrid) ;
+
+      ////////////////////////////////
+      ////    TRANSFORMATIONS     ////
+      //////////////////////////////// 
+    public:
+      typedef CTransformation<CScalar>::TransformationMapTypes TransMapTypes;
+    private:
+      static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
+      static std::map<StdString, ETranformationType> transformationMapList_;
+      static bool dummyTransformationMapList_;      TransMapTypes transformationMap_;
+      void setTransformations(const TransMapTypes&);
+
+    public:
+      bool hasTransformation();
+      TransMapTypes getAllTransformations();
+      void duplicateTransformation(CScalar*);
+      CTransformation<CScalar>* addTransformation(ETranformationType transType, const StdString& id="");
+    
+       void solveInheritanceTransformation_old();
+       void solveInheritanceTransformation();
+      private:
+        bool solveInheritanceTransformation_done_= false ;
+      private:
+        CGenericAlgorithmTransformation* transformationAlgorithm_ = nullptr ;
+      public:
+        void setTransformationAlgorithm(CGenericAlgorithmTransformation* transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;}
+        CGenericAlgorithmTransformation* getTransformationAlgorithm(void) { return transformationAlgorithm_ ;}   
+      private:
+        CTransformationPaths transformationPaths_ ;
+      public:
+        CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} 
+        void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;}
+      ////////////////////////////////
+      ////////////////////////////////
+
+      bool isEqual(CScalar* scalar);
+    private:  
           /** Clients that have to send a scalar. There can be multiple clients in case of secondary server, otherwise only one client. */
-         std::list<CContextClient*> clients;
-         std::set<CContextClient*> clientsSet;
-        public:
-          void setContextClient(CContextClient* contextClient) ;
+      std::list<CContextClient*> clients;
+      std::set<CContextClient*> clientsSet;
+    public:
+      void setContextClient(CContextClient* contextClient) ;
         
-         private:
-           std::set<StdString> relFiles;
-           TransMapTypes transformationMap_;
-
-            void setTransformations(const TransMapTypes&);
-
-       private:
-           static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
-           static std::map<StdString, ETranformationType> transformationMapList_;
-           static bool dummyTransformationMapList_;
-
-           /** define if the scalar is completed or not ie all attributes have been received before in case 
-               of grid reading from file or coupling */ 
-      private:
-         /** define if the scalar is completed or not ie all attributes have been received before in case 
-             of grid reading from file or coupling */ 
-         bool isCompleted_=true ;  
-      public:     
-         /*!
-           \brief Check if a scalar is completed
-           Before make any scalar processing, we must be sure that all scalar informations have
-           been sent, for exemple when reading a grid in a file or when grid elements are sent by an
-           other context (coupling). So all direct reference of the scalar (scalar_ref) must be also completed
-           \return true if scalar and scalar reference are completed
-          */
-         bool isCompleted(void)
-         {
-           if (hasDirectScalarReference()) if (!getDirectScalarReference()->isCompleted()) return false;
-           else return isCompleted_ ;
-         }
-         void setCompleted(void) { isCompleted_=true ; }
-         void unsetCompleted(void) { isCompleted_=false ; }
-
-
-
-       //////////////////////////////////////////////////////////////////////////////////////
-       //  this part is related to distribution, element definition, views and connectors  //
-       //////////////////////////////////////////////////////////////////////////////////////
-       private:
-         CLocalElement* localElement_ = nullptr ;
-         void initializeLocalElement(void) ;
+    private:
+      std::set<StdString> relFiles;
+
+    private:
+      /** define if the scalar is completed or not ie all attributes have been received before in case 
+           of grid reading from file or coupling */ 
+      bool isCompleted_=true ;  
+    public:     
+      /*!
+        \brief Check if a scalar is completed
+        Before make any scalar processing, we must be sure that all scalar informations have
+        been sent, for exemple when reading a grid in a file or when grid elements are sent by an
+        other context (coupling). So all direct reference of the scalar (scalar_ref) must be also completed
+        \return true if scalar and scalar reference are completed
+      */
+      bool isCompleted(void)
+      {
+        if (hasDirectScalarReference()) if (!getDirectScalarReference()->isCompleted()) return false;
+        else return isCompleted_ ;
+      }
+      void setCompleted(void) { isCompleted_=true ; }
+      void unsetCompleted(void) { isCompleted_=false ; }
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////
+    //  this part is related to distribution, element definition, views and connectors  //
+    //////////////////////////////////////////////////////////////////////////////////////
+    private:
+      CLocalElement* localElement_ = nullptr ;
+      void initializeLocalElement(void) ;
        
-       public:  
-         CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; }
-         CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;}
+    public:  
+      CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; }
+      CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;}
        
-       private:  
-         void addFullView(void) ;
-         void addWorkflowView(void) ;
-         void addModelView(void) ;
+    private:  
+      void addFullView(void) ;
+      void addWorkflowView(void) ;
+      void addModelView(void) ;
         
-       private:
-         CLocalConnector* modelToWorkflowConnector_ ;
-         void computeModelToWorkflowConnector(void)  ;
-       public:
-         CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;}
-
-       public:
-         void computeRemoteElement(CContextClient* client, EDistributionType) ;
-         void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector,
+    private:
+      CLocalConnector* modelToWorkflowConnector_ ;
+      void computeModelToWorkflowConnector(void)  ;
+    public:
+      CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;}
+
+    public:
+      void computeRemoteElement(CContextClient* client, EDistributionType) ;
+      void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector,
                                  const string& scalarId="") ;
 
-         static void recvScalarDistribution(CEventServer& event) ;
-         void receivedScalarDistribution(CEventServer& event, int phasis) ;
-         void setServerMask(CArray<bool,1>& serverMask, CContextClient* client) ;
-         void sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& scalarId) ;
-         static void recvDistributedAttributes(CEventServer& event) ;
-         void recvDistributedAttributes(CEventServer& event, const string& type) ;
-
-       private:
-         map<CContextClient*, CDistributedElement*> remoteElement_ ;
-       public: 
-         CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;}
-       private:
-         map<CContextClient*, CScattererConnector*> clientToServerConnector_ ;
-       public: 
-         CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;}
-
-       private:
-         CGathererConnector*  gathererConnector_ ;
-       public:
-         CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;}
-       private:
-         CGathererConnector* serverFromClientConnector_ ;
-         CDistributedElement* elementFrom_ ;
-       public:
-        CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;}
-
-       private:
-         CScattererConnector*  serverToClientConnector_ = nullptr ;
-       public: 
-         CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;} 
-
-       private:
-          map<CContextClient*,CGathererConnector*>  clientFromServerConnector_  ;
-       public: 
-         CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} 
-
-      private:
-            DECLARE_REF_FUNC(Scalar,scalar)
-
-      }; // class CVar
-      ///--------------------------------------------------------------
-
-      // Declare/Define CScalarGroup and CScalarDefinition
-      DECLARE_GROUP(CScalar);
+      static void recvScalarDistribution(CEventServer& event) ;
+      void receivedScalarDistribution(CEventServer& event, int phasis) ;
+      void setServerMask(CArray<bool,1>& serverMask, CContextClient* client) ;
+      void sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& scalarId) ;
+      static void recvDistributedAttributes(CEventServer& event) ;
+      void recvDistributedAttributes(CEventServer& event, const string& type) ;
+
+    private:
+      map<CContextClient*, CDistributedElement*> remoteElement_ ;
+    public: 
+      CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;}
+    private:
+      map<CContextClient*, CScattererConnector*> clientToServerConnector_ ;
+    public: 
+      CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;}
+
+    private:
+      CGathererConnector*  gathererConnector_ ;
+    public:
+      CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;}
+    private:
+      CGathererConnector* serverFromClientConnector_ ;
+      CDistributedElement* elementFrom_ ;
+    public:
+      CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;}
+
+    private:
+      CScattererConnector*  serverToClientConnector_ = nullptr ;
+    public: 
+      CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;} 
+
+    private:
+      map<CContextClient*,CGathererConnector*>  clientFromServerConnector_  ;
+    public: 
+      CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} 
+
+    private:
+      DECLARE_REF_FUNC(Scalar,scalar)
+
+  }; // class CVar
+  ///--------------------------------------------------------------
+
+  // Declare/Define CScalarGroup and CScalarDefinition
+  DECLARE_GROUP(CScalar);
 } // namespace xios
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.cpp	(revision 1984)
@@ -29,5 +29,5 @@
   bool CTemporalSplitting::registerTrans()
   {
-    return registerTransformation(TRANS_TEMPORAL_SPLITTING, CTemporalSplitting::create);
+    return registerTransformation(TRANS_TEMPORAL_SPLITTING, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.hpp	(revision 1984)
@@ -40,4 +40,6 @@
       typedef CObjectTemplate<CTemporalSplitting> SuperClass;
       typedef CTemporalSplittingAttributes SuperClassAttribute;
+      typedef CTemporalSplitting MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -55,4 +57,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_TEMPORAL_SPLITTING ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/transformation.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/transformation.hpp	(revision 1975)
+++ 	(revision )
@@ -1,80 +1,0 @@
-#ifndef __XIOS_CTransformation__
-#define __XIOS_CTransformation__
-
-#include "xios_spl.hpp"
-#include "xml_node.hpp"
-#include "transformation_enum.hpp"
-
-namespace xios {
-
-  ///--------------------------------------------------------------
-  /*!
-    \class CTransformation
-    This class describes inverse_axis in xml file.
-  */
-  template<typename T>
-  class CTransformation
-  {
-  public:
-    typedef typename std::list<std::pair<ETranformationType, CTransformation<T>* > > TransformationMapTypes;
-    typedef TransformationMapTypes TransMapTypes;
-
-    public :
-      /// Constructeurs ///
-      CTransformation(void) {}
-      virtual void checkValid(T* dest) {}
-
-      std::vector<StdString> checkAuxInputs() { return checkAuxInputs_(); }
-      static CTransformation<T>* createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node=0);
-
-      /// Destructeur ///
-      virtual ~CTransformation(void) {}
-
-    protected:
-      typedef CTransformation<T>* (*CreateTransformationCallBack)(const StdString&, xml::CXMLNode*);
-      typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap;
-      static CallBackMap* transformationCreationCallBacks_;
-
-      static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn);
-      static bool unregisterTransformation(ETranformationType transType);
-
-    protected:
-      virtual std::vector<StdString> checkAuxInputs_() { return std::vector<StdString>(); }
-  }; // class CTransformation
-
-  template<typename T>
-  typename CTransformation<T>::CallBackMap* CTransformation<T>::transformationCreationCallBacks_ = 0; //CTransformation<T>::CallBackMap();
-
-  template<typename T>
-  CTransformation<T>* CTransformation<T>::createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node)
-  {
-    int transTypeInt = transType;
-    typename CallBackMap::const_iterator it = (*transformationCreationCallBacks_).find(transType);
-    if ((*transformationCreationCallBacks_).end() == it)
-    {
-       ERROR("CTransformation<T>::createTransformation(ETranformationType transType)",
-             << "Transformation type " << transType
-             << "doesn't exist. Please define.");
-    }
-    return (it->second)(id,node);
-  }
-
-  template<typename T>
-  bool CTransformation<T>::registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn)
-  {
-    if (0 == transformationCreationCallBacks_)
-      transformationCreationCallBacks_ = new CallBackMap();
-
-    return (*transformationCreationCallBacks_).insert(make_pair(transType, createFn)).second;
-  }
-
-  template<typename T>
-  bool CTransformation<T>::unregisterTransformation(ETranformationType transType)
-  {
-    int transTypeInt = transType;
-    return (1 == (*transformationCreationCallBacks_).erase(transType));
-  }
-
-} // namespace xios
-
-#endif // __XIOS_CTransformation__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/transformation_enum.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/transformation_enum.hpp	(revision 1975)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#ifndef __XIOS_TRANSFORMATION_ENUM__
-#define __XIOS_TRANSFORMATION_ENUM__
-
-namespace xios
-{
-      /// ////////////////////// DÃ©finitions ////////////////////// ///
-      typedef enum transformation_type
-      {
-        TRANS_ZOOM_AXIS = 0,
-        TRANS_INVERSE_AXIS = 1,
-        TRANS_INTERPOLATE_AXIS = 2,
-        TRANS_ZOOM_DOMAIN = 3,
-        TRANS_INTERPOLATE_DOMAIN = 4,
-        TRANS_GENERATE_RECTILINEAR_DOMAIN = 5,
-        TRANS_REDUCE_AXIS_TO_SCALAR = 6,
-        TRANS_REDUCE_DOMAIN_TO_AXIS = 7,
-        TRANS_EXTRACT_DOMAIN_TO_AXIS = 8,
-        TRANS_COMPUTE_CONNECTIVITY_DOMAIN = 9,
-        TRANS_EXPAND_DOMAIN = 10,
-        TRANS_EXTRACT_AXIS_TO_SCALAR = 11,
-        TRANS_REDUCE_DOMAIN_TO_SCALAR = 12,
-        TRANS_TEMPORAL_SPLITTING = 13,
-        TRANS_REDUCE_AXIS_TO_AXIS = 14,
-        TRANS_DUPLICATE_SCALAR_TO_AXIS = 15,
-        TRANS_REDUCE_SCALAR_TO_SCALAR = 16,
-        TRANS_REORDER_DOMAIN = 17,
-        TRANS_EXTRACT_DOMAIN = 18,
-        TRANS_EXTRACT_AXIS = 19
-      } ETranformationType;
-
-} // namespace xios
-
-#endif // __XIOS_TRANSFORMATION_ENUM__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.cpp	(revision 1984)
@@ -26,5 +26,5 @@
   bool CZoomAxis::registerTrans()
   {
-    return registerTransformation(TRANS_ZOOM_AXIS, CZoomAxis::create);
+    return registerTransformation(TRANS_ZOOM_AXIS, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CZoomAxis> SuperClass;
       typedef CZoomAxisAttributes SuperClassAttribute;
+      typedef CZoomAxis MyClass ;
+      typedef CTransformation<CAxis> SuperTransform ;
 
     public :
@@ -56,4 +58,8 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_ZOOM_AXIS ;}
+      static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
     private:
       static bool registerTrans();
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.cpp	(revision 1984)
@@ -27,5 +27,5 @@
   bool CZoomDomain::registerTrans()
   {
-    registerTransformation(TRANS_ZOOM_DOMAIN, CZoomDomain::create);
+    registerTransformation(TRANS_ZOOM_DOMAIN, {create, getTransformation});
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.hpp	(revision 1984)
@@ -41,4 +41,6 @@
       typedef CObjectTemplate<CZoomDomain> SuperClass;
       typedef CZoomDomainAttributes SuperClassAttribute;
+      typedef CZoomDomain MyClass ;
+      typedef CTransformation<CDomain> SuperTransform ;
 
     public :
@@ -56,7 +58,12 @@
       static StdString GetDefName(void);
       static ENodeType GetType(void);
+      const string& getId(void) { return this->SuperClass::getId();}
+      ETranformationType getTransformationType(void) { return TRANS_ZOOM_DOMAIN ;}
+      virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;}
+      static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);}
     private:
       static bool registerTrans();
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
+     
       static bool _dummyRegistered;
   }; // class CZoomDomain
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp	(revision 1984)
@@ -52,5 +52,5 @@
          /// Traitements ///
          virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
-
+ 
          /// Traitement statique ///
          static void ClearAllAttributes(void);
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_duplicate_scalar.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_duplicate_scalar.cpp	(revision 1975)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*!
-   \file axis_algorithm_duplicate_scalar.cpp
-
-   \brief Algorithm to duplicate scalar into  axis 
- */
-#include "axis_algorithm_duplicate_scalar.hpp"
-#include "duplicate_scalar_to_axis.hpp"
-#include "axis.hpp"
-#include "scalar.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmDuplicateScalar::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CAxis>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CScalar*> scalarListSrcP = gridSrc->getScalars();
-
-  CDuplicateScalarToAxis* duplicateScalar = dynamic_cast<CDuplicateScalarToAxis*> (transformation);
-  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int scalarSrcIndex = elementPositionInGridSrc2ScalarPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmDuplicateScalar(axisListDestP[axisDstIndex], scalarListSrcP[scalarSrcIndex], duplicateScalar));
-}
-CATCH
-
-bool CAxisAlgorithmDuplicateScalar::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, create);
-}
-CATCH
-
-
-CAxisAlgorithmDuplicateScalar::CAxisAlgorithmDuplicateScalar(CAxis* axisDestination, CScalar* scalarSource, CDuplicateScalarToAxis* algo)
- : CAxisAlgorithmTransformation(axisDestination, scalarSource)
-{
-
-}
-
-
-CAxisAlgorithmDuplicateScalar::~CAxisAlgorithmDuplicateScalar()
-{
-}
-
-void CAxisAlgorithmDuplicateScalar::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  CArray<int,1>& axisDstIndex = axisDest_->index;
-
-  int nbAxisIdx = axisDstIndex.numElements();
-  for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis)
-  {
-    int globalAxisIdx = axisDstIndex(idxAxis);
-    transMap[globalAxisIdx].resize(1);
-    transWeight[globalAxisIdx].resize(1);
-    transMap[globalAxisIdx][0] = 0 ;
-    transWeight[globalAxisIdx][0] = 1.0 ;
-  }
-}
-CATCH
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_duplicate_scalar.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_duplicate_scalar.hpp	(revision 1975)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_domain.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce an axis to a axis
- */
-#ifndef __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__
-#define __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CAxis;
-class CScalar;
-class CDuplicateScalarToAxis;
-
-
-/*!
-  \class CAxisAlgorithmDuplicateScalar
-  Duplicate scalar into axis destination
-*/
-class CAxisAlgorithmDuplicateScalar : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmDuplicateScalar(CAxis* axisDestination, CScalar* scalarSource, CDuplicateScalarToAxis* algo);
-
-  virtual ~CAxisAlgorithmDuplicateScalar();
-
-  static bool registerTrans();
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract.cpp	(revision 1975)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*!
-   \file axis_algorithm_extract.cpp
-   \brief Algorithm for extracting an axis.
- */
-#include "axis_algorithm_extract.hpp"
-#include "axis.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "extract_axis.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmExtract::create(CGrid* gridDst, CGrid* gridSrc,
-                                                           CTransformation<CAxis>* transformation,
-                                                           int elementPositionInGrid,
-                                                           std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                           std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                           std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                           std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                           std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                           std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
-
-  CExtractAxis* extractAxis = dynamic_cast<CExtractAxis*> (transformation);
-  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmExtract(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], extractAxis));
-}
-CATCH
-
-bool CAxisAlgorithmExtract::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_EXTRACT_AXIS, create);
-}
-CATCH
-
-CAxisAlgorithmExtract::CAxisAlgorithmExtract(CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis)
-: CAxisAlgorithmTransformation(axisDestination, axisSource)
-TRY
-{
-  extractAxis->checkValid(axisSource);
-  extractBegin_ = extractAxis->begin.getValue();
-  extractN_  = extractAxis->n.getValue();
-  extractEnd_   = extractBegin_ + extractN_ - 1;
-
-  if (extractN_ > axisSource->n_glo.getValue())
-  {
-    ERROR("CAxisAlgorithmExtract::CAxisAlgorithmExtract(CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis)",
-           << "Extract size is greater than global size of source axis"
-           << "Global size of source axis " <<axisSource->getId() << " is " << axisSource->n_glo.getValue()  << std::endl
-           << "Extract size is " << extractN_ );
-  }
-
-  int idxSrc, nDest = 0, beginDestLoc, beginDestGlo = 0 ;
-  int indGloDest, indGloSrc, iSrc;
-  for (int i = 0; i < axisSrc_->n.getValue(); i++)
-  {
-    idxSrc = axisSrc_->index(i);
-    if ((idxSrc >= extractBegin_) && (idxSrc <= extractEnd_))
-    {
-      if (nDest == 0) beginDestLoc = i;
-      ++nDest;
-    }
-  }
-  beginDestGlo = beginDestLoc + axisSrc_->begin - extractBegin_;
-  axisDest_->n_glo.setValue(extractN_);
-  axisDest_->n.setValue(nDest);
-  axisDest_->begin.setValue(beginDestGlo);
-  axisDest_->index.resize(nDest);
-
-  axisDest_->data_n.setValue(nDest);
-  axisDest_->data_begin.setValue(0);
-  axisDest_->data_index.resize(nDest);
-
-  axisDest_->mask.resize(nDest);
-  if (axisSrc_->hasValue) axisDest_->value.resize(nDest);
-  if (axisSrc_->hasLabel) axisDest_->label.resize(nDest);
-  if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest);
-
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  for (int iDest = 0; iDest < nDest; iDest++)
-  {
-    iSrc = iDest + beginDestLoc;
-    axisDest_->index(iDest) = iDest + beginDestGlo;
-    axisDest_->data_index(iDest) = axisSrc_->data_index(iSrc) - beginDestLoc;
-    axisDest_->mask(iDest) = axisSrc_->mask(iSrc);
-
-    if (axisSrc_->hasValue)
-      axisDest_->value(iDest) = axisSrc_->value(iSrc);
-    if (axisSrc_->hasLabel)
-      axisDest_->label(iDest) = axisSrc_->label(iSrc);
-    if (axisSrc_->hasBounds)
-    {
-      axisDest_->bounds(0,iDest) = axisSrc_->bounds(0,iSrc);
-      axisDest_->bounds(1,iDest) = axisSrc_->bounds(1,iSrc);
-    }
-    indGloDest = axisDest_->index(iDest);
-    indGloSrc = axisSrc_->index(iSrc);
-    transMap[indGloDest].push_back(indGloSrc);
-    transWeight[indGloDest].push_back(1.0);
-
-  }
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CAxisAlgorithmExtract::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract.hpp	(revision 1975)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*!
-   \file axis_algorithm_extract.hpp
-   \brief Algorithm for extracting an axis.
- */
-#ifndef __XIOS_AXIS_ALGORITHM_EXTRACT_HPP__
-#define __XIOS_AXIS_ALGORITHM_EXTRACT_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-class CAxis;
-class CExtractAxis;
-
-/*!
-  \class CAxisAlgorithmExtract
-  Implementing extract on axis
-  A extracted region can be considered as region that isn't masked.
-  Only this extracted region is extracted to write on Netcdf.
-*/
-class CAxisAlgorithmExtract : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmExtract(CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis);
-
-  virtual ~CAxisAlgorithmExtract() {}
-
-  static bool registerTrans();
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-
-private:
-  //! Global extract begin on axis
-  StdSize extractBegin_;
-
-  //! Global extract end on axis
-  StdSize extractEnd_;
-
-  //! Global extract size on axis
-  StdSize extractN_;
-
-  std::vector<int> extractIndex_;
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_EXTRACT_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract_domain.cpp	(revision 1975)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_domain.cpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for extract a domain to an axis
- */
-#include "axis_algorithm_extract_domain.hpp"
-#include "extract_domain_to_axis.hpp"
-#include "axis.hpp"
-#include "domain.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "reduction.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmExtractDomain::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CAxis>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();
-
-  CExtractDomainToAxis* extractDomain = dynamic_cast<CExtractDomainToAxis*> (transformation);
-  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmExtractDomain(axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], extractDomain));
-}
-CATCH
-
-//bool CAxisAlgorithmExtractDomain::_dummyRegistered = CAxisAlgorithmExtractDomain::registerTrans();
-bool CAxisAlgorithmExtractDomain::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, create);
-}
-CATCH
-
-
-CAxisAlgorithmExtractDomain::CAxisAlgorithmExtractDomain(CAxis* axisDestination, CDomain* domainSource, CExtractDomainToAxis* algo)
- : CAxisAlgorithmTransformation(axisDestination, domainSource), pos_(-1), reduction_(0)
-TRY
-{
-  algo->checkValid(axisDestination, domainSource);
-  StdString op = "extract";
-
-  switch (algo->direction)
-  {
-    case CExtractDomainToAxis::direction_attr::jDir:
-      dir_ = jDir;
-      break;
-    case CExtractDomainToAxis::direction_attr::iDir:
-      dir_ = iDir;
-      break;
-    default:
-      break;
-  }
-
-  pos_ = algo->position;
-  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]);
-}
-CATCH
-
-void CAxisAlgorithmExtractDomain::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                        const double* dataInput,
-                                        CArray<double,1>& dataOut,
-                                        std::vector<bool>& flagInitial,                     
-                                        bool ignoreMissingValue, bool firstPass)
-TRY
-{
-  reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass);
-}
-CATCH
-
-CAxisAlgorithmExtractDomain::~CAxisAlgorithmExtractDomain()
-TRY
-{
-  if (0 != reduction_) delete reduction_;
-}
-CATCH
-
-void CAxisAlgorithmExtractDomain::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  CArray<int,1>& axisDstIndex = axisDest_->index;
-  int ni_glo = domainSrc_->ni_glo, nj_glo = domainSrc_->nj_glo;
-  if (jDir == dir_)
-  {
-    int nbAxisIdx = axisDstIndex.numElements();
-    for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis)
-    {
-      int globalAxisIdx = axisDstIndex(idxAxis);
-      transMap[globalAxisIdx].resize(1);
-      transWeight[globalAxisIdx].resize(1);
-      transMap[globalAxisIdx][0] = globalAxisIdx * ni_glo + pos_;
-      transWeight[globalAxisIdx][0] = 1.0;
-
-    }
-  }
-  else if (iDir == dir_)
-  {
-    int nbAxisIdx = axisDstIndex.numElements();
-    for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis)
-    {
-      int globalAxisIdx = axisDstIndex(idxAxis);
-      transMap[globalAxisIdx].resize(1);
-      transWeight[globalAxisIdx].resize(1);
-      transMap[globalAxisIdx][0] = globalAxisIdx + ni_glo * pos_;
-      transWeight[globalAxisIdx][0] = 1.0;
-    }
-  }
-  else
-  {}
-}
-CATCH
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_extract_domain.hpp	(revision 1975)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_domain.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce an axis to a axis
- */
-#ifndef __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__
-#define __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CAxis;
-class CDomain;
-class CExtractDomainToAxis;
-class CReductionAlgorithm;
-
-
-/*!
-  \class CAxisAlgorithmExtractDomain
-  Extract a domain to an axis
-*/
-class CAxisAlgorithmExtractDomain : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmExtractDomain(CAxis* axisDestination, CDomain* domainSource, CExtractDomainToAxis* algo);
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,                     
-                     bool ignoreMissingValue, bool firstPass);
-
-  virtual ~CAxisAlgorithmExtractDomain();
-
-  static bool registerTrans();
-protected:
-  enum ExtractDirection {
-    undefined = 0,
-    iDir = 1,
-    jDir = 2
-  };
-
-  ExtractDirection dir_;
-  int pos_; //! Position to extract
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-protected:
-  CReductionAlgorithm* reduction_;
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_interpolate.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_interpolate.cpp	(revision 1975)
+++ 	(revision )
@@ -1,393 +1,0 @@
-/*!
-   \file axis_algorithm_interpolate.cpp
-   \author Ha NGUYEN
-   \since 23 June 2015
-   \date 02 Jul 2015
-
-   \brief Algorithm for interpolation on an axis.
- */
-#include "axis_algorithm_interpolate.hpp"
-#include "axis.hpp"
-#include "interpolate_axis.hpp"
-#include <algorithm>
-#include "context.hpp"
-#include "context_client.hpp"
-#include "utils.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "distribution_client.hpp"
-#include "timer.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmInterpolate::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                   CTransformation<CAxis>* transformation,
-                                                                   int elementPositionInGrid,
-                                                                   std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                   std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                   std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
-
-  CInterpolateAxis* interpolateAxis = dynamic_cast<CInterpolateAxis*> (transformation);
-  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmInterpolate(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], interpolateAxis));
-}
-CATCH
-
-bool CAxisAlgorithmInterpolate::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_INTERPOLATE_AXIS, create);
-}
-CATCH
-
-CAxisAlgorithmInterpolate::CAxisAlgorithmInterpolate(CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis)
-: CAxisAlgorithmTransformation(axisDestination, axisSource), coordinate_(), transPosition_()
-TRY
-{
-  interpAxis->checkValid(axisSource);
-  order_ = interpAxis->order.getValue();
-  if (!interpAxis->coordinate.isEmpty())
-  {
-    coordinate_ = interpAxis->coordinate.getValue();
-    this->idAuxInputs_.resize(1);
-    this->idAuxInputs_[0] = coordinate_;
-  }
-}
-CATCH
-
-/*!
-  Compute the index mapping between axis on grid source and one on grid destination
-*/
-void CAxisAlgorithmInterpolate::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").resume() ;
-  CContext* context = CContext::getCurrent();
-  int nbClient = context->intraCommSize_;
-  CArray<bool,1>& axisMask = axisSrc_->mask;
-  int srcSize  = axisSrc_->n_glo.getValue();
-  std::vector<CArray<double,1> > vecAxisValue;
-
-  // Fill in axis value from coordinate
-  fillInAxisValue(vecAxisValue, dataAuxInputs);
-  std::vector<double> valueSrc(srcSize);
-  std::vector<double> recvBuff(srcSize);
-  std::vector<int> indexVec(srcSize);
-
-  for (int idx = 0; idx < vecAxisValue.size(); ++idx)
-  {
-    CArray<double,1>& axisValue = vecAxisValue[idx];
-    retrieveAllAxisValue(axisValue, axisMask, recvBuff, indexVec);
-    XIOSAlgorithms::sortWithIndex<double, CVectorStorage>(recvBuff, indexVec);
-    for (int i = 0; i < srcSize; ++i) valueSrc[i] = recvBuff[indexVec[i]];
-    computeInterpolantPoint(valueSrc, indexVec, idx);
-  }
-  CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").suspend() ;
-}
-CATCH
-
-/*!
-  Compute the interpolant points
-  Assume that we have all value of axis source, with these values, need to calculate weight (coeff) of Lagrange polynomial
-  \param [in] axisValue all value of axis source
-  \param [in] tranPos position of axis on a domain
-*/
-void CAxisAlgorithmInterpolate::computeInterpolantPoint(const std::vector<double>& axisValue,
-                                                        const std::vector<int>& indexVec,
-                                                        int transPos)
-TRY
-{
-  std::vector<double>::const_iterator itb = axisValue.begin(), ite = axisValue.end();
-  std::vector<double>::const_iterator itLowerBound, itUpperBound, it, iteRange, itfirst, itsecond;
-  const double sfmax = NumTraits<double>::sfmax();
-  const double precision = NumTraits<double>::dummy_precision();
-
-  int ibegin = axisDest_->begin.getValue();
-  CArray<double,1>& axisDestValue = axisDest_->value;
-  int numValue = axisDestValue.numElements();
-  std::map<int, std::vector<std::pair<int,double> > > interpolatingIndexValues;
-
-  for (int idx = 0; idx < numValue; ++idx)
-  {
-    bool outOfRange = false;
-    double destValue = axisDestValue(idx);
-    if (destValue < *itb) outOfRange = true;
-
-    itLowerBound = std::lower_bound(itb, ite, destValue);
-    itUpperBound = std::upper_bound(itb, ite, destValue);
-    if ((ite != itUpperBound) && (sfmax == *itUpperBound)) itUpperBound = ite;
-
-    if ((ite == itLowerBound) || (ite == itUpperBound)) outOfRange = true;
-
-    // We don't do extrapolation FOR NOW, maybe in the future
-    if (!outOfRange)
-    {
-      if ((itLowerBound == itUpperBound) && (itb != itLowerBound)) --itLowerBound;
-      double distanceToLower = destValue - *itLowerBound;
-      double distanceToUpper = *itUpperBound - destValue;
-      int order = (order_ + 1) - 2;
-      bool down = (distanceToLower < distanceToUpper) ? true : false;
-      for (int k = 0; k < order; ++k)
-      {
-        if ((itb != itLowerBound) && down)
-        {
-          --itLowerBound;
-          distanceToLower = destValue - *itLowerBound;
-          down = (distanceToLower < distanceToUpper) ? true : false;
-          continue;
-        }
-        if ((ite != itUpperBound) && (sfmax != *itUpperBound))
-        {
-          ++itUpperBound;
-          distanceToUpper = *itUpperBound - destValue;
-          down = (distanceToLower < distanceToUpper) ? true : false;
-
-        }
-      }
-
-      iteRange = (ite == itUpperBound) ? itUpperBound : itUpperBound + 1;
-      itsecond = it = itLowerBound; ++itsecond;
-      while (it < iteRange)
-      {
-        while ( (itsecond < ite) && ((*itsecond -*it) < precision) )
-        { ++itsecond; ++it; }
-        int index = std::distance(itb, it);
-        interpolatingIndexValues[idx+ibegin].push_back(make_pair(indexVec[index],*it));
-        ++it; ++itsecond;
-      }
-
-    }
-  }
-  computeWeightedValueAndMapping(interpolatingIndexValues, transPos);
-}
-CATCH
-
-/*!
-  Compute weight (coeff) of Lagrange's polynomial
-  \param [in] interpolatingIndexValues the necessary axis value to calculate the coeffs
-*/
-void CAxisAlgorithmInterpolate::computeWeightedValueAndMapping(const std::map<int, std::vector<std::pair<int,double> > >& interpolatingIndexValues, int transPos)
-TRY
-{
-  TransformationIndexMap& transMap = this->transformationMapping_[transPos];
-  TransformationWeightMap& transWeight = this->transformationWeight_[transPos];
-  std::map<int, std::vector<std::pair<int,double> > >::const_iterator itb = interpolatingIndexValues.begin(), it,
-                                                                      ite = interpolatingIndexValues.end();
-  int ibegin = axisDest_->begin.getValue();
-  for (it = itb; it != ite; ++it)
-  {
-    int globalIndexDest = it->first;
-    double localValue = axisDest_->value(globalIndexDest - ibegin);
-    const std::vector<std::pair<int,double> >& interpVal = it->second;
-    int interpSize = interpVal.size();
-    transMap[globalIndexDest].resize(interpSize);
-    transWeight[globalIndexDest].resize(interpSize);
-    for (int idx = 0; idx < interpSize; ++idx)
-    {
-      int index = interpVal[idx].first;
-      double weight = 1.0;
-
-      for (int k = 0; k < interpSize; ++k)
-      {
-        if (k == idx) continue;
-        weight *= (localValue - interpVal[k].second);
-        weight /= (interpVal[idx].second - interpVal[k].second);
-      }
-      transMap[globalIndexDest][idx] = index;
-      transWeight[globalIndexDest][idx] = weight;
-      if (!transPosition_.empty())
-      {
-        (this->transformationPosition_[transPos])[globalIndexDest] = transPosition_[transPos];
-      }
-    }
-  }
-  if (!transPosition_.empty() && this->transformationPosition_[transPos].empty())
-    (this->transformationPosition_[transPos])[0] = transPosition_[transPos];
-
-}
-CATCH
-
-/*!
-  Each client retrieves all values of an axis
-  \param [in/out] recvBuff buffer for receiving values (already allocated)
-  \param [in/out] indexVec mapping between values and global index of axis
-*/
-void CAxisAlgorithmInterpolate::retrieveAllAxisValue(const CArray<double,1>& axisValue, const CArray<bool,1>& axisMask,
-                                                     std::vector<double>& recvBuff, std::vector<int>& indexVec)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int nbClient = context->intraCommSize_;
-
-  int srcSize  = axisSrc_->n_glo.getValue();
-  int numValue = axisValue.numElements();
-
-  if (srcSize == numValue)  // Only one client or axis not distributed
-  {
-    for (int idx = 0; idx < srcSize; ++idx)
-    {
-      if (axisMask(idx))
-      {
-        recvBuff[idx] = axisValue(idx);
-        indexVec[idx] = idx;
-      }
-      else
-      {
-        recvBuff[idx] = NumTraits<double>::sfmax();
-        indexVec[idx] = -1;
-      }
-    }
-
-  }
-  else // Axis distributed
-  {
-    double* sendValueBuff = new double [numValue];
-    int* sendIndexBuff = new int [numValue];
-    int* recvIndexBuff = new int [srcSize];
-
-    int ibegin = axisSrc_->begin.getValue();
-    for (int idx = 0; idx < numValue; ++idx)
-    {
-      if (axisMask(idx))
-      {
-        sendValueBuff[idx] = axisValue(idx);
-        sendIndexBuff[idx] = idx + ibegin;
-      }
-      else
-      {
-        sendValueBuff[idx] = NumTraits<double>::sfmax();
-        sendIndexBuff[idx] = -1;
-      }
-    }
-
-    int* recvCount=new int[nbClient];
-    MPI_Allgather(&numValue,1,MPI_INT,recvCount,1,MPI_INT,context->intraComm_);
-
-    int* displ=new int[nbClient];
-    displ[0]=0 ;
-    for(int n=1;n<nbClient;n++) displ[n]=displ[n-1]+recvCount[n-1];
-
-    // Each client have enough global info of axis
-    MPI_Allgatherv(sendIndexBuff,numValue,MPI_INT,recvIndexBuff,recvCount,displ,MPI_INT,context->intraComm_);
-    MPI_Allgatherv(sendValueBuff,numValue,MPI_DOUBLE,&(recvBuff[0]),recvCount,displ,MPI_DOUBLE,context->intraComm_);
-
-    for (int idx = 0; idx < srcSize; ++idx)
-    {
-      indexVec[idx] = recvIndexBuff[idx];
-    }
-
-    delete [] displ;
-    delete [] recvCount;
-    delete [] recvIndexBuff;
-    delete [] sendIndexBuff;
-    delete [] sendValueBuff;
-  }
-}
-CATCH
-
-/*!
-  Fill in axis value dynamically from a field whose grid is composed of a domain and an axis
-  \param [in/out] vecAxisValue vector axis value filled in from input field
-*/
-void CAxisAlgorithmInterpolate::fillInAxisValue(std::vector<CArray<double,1> >& vecAxisValue,
-                                                const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  if (coordinate_.empty())
-  {
-    vecAxisValue.resize(1);
-    vecAxisValue[0].resize(axisSrc_->value.numElements());
-    vecAxisValue[0] = axisSrc_->value;
-    this->transformationMapping_.resize(1);
-    this->transformationWeight_.resize(1);
-  }
-  else
-  {
-    CField* field = CField::get(coordinate_);
-    CGrid* grid = field->getGrid();
-
-    std::vector<CDomain*> domListP = grid->getDomains();
-    std::vector<CAxis*> axisListP = grid->getAxis();
-    if (domListP.empty() || axisListP.empty() || (1 < domListP.size()) || (1 < axisListP.size()))
-      ERROR("CAxisAlgorithmInterpolate::fillInAxisValue(std::vector<CArray<double,1> >& vecAxisValue)",
-             << "XIOS only supports dynamic interpolation with coordinate (field) associated with grid composed of a domain and an axis"
-             << "Coordinate (field) id = " <<field->getId() << std::endl
-             << "Associated grid id = " << grid->getId());
-
-    CDomain* dom = domListP[0];
-    size_t vecAxisValueSize = dom->i_index.numElements();
-    size_t vecAxisValueSizeWithMask = 0;
-    for (size_t idx = 0; idx < vecAxisValueSize; ++idx)
-    {
-      if (dom->domainMask(idx)) ++vecAxisValueSizeWithMask;
-    }
-
-    int niGlobDom = dom->ni_glo.getValue();
-    vecAxisValue.resize(vecAxisValueSizeWithMask);
-    if (transPosition_.empty())
-    {
-      size_t indexMask = 0;
-      transPosition_.resize(vecAxisValueSizeWithMask);
-      for (size_t idx = 0; idx < vecAxisValueSize; ++idx)
-      {
-        if (dom->domainMask(idx))
-        {
-          transPosition_[indexMask].resize(1);
-          transPosition_[indexMask][0] = (dom->i_index)(idx) + niGlobDom * (dom->j_index)(idx);
-          ++indexMask;
-        }
-
-      }
-    }
-    this->transformationMapping_.resize(vecAxisValueSizeWithMask);
-    this->transformationWeight_.resize(vecAxisValueSizeWithMask);
-    this->transformationPosition_.resize(vecAxisValueSizeWithMask);
-
-    const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = grid->getClientDistribution()->getGlobalLocalDataSendToServer();
-    CDistributionClient::GlobalLocalDataMap::const_iterator itIndex, iteIndex = globalLocalIndexSendToServer.end();
-    size_t axisSrcSize = axisSrc_->index.numElements();
-    std::vector<int> globalDimension = grid->getGlobalDimension();
-
-    size_t indexMask = 0;
-    for (size_t idx = 0; idx < vecAxisValueSize; ++idx)
-    {
-      if (dom->domainMask(idx))
-      {
-        size_t axisValueSize = 0;
-        for (size_t jdx = 0; jdx < axisSrcSize; ++jdx)
-        {
-          size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1];
-          if (iteIndex != globalLocalIndexSendToServer.find(globalIndex))
-          {
-            ++axisValueSize;
-          }
-        }
-
-        vecAxisValue[indexMask].resize(axisValueSize);
-        axisValueSize = 0;
-        for (size_t jdx = 0; jdx < axisSrcSize; ++jdx)
-        {
-          size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1];
-          itIndex = globalLocalIndexSendToServer.find(globalIndex);
-          if (iteIndex != itIndex)
-          {
-            vecAxisValue[indexMask](axisValueSize) = (*dataAuxInputs[0])(itIndex->second);
-            ++axisValueSize;
-          }
-        }
-        ++indexMask;
-      }
-    }
-  }
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_interpolate.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_interpolate.hpp	(revision 1975)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*!
-   \file axis_algorithm_interpolate.hpp
-   \author Ha NGUYEN
-   \since 23 June 2015
-   \date 23 June 2015
-
-   \brief Algorithm for interpolation on an axis.
- */
-#ifndef __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__
-#define __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CAxis;
-class CGrid;
-class CInterpolateAxis;
-
-/*!
-  \class CAxisAlgorithmInterpolate
-  Implementing interpolation on axis
-  The values on axis source are assumed monotonic
-*/
-class CAxisAlgorithmInterpolate : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmInterpolate(CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis);
-
-  virtual ~CAxisAlgorithmInterpolate() {}
-
-  static bool registerTrans();
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  void retrieveAllAxisValue(const CArray<double,1>& axisValue, const CArray<bool,1>& axisMask,
-                            std::vector<double>& recvBuff, std::vector<int>& indexVec);
-  void computeInterpolantPoint(const std::vector<double>& recvBuff, const std::vector<int>&, int transPos = 0);
-  void computeWeightedValueAndMapping(const std::map<int, std::vector<std::pair<int,double> > >& interpolatingIndexValues, int transPos = 0);
-  void fillInAxisValue(std::vector<CArray<double,1> >& vecAxisValue,
-                       const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  // Interpolation order
-  int order_;
-  StdString coordinate_;
-  std::vector<std::vector<int> > transPosition_;
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-
-#endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_inverse.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_inverse.cpp	(revision 1975)
+++ 	(revision )
@@ -1,293 +1,0 @@
-/*!
-   \file axis_algorithm_inverse.hpp
-   \author Ha NGUYEN
-   \since 14 May 2015
-   \date 29 June 2015
-
-   \brief Algorithm for inversing an axis..
- */
-#include "axis_algorithm_inverse.hpp"
-#include "context.hpp"
-#include "context_client.hpp"
-#include "axis.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "inverse_axis.hpp"
-#include "client_client_dht_template.hpp"
-
-namespace xios {
-
-CGenericAlgorithmTransformation* CAxisAlgorithmInverse::create(CGrid* gridDst, CGrid* gridSrc,
-                                                               CTransformation<CAxis>* transformation,
-                                                               int elementPositionInGrid,
-                                                               std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                               std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                               std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                               std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                               std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                               std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
-
-  CInverseAxis* inverseAxis = dynamic_cast<CInverseAxis*> (transformation);
-  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmInverse(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], inverseAxis));
-}
-CATCH
-
-bool CAxisAlgorithmInverse::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_INVERSE_AXIS, create);
-}
-CATCH
-
-CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource, CInverseAxis* inverseAxis)
- : CAxisAlgorithmTransformation(axisDestination, axisSource)
-TRY
-{
-  if (axisDestination->n_glo.getValue() != axisSource->n_glo.getValue())
-  {
-    ERROR("CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource)",
-           << "Two axis have different global size"
-           << "Size of axis source " <<axisSource->getId() << " is " << axisSource->n_glo.getValue()  << std::endl
-           << "Size of axis destination " <<axisDestination->getId() << " is " << axisDestination->n_glo.getValue());
-  }
-}
-CATCH
-
-void CAxisAlgorithmInverse::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  int globalIndexSize = axisDestGlobalIndex_.size();
-  for (int idx = 0; idx < globalIndexSize; ++idx)
-  {
-    transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1);
-    transWeight[axisDestGlobalIndex_[idx]].push_back(1.0);
-  }
-
-  int niSrc   = axisSrc_->n.getValue();
-  int sizeSrc = axisSrc_->n_glo.getValue();
-  if (niSrc != sizeSrc) updateAxisValue();
-  else
-  {
-    for (int idx = 0; idx < sizeSrc; ++idx)
-    {
-      axisDest_->value(idx) = axisSrc_->value(sizeSrc-idx-1);
-    }
-  }
-}
-CATCH
-
-/*!
-  Update value on axis after inversing
-  After an axis is inversed, not only the data on it must be inversed but also the value
-*/
-void CAxisAlgorithmInverse::updateAxisValue()
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-  int nbClient = context->intraCommSize_;
-
-  int niSrc     = axisSrc_->n.getValue();
-  int ibeginSrc = axisSrc_->begin.getValue();
-  int nSrc = axisSrc_->index.numElements();
-
-  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;
-  for (int idx = 0; idx < nSrc; ++idx)
-  {
-    if ((axisSrc_->mask)(idx))
-    {
-      globalIndex2ProcRank[(axisSrc_->index)(idx)].resize(1);
-      globalIndex2ProcRank[(axisSrc_->index)(idx)][0] = clientRank;
-    }
-  }
-
-  typedef std::unordered_map<size_t, std::vector<double> > GlobalIndexMapFromSrcToDest;
-  GlobalIndexMapFromSrcToDest globalIndexMapFromSrcToDest;
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationIndexMap::const_iterator itb = transMap.begin(), ite = transMap.end(), it;
-  CArray<size_t,1> globalSrcIndex(transMap.size());
-  int localIndex = 0;
-  for (it = itb; it != ite; ++it)
-  {
-    size_t srcIndex = it->second[0];
-    globalIndexMapFromSrcToDest[srcIndex].resize(1);
-    globalIndexMapFromSrcToDest[srcIndex][0] = it->first;
-    globalSrcIndex(localIndex) = srcIndex;
-    ++localIndex;
-  }
-
-  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);
-  dhtIndexProcRank.computeIndexInfoMapping(globalSrcIndex);
-  CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
-  std::unordered_map<int, std::vector<size_t> > globalSrcIndexSendToProc;
-  for (int idx = 0; idx < localIndex; ++idx)
-  {
-    size_t tmpIndex = globalSrcIndex(idx);
-    if (1 == computedGlobalIndexOnProc.count(tmpIndex))
-    {
-      std::vector<int>& tmpVec = computedGlobalIndexOnProc[tmpIndex];
-      globalSrcIndexSendToProc[tmpVec[0]].push_back(tmpIndex);
-    }
-  }
-
-  std::unordered_map<int, std::vector<size_t> >::const_iterator itbIndex = globalSrcIndexSendToProc.begin(), itIndex,
-                                                                  iteIndex = globalSrcIndexSendToProc.end();
-  std::map<int,int> sendRankSizeMap,recvRankSizeMap;
-  int connectedClient = globalSrcIndexSendToProc.size();
-  int* recvCount=new int[nbClient];
-  int* displ=new int[nbClient];
-  int* sendRankBuff=new int[connectedClient];
-  int* sendSizeBuff=new int[connectedClient];
-  int n = 0;
-  for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex, ++n)
-  {
-    sendRankBuff[n] = itIndex->first;
-    int sendSize = itIndex->second.size();
-    sendSizeBuff[n] = sendSize;
-    sendRankSizeMap[itIndex->first] = sendSize;
-  }
-  MPI_Allgather(&connectedClient,1,MPI_INT,recvCount,1,MPI_INT,context->intraComm_);
-
-  displ[0]=0 ;
-  for(int n=1;n<nbClient;n++) displ[n]=displ[n-1]+recvCount[n-1];
-  int recvSize=displ[nbClient-1]+recvCount[nbClient-1];
-  int* recvRankBuff=new int[recvSize];
-  int* recvSizeBuff=new int[recvSize];
-  MPI_Allgatherv(sendRankBuff,connectedClient,MPI_INT,recvRankBuff,recvCount,displ,MPI_INT,context->intraComm_);
-  MPI_Allgatherv(sendSizeBuff,connectedClient,MPI_INT,recvSizeBuff,recvCount,displ,MPI_INT,context->intraComm_);
-  for (int i = 0; i < nbClient; ++i)
-  {
-    int currentPos = displ[i];
-    for (int j = 0; j < recvCount[i]; ++j)
-      if (recvRankBuff[currentPos+j] == clientRank)
-      {
-        recvRankSizeMap[i] = recvSizeBuff[currentPos+j];
-      }
-  }
-
-  // Sending global index of grid source to corresponding process as well as the corresponding mask
-  std::vector<MPI_Request> requests;
-  std::vector<MPI_Status> status;
-  std::unordered_map<int, unsigned long* > recvGlobalIndexSrc;
-  std::unordered_map<int, double* > sendValueToDest;
-  for (std::map<int,int>::const_iterator itRecv = recvRankSizeMap.begin(); itRecv != recvRankSizeMap.end(); ++itRecv)
-  {
-    int recvRank = itRecv->first;
-    int recvSize = itRecv->second;
-    recvGlobalIndexSrc[recvRank] = new unsigned long [recvSize];
-    sendValueToDest[recvRank] = new double [recvSize];
-
-    requests.push_back(MPI_Request());
-    MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, context->intraComm_, &requests.back());
-  }
-
-  std::unordered_map<int, unsigned long* > sendGlobalIndexSrc;
-  std::unordered_map<int, double* > recvValueFromSrc;
-  for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex)
-  {
-    int sendRank = itIndex->first;
-    int sendSize = sendRankSizeMap[sendRank];
-    const std::vector<size_t>& sendIndexMap = itIndex->second;
-    std::vector<size_t>::const_iterator itbSend = sendIndexMap.begin(), iteSend = sendIndexMap.end(), itSend;
-    sendGlobalIndexSrc[sendRank] = new unsigned long [sendSize];
-    recvValueFromSrc[sendRank] = new double [sendSize];
-    int countIndex = 0;
-    for (itSend = itbSend; itSend != iteSend; ++itSend)
-    {
-      sendGlobalIndexSrc[sendRank][countIndex] = *itSend;
-      ++countIndex;
-    }
-
-    // Send global index source and mask
-    requests.push_back(MPI_Request());
-    MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, context->intraComm_, &requests.back());
-  }
-
-  status.resize(requests.size());
-  MPI_Waitall(requests.size(), &requests[0], &status[0]);
-
-
-  std::vector<MPI_Request>().swap(requests);
-  std::vector<MPI_Status>().swap(status);
-
-  // Okie, on destination side, we will wait for information of masked index of source
-  for (std::map<int,int>::const_iterator itSend = sendRankSizeMap.begin(); itSend != sendRankSizeMap.end(); ++itSend)
-  {
-    int recvRank = itSend->first;
-    int recvSize = itSend->second;
-
-    requests.push_back(MPI_Request());
-    MPI_Irecv(recvValueFromSrc[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, context->intraComm_, &requests.back());
-  }
-
-  for (std::map<int,int>::const_iterator itRecv = recvRankSizeMap.begin(); itRecv != recvRankSizeMap.end(); ++itRecv)
-  {
-    int recvRank = itRecv->first;
-    int recvSize = itRecv->second;
-    double* sendValue = sendValueToDest[recvRank];
-    unsigned long* recvIndexSrc = recvGlobalIndexSrc[recvRank];
-    int realSendSize = 0;
-    for (int idx = 0; idx < recvSize; ++idx)
-    {
-      size_t globalIndex = *(recvIndexSrc+idx);
-      int localIndex = globalIndex - ibeginSrc;
-      *(sendValue + idx) = axisSrc_->value(localIndex);
-    }
-    // Okie, now inform the destination which source index are masked
-    requests.push_back(MPI_Request());
-    MPI_Isend(sendValueToDest[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, context->intraComm_, &requests.back());
-  }
-  status.resize(requests.size());
-  MPI_Waitall(requests.size(), &requests[0], &status[0]);
-
-
-  size_t nGloAxisDest = axisDest_->n_glo.getValue() - 1;
-  for (std::map<int,int>::const_iterator itSend = sendRankSizeMap.begin(); itSend != sendRankSizeMap.end(); ++itSend)
-  {
-    int recvRank = itSend->first;
-    int recvSize = itSend->second;
-
-    double* recvValue = recvValueFromSrc[recvRank];
-    unsigned long* recvIndex = sendGlobalIndexSrc[recvRank];
-    for (int idx = 0; idx < recvSize; ++idx)
-    {
-      size_t globalIndex = *(recvIndex+idx);
-      int localIndex = ((nGloAxisDest-globalIndex) - axisDest_->begin);
-      axisDest_->value(localIndex) = *(recvValue + idx);
-    }
-  }
-
-  delete [] recvCount;
-  delete [] displ;
-  delete [] sendRankBuff;
-  delete [] recvRankBuff;
-  delete [] sendSizeBuff;
-  delete [] recvSizeBuff;
-
-  std::unordered_map<int, double* >::const_iterator itChar;
-  for (itChar = sendValueToDest.begin(); itChar != sendValueToDest.end(); ++itChar)
-    delete [] itChar->second;
-  for (itChar = recvValueFromSrc.begin(); itChar != recvValueFromSrc.end(); ++itChar)
-    delete [] itChar->second;
-  std::unordered_map<int, unsigned long* >::const_iterator itLong;
-  for (itLong = sendGlobalIndexSrc.begin(); itLong != sendGlobalIndexSrc.end(); ++itLong)
-    delete [] itLong->second;
-  for (itLong = recvGlobalIndexSrc.begin(); itLong != recvGlobalIndexSrc.end(); ++itLong)
-    delete [] itLong->second;
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_inverse.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_inverse.hpp	(revision 1975)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*!
-   \file axis_algorithm_inverse.hpp
-   \author Ha NGUYEN
-   \since 14 May 2015
-   \date 09 June 2015
-
-   \brief Algorithm for inversing an axis..
- */
-#ifndef __XIOS_AXIS_ALGORITHM_INVERSE_HPP__
-#define __XIOS_AXIS_ALGORITHM_INVERSE_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CAxis;
-class CInverseAxis;
-
-/*!
-  \class CAxisAlgorithmInverse
-  Inversing an axis
-*/
-class CAxisAlgorithmInverse : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource, CInverseAxis* inverseAxis);
-
-  virtual ~CAxisAlgorithmInverse() {}
-
-  static bool registerTrans();
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  void updateAxisValue();
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_INVERSE_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_axis.cpp	(revision 1975)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_axis.cpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce a axis to an axis
- */
-#include "axis_algorithm_reduce_axis.hpp"
-#include "reduce_axis_to_axis.hpp"
-#include "axis.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "reduction.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmReduceAxis::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                   CTransformation<CAxis>* transformation,
-                                                                   int elementPositionInGrid,
-                                                                   std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                   std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                   std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
-
-  CReduceAxisToAxis* reduceAxis = dynamic_cast<CReduceAxisToAxis*> (transformation);
-  int axisDstIndex   = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmReduceAxis(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], reduceAxis));
-}
-CATCH
-
-bool CAxisAlgorithmReduceAxis::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, create);
-}
-CATCH
-
-
-CAxisAlgorithmReduceAxis::CAxisAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo)
- : CAxisAlgorithmTransformation(axisDestination, axisSource), reduction_(0)
-TRY
-{
-  eliminateRedondantSrc_= false ;
-  algo->checkValid(axisDestination, axisSource);
-  StdString op;
-  switch (algo->operation)
-  {
-    case CReduceAxisToAxis::operation_attr::sum:
-      op = "sum";
-      break;
-    case CReduceAxisToAxis::operation_attr::min:
-      op = "min";
-      break;
-    case CReduceAxisToAxis::operation_attr::max:
-      op = "max";
-      break;
-    case CReduceAxisToAxis::operation_attr::average:
-      op = "average";
-      break;
-    default:
-        ERROR("CAxisAlgorithmReduceAxis::CAxisAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo)",
-         << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl
-         << "Axis source " <<axisSource->getId() << std::endl
-         << "Axis destination " << axisDestination->getId());
-
-  }
-
-  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]);
-}
-CATCH
-
-void CAxisAlgorithmReduceAxis::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                       const double* dataInput,
-                                       CArray<double,1>& dataOut,
-                                       std::vector<bool>& flagInitial,                     
-                                       bool ignoreMissingValue, bool firstPass)
-TRY
-{
-  reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass);
-}
-CATCH
-
-void CAxisAlgorithmReduceAxis::updateData(CArray<double,1>& dataOut)
-TRY
-{
-  reduction_->updateData(dataOut);
-}
-CATCH
-
-CAxisAlgorithmReduceAxis::~CAxisAlgorithmReduceAxis()
-TRY
-{
-  if (0 != reduction_) delete reduction_;
-}
-CATCH
-
-void CAxisAlgorithmReduceAxis::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-  CArray<int,1>& axisDstIndex = axisDest_->index;
-  int nbAxisIdx = axisDstIndex.numElements();
-  for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis)
-  {
-    int globalAxisIdx = axisDstIndex(idxAxis);
-    transMap[globalAxisIdx].resize(1);
-    transWeight[globalAxisIdx].resize(1);
-    transMap[globalAxisIdx][0]=globalAxisIdx ;      
-    transWeight[globalAxisIdx][0] = 1.0 ;      
-  }
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_axis.hpp	(revision 1975)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_axis.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce an axis to a axis
- */
-#ifndef __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__
-#define __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CAxis;
-class CReduceAxisToAxis;
-class CReductionAlgorithm;
-
-/*!
-  \class CAxisAlgorithmReduceAxis
-  Reduce a axis to an axis
-*/
-class CAxisAlgorithmReduceAxis : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo);
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,                     
-                     bool ignoreMissingValue, bool firstPass);
-
-  virtual void updateData(CArray<double,1>& dataOut);
-  
-  virtual ~CAxisAlgorithmReduceAxis();
-
-  static bool registerTrans();
-protected:
-  
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
-  
-protected:
-  CReductionAlgorithm* reduction_;
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_domain.cpp	(revision 1975)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_domain.cpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce a domain to an axis
- */
-#include "axis_algorithm_reduce_domain.hpp"
-#include "reduce_domain_to_axis.hpp"
-#include "axis.hpp"
-#include "domain.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "reduction.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmReduceDomain::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                   CTransformation<CAxis>* transformation,
-                                                                   int elementPositionInGrid,
-                                                                   std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                   std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                   std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                   std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();
-
-  CReduceDomainToAxis* reduceDomain = dynamic_cast<CReduceDomainToAxis*> (transformation);
-  int axisDstIndex   = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmReduceDomain(axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], reduceDomain));
-}
-CATCH
-
-bool CAxisAlgorithmReduceDomain::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, create);
-}
-CATCH
-
-
-CAxisAlgorithmReduceDomain::CAxisAlgorithmReduceDomain(CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo)
- : CAxisAlgorithmTransformation(axisDestination, domainSource), reduction_(0)
-TRY
-{
-  algo->checkValid(axisDestination, domainSource);
-  StdString op;
-  switch (algo->operation)
-  {
-    case CReduceDomainToAxis::operation_attr::sum:
-      op = "sum";
-      break;
-    case CReduceDomainToAxis::operation_attr::min:
-      op = "min";
-      break;
-    case CReduceDomainToAxis::operation_attr::max:
-      op = "max";
-      break;
-    case CReduceDomainToAxis::operation_attr::average:
-      op = "average";
-      break;
-    default:
-        ERROR("CAxisAlgorithmReduceDomain::CAxisAlgorithmReduceDomain(CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo)",
-         << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl
-         << "Domain source " <<domainSource->getId() << std::endl
-         << "Axis destination " << axisDestination->getId());
-
-  }
-
-  dir_ = (CReduceDomainToAxis::direction_attr::iDir == algo->direction)  ? iDir : jDir;
-  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]);
-  local = algo->local ;
-}
-CATCH
-
-void CAxisAlgorithmReduceDomain::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                       const double* dataInput,
-                                       CArray<double,1>& dataOut,
-                                       std::vector<bool>& flagInitial,                     
-                                       bool ignoreMissingValue, bool firstPass)
-TRY
-{
-  reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass);
-}
-CATCH
-
-void CAxisAlgorithmReduceDomain::updateData(CArray<double,1>& dataOut)
-TRY
-{
-  reduction_->updateData(dataOut);
-}
-CATCH
-
-CAxisAlgorithmReduceDomain::~CAxisAlgorithmReduceDomain()
-TRY
-{
-  if (0 != reduction_) delete reduction_;
-}
-CATCH
-
-void CAxisAlgorithmReduceDomain::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  CArray<int,1>& axisDstIndex = axisDest_->index;
-  int ni_glo = domainSrc_->ni_glo, nj_glo = domainSrc_->nj_glo;
-  if (iDir == dir_)
-  {
-    if (local)
-    {
-      const CArray<int, 1>& i_index = domainSrc_-> i_index.getValue() ;
-      const CArray<int, 1>& j_index = domainSrc_-> j_index.getValue() ;
-      const CArray<bool,1>& localMask = domainSrc_-> localMask ;
-      int nbDomainIdx = i_index.numElements();
-      
-      for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain)
-      {
-        if (localMask(idxDomain))
-        { 
-          transMap[j_index(idxDomain)].push_back(j_index(idxDomain)* ni_glo + i_index(idxDomain));
-          transWeight[j_index(idxDomain)].push_back(1.0) ;
-        }
-      }
-    }
-    else
-    {
-      int nbAxisIdx = axisDstIndex.numElements();
-      for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis)
-      {
-        int globalAxisIdx = axisDstIndex(idxAxis);
-        transMap[globalAxisIdx].resize(ni_glo);
-        transWeight[globalAxisIdx].resize(ni_glo);
-        for (int idx = 0; idx < ni_glo; ++idx)
-        {
-          transMap[globalAxisIdx][idx] = globalAxisIdx * ni_glo + idx;
-          transWeight[globalAxisIdx][idx] = 1.0;
-        }
-      }
-    }
-  }
-  else if (jDir == dir_)
-  {
-    int nbAxisIdx = axisDstIndex.numElements();
-    if (local)
-    {
-      const CArray<int, 1>& i_index = domainSrc_-> i_index.getValue() ;
-      const CArray<int, 1>& j_index = domainSrc_-> j_index.getValue() ;
-      const CArray<bool,1>& localMask = domainSrc_-> localMask ;
-      int nbDomainIdx = i_index.numElements();
-      
-      for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain)
-      {
-        if (localMask(idxDomain))
-        { 
-          transMap[i_index(idxDomain)].push_back(j_index(idxDomain)* ni_glo + i_index(idxDomain));
-          transWeight[i_index(idxDomain)].push_back(1.0) ;
-        }
-      }
-    }
-    else
-    {
-      for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis)
-      {
-        int globalAxisIdx = axisDstIndex(idxAxis);
-        transMap[globalAxisIdx].resize(nj_glo);
-        transWeight[globalAxisIdx].resize(nj_glo);
-        for (int idx = 0; idx < nj_glo; ++idx)
-        {
-          transMap[globalAxisIdx][idx] = globalAxisIdx + ni_glo*idx;
-          transWeight[globalAxisIdx][idx] = 1.0;
-        }
-      }
-    }
-  }
-  else
-  {}
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_reduce_domain.hpp	(revision 1975)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_domain.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce an axis to a axis
- */
-#ifndef __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__
-#define __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CAxis;
-class CDomain;
-class CReduceDomainToAxis;
-class CReductionAlgorithm;
-
-/*!
-  \class CAxisAlgorithmReduceDomain
-  Reduce a domain to an axis
-*/
-class CAxisAlgorithmReduceDomain : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmReduceDomain(CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo);
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,                     
-                     bool ignoreMissingValue, bool firstPass);
-
-  virtual void updateData(CArray<double,1>& dataOut);
-  
-  virtual ~CAxisAlgorithmReduceDomain();
-
-  static bool registerTrans();
-protected:
-  enum ReduceDirection {
-    undefined = 0,
-    iDir = 1,
-    jDir = 2
-  };
-  
-  ReduceDirection dir_;
-  bool local ;
-  
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
-  
-protected:
-  CReductionAlgorithm* reduction_;
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_temporal_splitting.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_temporal_splitting.cpp	(revision 1975)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*!
-   \file axis_algorithm_temporal_splitting.cpp
-
-   \brief Algorithm to split scalar into  axis by temporal accumulation
- */
-#include "axis_algorithm_temporal_splitting.hpp"
-#include "temporal_splitting.hpp"
-#include "axis.hpp"
-#include "scalar.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmTemporalSplitting::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CAxis>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CScalar*> scalarListSrcP = gridSrc->getScalars();
-
-  CTemporalSplitting* temporalSplitting = dynamic_cast<CTemporalSplitting*> (transformation);
-  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int scalarSrcIndex = elementPositionInGridSrc2ScalarPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmTemporalSplitting(axisListDestP[axisDstIndex], scalarListSrcP[scalarSrcIndex], temporalSplitting));
-}
-CATCH
-
-bool CAxisAlgorithmTemporalSplitting::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_TEMPORAL_SPLITTING, create);
-}
-CATCH
-
-CAxisAlgorithmTemporalSplitting::CAxisAlgorithmTemporalSplitting(CAxis* axisDestination, CScalar* scalarSource, CTemporalSplitting* algo)
- : CAxisAlgorithmTransformation(axisDestination, scalarSource)
-{
-
-}
-
-
-CAxisAlgorithmTemporalSplitting::~CAxisAlgorithmTemporalSplitting()
-{
-}
-
-void CAxisAlgorithmTemporalSplitting::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  CArray<int,1>& axisDstIndex = axisDest_->index;
-
-  int nbAxisIdx = axisDstIndex.numElements();
-  for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis)
-  {
-    int globalAxisIdx = axisDstIndex(idxAxis);
-    if (idxAxis==0)
-    {
-      transMap[globalAxisIdx].resize(1);
-      transWeight[globalAxisIdx].resize(1);
-      transMap[globalAxisIdx][0] = 0 ;
-      transWeight[globalAxisIdx][0] = 1.0 ;
-    }
-  }
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_temporal_splitting.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_temporal_splitting.hpp	(revision 1975)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*!
-   \file axis_algorithm_reduce_domain.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce an axis to a axis
- */
-#ifndef __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__
-#define __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CAxis;
-class CScalar;
-class CTemporalSplitting;
-
-
-
-/*!
-  \class CAxisAlgorithmExtractDomain
-  Extract a domain to an axis
-*/
-class CAxisAlgorithmTemporalSplitting : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmTemporalSplitting(CAxis* axisDestination, CScalar* scalarSource, CTemporalSplitting* algo);
-
-  virtual ~CAxisAlgorithmTemporalSplitting();
-
-  static bool registerTrans();
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_transformation.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_transformation.cpp	(revision 1975)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*!
-   \file axis_algorithm_transformation.hpp
-   \author Ha NGUYEN
-   \since 14 May 2015
-   \date 29 June 2015
-
-   \brief Interface for all axis transformation algorithms.
- */
-
-#include "axis_algorithm_transformation.hpp"
-#include "axis_algorithm_inverse.hpp"
-#include "axis_algorithm_zoom.hpp"
-#include "context.hpp"
-#include "context_client.hpp"
-#include "client_client_dht_template.hpp"
-#include "axis.hpp"
-
-namespace xios {
-
-CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination, CAxis* axisSource)
- : CGenericAlgorithmTransformation(), axisDest_(axisDestination), axisSrc_(axisSource), domainSrc_(0),scalarSrc_(0)
-TRY
-{
-  axisDestGlobalSize_ = axisDestination->n_glo.getValue();
-  int niDest = axisDestination->n.getValue();
-  int ibeginDest = axisDestination->begin.getValue();
-
-  for (int idx = 0; idx < niDest; ++idx)
-    if ((axisDestination->mask)(idx)) axisDestGlobalIndex_.push_back(ibeginDest+idx);
-}
-CATCH
-
-CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination, CDomain* domainSource)
- : CGenericAlgorithmTransformation(), axisDest_(axisDestination), axisSrc_(0), domainSrc_(domainSource),scalarSrc_(0)
-TRY
-{
-  axisDestGlobalSize_ = axisDestination->n_glo.getValue();
-  int niDest = axisDestination->n.getValue();
-  int ibeginDest = axisDestination->begin.getValue();
-
-  for (int idx = 0; idx < niDest; ++idx)
-    if ((axisDestination->mask)(idx)) axisDestGlobalIndex_.push_back(ibeginDest+idx);
-}
-CATCH
-
-CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination, CScalar* scalarSource)
- : CGenericAlgorithmTransformation(), axisDest_(axisDestination), axisSrc_(0), domainSrc_(0), scalarSrc_(scalarSource)
-TRY
-{
-  axisDestGlobalSize_ = axisDestination->n_glo.getValue();
-  int niDest = axisDestination->n.getValue();
-  int ibeginDest = axisDestination->begin.getValue();
-
-  for (int idx = 0; idx < niDest; ++idx)
-    if ((axisDestination->mask)(idx)) axisDestGlobalIndex_.push_back(ibeginDest+idx);
-}
-CATCH
-
-CAxisAlgorithmTransformation::~CAxisAlgorithmTransformation()
-{
-}
-
-void CAxisAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-/*!
-  Compute global index of axis on different processes
-  \param [in] globalAxisIndex global index of axis source
-  \param [out] globalAxisIndexOnProc processes which contain the corresponding global index of axis source
-*/
-void CAxisAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex,
-                                                              int elementType,
-                                                              CClientClientDHTInt::Index2VectorInfoTypeMap& globalAxisIndexOnProc)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-  int clientSize = context->intraCommSize_;
-
-  size_t globalIndex;
-  int nIndexSize = 0;
-  CArray<bool,1>* ptLocalMask ;
-  CArray<bool,1> scalarMask(1) ;
-  scalarMask=true ;
-  
-  if (2 == elementType) 
-  {
-    nIndexSize = domainSrc_->i_index.numElements();
-    ptLocalMask=&(domainSrc_->localMask) ;
-  }
-  else if (1 == elementType)
-  {
-     nIndexSize = axisSrc_->index.numElements();
-     ptLocalMask=&(axisSrc_->mask) ;
-  }
-  else
-  {
-     nIndexSize=1  ; //  scalar
-     ptLocalMask=&scalarMask ;
-  }
-  CArray<bool,1>& localMask=*ptLocalMask ;
-  
-  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;
-  globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));
-  for (int idx = 0; idx < nIndexSize; ++idx)
-  {
-    if (localMask(idx))
-    {
-      if (2 == elementType) // domain
-      {
-       globalIndex = domainSrc_->i_index(idx) + domainSrc_->j_index(idx) * domainSrc_->ni_glo;
-      }
-      else if (1 == elementType) // axis
-      {
-        globalIndex = axisSrc_->index(idx);
-      }
-      else // scalar
-      {
-        globalIndex = 0;
-      }
-     
-      globalIndex2ProcRank[globalIndex].resize(1);
-      globalIndex2ProcRank[globalIndex][0] = clientRank;
-    }
-  }
-
-  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);
-  dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex);
-
-  globalAxisIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_transformation.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_transformation.hpp	(revision 1975)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*!
-   \file axis_algorithm_transformation.hpp
-   \author Ha NGUYEN
-   \since 14 May 2015
-   \date 29 June 2015
-
-   \brief Interface for all axis transformation algorithms.
- */
-#ifndef __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__
-#define __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__
-
-#include "generic_algorithm_transformation.hpp"
-#include "grid_transformation_factory_impl.hpp"
-
-namespace xios {
-
-class CAxis;
-class CDomain;
-class CScalar;
-/*!
-  \class CAxisAlgorithmTransformation
-  Algorithms for axis.
-*/
-class CAxisAlgorithmTransformation : public virtual CGenericAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmTransformation(CAxis* axisDestination, CAxis* axisSource);
-  CAxisAlgorithmTransformation(CAxis* axisDestination, CDomain* domainSource);
-  CAxisAlgorithmTransformation(CAxis* axisDestination, CScalar* scalarSource);
-
-  virtual ~CAxisAlgorithmTransformation();
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-  virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex,
-                                          int elementType,
-                                          CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc);
-
-protected:
-  //! Global index of an axis on grid destination
-  std::vector<int> axisDestGlobalIndex_;
-
-  //! Size of
-  int axisDestGlobalSize_;
-
-    //! Axis on grid destination
-  CAxis* axisDest_;
-
-  //! Axis on grid source
-  CAxis* axisSrc_;
-
-  //! Domain on grid source
-  CDomain* domainSrc_;
-
-  //! Scalar on grid source
-
-  CScalar* scalarSrc_;
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_zoom.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_zoom.cpp	(revision 1975)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*!
-   \file axis_algorithm_zoom.cpp
-   \brief Algorithm for zooming an axis.
- */
-#include "axis_algorithm_zoom.hpp"
-#include "axis.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "zoom_axis.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CAxisAlgorithmZoom::create(CGrid* gridDst, CGrid* gridSrc,
-                                                           CTransformation<CAxis>* transformation,
-                                                           int elementPositionInGrid,
-                                                           std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                           std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                           std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                           std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                           std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                           std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CAxis*> axisListDestP = gridDst->getAxis();
-  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
-
-  CZoomAxis* zoomAxis = dynamic_cast<CZoomAxis*> (transformation);
-  int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid];
-  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CAxisAlgorithmZoom(axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], zoomAxis));
-}
-CATCH
-
-bool CAxisAlgorithmZoom::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CAxis>::registerTransformation(TRANS_ZOOM_AXIS, create);
-}
-CATCH
-
-CAxisAlgorithmZoom::CAxisAlgorithmZoom(CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis)
-: CAxisAlgorithmTransformation(axisDestination, axisSource)
-TRY
-{
-  zoomAxis->checkValid(axisSource);
-  zoomBegin_ = zoomAxis->begin.getValue();
-  zoomN_  = zoomAxis->n.getValue();
-  zoomEnd_   = zoomBegin_ + zoomN_ - 1;
-
-  if (zoomN_ > axisSource->n_glo.getValue())
-  {
-    ERROR("CAxisAlgorithmZoom::CAxisAlgorithmZoom(CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis)",
-           << "Zoom size is greater than global size of source axis"
-           << "Global size of source axis " <<axisSource->getId() << " is " << axisSource->n_glo.getValue()  << std::endl
-           << "Zoom size is " << zoomN_ );
-  }
-
-  int idxSrc, nDest = 0, beginDestLoc, beginDestGlo = 0 ;
-  int indGloDest, indGloSrc, iSrc;
-  for (int i = 0; i < axisSrc_->n.getValue(); i++)
-  {
-    idxSrc = axisSrc_->index(i);
-    if ((idxSrc >= zoomBegin_) && (idxSrc <= zoomEnd_))
-    {
-      if (nDest == 0) beginDestLoc = i;
-      ++nDest;
-    }
-  }
-  beginDestGlo = beginDestLoc + axisSrc_->begin - zoomBegin_;
-  axisDest_->n_glo.setValue(zoomN_);
-  axisDest_->n.setValue(nDest);
-  axisDest_->begin.setValue(beginDestGlo);
-  axisDest_->index.resize(nDest);
-
-  axisDest_->data_n.setValue(nDest);
-  axisDest_->data_begin.setValue(0);
-  axisDest_->data_index.resize(nDest);
-
-  axisDest_->mask.resize(nDest);
-  if (axisSrc_->hasValue) axisDest_->value.resize(nDest);
-  if (axisSrc_->hasLabel) axisDest_->label.resize(nDest);
-  if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest);
-
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  for (int iDest = 0; iDest < nDest; iDest++)
-  {
-    iSrc = iDest + beginDestLoc;
-    axisDest_->index(iDest) = iDest + beginDestGlo;
-    axisDest_->data_index(iDest) = axisSrc_->data_index(iSrc) - beginDestLoc;
-    axisDest_->mask(iDest) = axisSrc_->mask(iSrc);
-
-    if (axisSrc_->hasValue)
-      axisDest_->value(iDest) = axisSrc_->value(iSrc);
-    if (axisSrc_->hasLabel)
-      axisDest_->label(iDest) = axisSrc_->label(iSrc);
-    if (axisSrc_->hasBounds)
-    {
-      axisDest_->bounds(0,iDest) = axisSrc_->bounds(0,iSrc);
-      axisDest_->bounds(1,iDest) = axisSrc_->bounds(1,iSrc);
-    }
-    indGloDest = axisDest_->index(iDest);
-    indGloSrc = axisSrc_->index(iSrc);
-    transMap[indGloDest].push_back(indGloSrc);
-    transWeight[indGloDest].push_back(1.0);
-
-  }
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CAxisAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_zoom.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_zoom.hpp	(revision 1975)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*!
-   \file axis_algorithm_zoom.hpp
-   \brief Algorithm for zooming an axis.
- */
-#ifndef __XIOS_AXIS_ALGORITHM_ZOOM_HPP__
-#define __XIOS_AXIS_ALGORITHM_ZOOM_HPP__
-
-#include "axis_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-class CAxis;
-class CZoomAxis;
-
-/*!
-  \class CAxisAlgorithmZoom
-  Implementing zoom on axis
-  A zoomed region can be considered as region that isn't masked.
-  Only this zoomed region is zoomed to write on Netcdf.
-*/
-class CAxisAlgorithmZoom : public CAxisAlgorithmTransformation
-{
-public:
-  CAxisAlgorithmZoom(CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis);
-
-  virtual ~CAxisAlgorithmZoom() {}
-
-  static bool registerTrans();
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-
-private:
-  //! Global zoom begin on axis
-  StdSize zoomBegin_;
-
-  //! Global zoom end on axis
-  StdSize zoomEnd_;
-
-  //! Global zoom size on axis
-  StdSize zoomN_;
-
-  std::vector<int> zoomIndex_;
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CAxis>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_AXIS_ALGORITHM_ZOOM_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_compute_connectivity.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_compute_connectivity.cpp	(revision 1975)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*!
-   \file domain_algorithm_compute_connectivity.cpp
-   \author Ha NGUYEN
-   \since 15 Jul 2016
-   \date 15 Jul 2016
-
-   \brief Algorithm for compute_connectivity on an domain.
- */
-#include "domain_algorithm_compute_connectivity.hpp"
-#include "compute_connectivity_domain.hpp"
-#include "mesh.hpp"
-#include "domain.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CDomainAlgorithmComputeConnectivity::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CDomain>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
-  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
-
-  CComputeConnectivityDomain* compute_connectivityDomain = dynamic_cast<CComputeConnectivityDomain*> (transformation);
-  int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CDomainAlgorithmComputeConnectivity(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], compute_connectivityDomain));
-}
-CATCH
-
-bool CDomainAlgorithmComputeConnectivity::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, create);
-}
-CATCH
-
-CDomainAlgorithmComputeConnectivity::CDomainAlgorithmComputeConnectivity(CDomain* domainDestination, CDomain* domainSource,
-                                                                         CComputeConnectivityDomain* compute_connectivityDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource)
-TRY
-{
-  this->type_ = (ELEMENT_NO_MODIFICATION_WITHOUT_DATA);
-  compute_connectivityDomain->checkValid(domainDestination);
-  int& nbNeighborMax = compute_connectivityDomain->n_neighbor_max;
-  CArray<int,1>& nbNeighbor = compute_connectivityDomain->n_neighbor;
-  CArray<int,2>& localNeighbors = compute_connectivityDomain->local_neighbor;
-  int type = 1; // Edge type
-  switch (compute_connectivityDomain->type)
-  {
-    case CComputeConnectivityDomain::type_attr::node :
-      type = 0;
-      break;
-    case CComputeConnectivityDomain::type_attr::edge :
-      type = 1;
-      break;
-    default:
-      break;
-  }
-
-  computeLocalConnectivity(type, domainDestination, nbNeighborMax, nbNeighbor, localNeighbors);
-}
-CATCH
-
-/*!
- *  Compute local connectivity of a domain
- *  \param[in] type type of connectivity (node or edge)
- *  \param[in] domain domain on which we calculate local connectivity
- *  \param[in/out] nbConnectivityMax maximum number of neighbor a cell of domain has
- *  \param[in/out] nbConnectivity number of neighbor a cell has
- *  \param[in/out] localConnectivity localConnectivity local index of neighbor of a cell
- */
-void CDomainAlgorithmComputeConnectivity::computeLocalConnectivity(int type,
-                                                                  CDomain* domain,
-                                                                  int& nbConnectivityMax,
-                                                                  CArray<int,1>& nbConnectivity,
-                                                                  CArray<int,2>& localConnectivity)
-TRY
-{
-
-  CMesh mesh;
-
-  CArray<double,2>& bounds_lon = domain->bounds_lon_1d;
-  CArray<double,2>& bounds_lat = domain->bounds_lat_1d;
-  int ncell = bounds_lon.shape()[1];
-  CArray<int,1> localIndex(ncell);
-  for (int idx = 0; idx <ncell; ++idx) localIndex(idx) = idx;
-
-  mesh.getLocalNghbFaces(type, localIndex, bounds_lon, bounds_lat, localConnectivity, nbConnectivity);
-  nbConnectivityMax = 0;
-  for (int idx =0; idx < nbConnectivity.numElements(); ++idx)
-    if (nbConnectivityMax < nbConnectivity(idx)) nbConnectivityMax = nbConnectivity(idx);
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CDomainAlgorithmComputeConnectivity::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_compute_connectivity.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_compute_connectivity.hpp	(revision 1975)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*!
-   \file domain_algorithm_compute_connectivity.hpp
-   \author Ha NGUYEN
-   \since 03 June 2015
-   \date 12 June 2015
-
-   \brief Algorithm for compute_connectivitying on an domain.
- */
-#ifndef __XIOS_DOMAIN_ALGORITHM_COMPUTE_CONNECTIVITY_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_COMPUTE_CONNECTIVITY_HPP__
-
-#include "domain_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-class CDomain;
-class CComputeConnectivityDomain;
-
-/*!
-  \class CDomainAlgorithmComputeConnectivity
-*/
-class CDomainAlgorithmComputeConnectivity : public CDomainAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmComputeConnectivity(CDomain* domainDestination, CDomain* domainSource, CComputeConnectivityDomain* compute_connectivityDomain);
-
-  virtual ~CDomainAlgorithmComputeConnectivity() {}
-
-  static bool registerTrans();
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-protected:
-  void computeLocalConnectivity(int type,
-                                CDomain* domain,
-                                int& nbConnectivityMax,
-                                CArray<int,1>& nbConnectivity,
-                                CArray<int,2>& localConnectivity);
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CDomain>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_COMPUTE_CONNECTIVITY_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_expand.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_expand.cpp	(revision 1975)
+++ 	(revision )
@@ -1,713 +1,0 @@
-/*!
-   \file domain_algorithm_expand.cpp
-   \author Ha NGUYEN
-   \since 08 Aug 2016
-   \date 19 Sep 2016
-
-   \brief Algorithm for expanding an domain.
- */
-#include "domain_algorithm_expand.hpp"
-#include "expand_domain.hpp"
-#include "mesh.hpp"
-#include "domain.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "context.hpp"
-#include "context_client.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CDomainAlgorithmExpand::create(CGrid* gridDst, CGrid* gridSrc,
-                                                               CTransformation<CDomain>* transformation,
-                                                               int elementPositionInGrid,
-                                                               std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                               std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                               std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                               std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                               std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                               std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
-  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
-
-  CExpandDomain* expandDomain = dynamic_cast<CExpandDomain*> (transformation);
-  int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CDomainAlgorithmExpand(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], expandDomain));
-}
-CATCH
-
-bool CDomainAlgorithmExpand::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_EXPAND_DOMAIN, create);
-}
-CATCH
-
-CDomainAlgorithmExpand::CDomainAlgorithmExpand(CDomain* domainDestination,
-                                               CDomain* domainSource,
-                                               CExpandDomain* expandDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource),
-  isXPeriodic_(false), isYPeriodic_(false)
-TRY
-{
-  if (domainDestination == domainSource)
-  {
-    ERROR("CDomainAlgorithmExpand::CDomainAlgorithmExpand(CDomain* domainDestination,CDomain* domainSource, CExpandDomain* expandDomain)",
-           << "Domain source and domain destination are the same. Please make sure domain destination refers to domain source" << std::endl
-           << "Domain source " <<domainSource->getId() << std::endl
-           << "Domain destination " <<domainDestination->getId() << std::endl);
-  }
-
-  this->type_ = (ELEMENT_MODIFICATION_WITH_DATA);
-  // Make sure domain source have all valid attributes
-  // domainSource->checkAllAttributes();
-  expandDomain->checkValid(domainDestination);
-  if (!expandDomain->i_periodic.isEmpty()) isXPeriodic_ = expandDomain->i_periodic;
-  if (!expandDomain->j_periodic.isEmpty()) isYPeriodic_ = expandDomain->j_periodic;
-  
-  switch (expandDomain->type)
-  {
-    case CExpandDomain::type_attr::node :
-      expandDomainNodeConnectivity(domainDestination,
-                                   domainSource);
-      break;
-    case CExpandDomain::type_attr::edge :
-      expandDomainEdgeConnectivity(domainDestination,
-                                   domainSource);
-      break;
-    default:
-      break;
-  }
-}
-CATCH
-
-/*!
- *  Expand domain with edge-type neighbor
- *  \param[in/out] domainDestination domain destination and will be modified
- *  \param[in] domainSource domain source
- */
-void CDomainAlgorithmExpand::expandDomainEdgeConnectivity(CDomain* domainDestination,
-                                                          CDomain* domainSource)
-TRY
-{
-  CContext* context = CContext::getCurrent();
- 
-  int type = 1; // For edge
-  CMesh mesh;
-  CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d;
-  CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d;
-  CArray<int,2> neighborsSrc;
-  switch (domainSource->type) {
-   case CDomain::type_attr::unstructured:      
-      mesh.getGlobalNghbFaces(type, context->intraComm_, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc);
-      updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc);
-      break;
-   default:
-      updateRectilinearDomainAttributes(domainDestination, domainSource, neighborsSrc);
-      break;      
-  }  
-}
-CATCH
-
-/*!
- *  Expand domain with node-type neighbor
- *  \param[in/out] domainDestination domain destination and will be modified
- *  \param[in] domainSource domain source
- */
-void CDomainAlgorithmExpand::expandDomainNodeConnectivity(CDomain* domainDestination,
-                                                          CDomain* domainSource)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-
-  int type = 1; // For edge
-  CMesh mesh;
-  CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d;
-  CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d;
-  CArray<int,2> neighborsSrc;
-  switch (domainSource->type) {
-   case CDomain::type_attr::unstructured:      
-      mesh.getGlobalNghbFaces(type, context->intraComm_, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc);
-      updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc);
-      break;
-   default:
-      updateRectilinearDomainAttributes(domainDestination, domainSource, neighborsSrc);
-      break;      
-  }  
-}
-CATCH
-
-/*!
- *  Extend rectilinear or curvilinear domain destination and update its attributes
- *  Suppose that domain destination and domain source have the same values for all attributes (by inheritance)
- *  \param [in/out] domainDestination domain destination
- *  \param [in] domainSource domain source
- *  \param [in] neighborsDomainSrc neighbor of domain source. For now, we don't need it for rectilinear
- */
-void CDomainAlgorithmExpand::updateRectilinearDomainAttributes(CDomain* domainDestination,
-                                                               CDomain* domainSource,
-                                                               CArray<int,2>& neighborsDomainSrc)
-TRY
-{
-  int index, globalIndex, idx;
-  int iindexDst, jindexDst, globIndexDst;
-  int iindexSrc, jindexSrc, globIndexSrc;
-  CContext* context = CContext::getCurrent();
-
-  // First of all, "copy" all attributes of domain source to domain destination
-  StdString domainDstRef = (!domainDestination->domain_ref.isEmpty()) ? domainDestination->domain_ref.getValue()
-                                                                      : "";
-  if (domainDstRef != domainSource->getId())
-  {
-    domainDestination->domain_ref.setValue(domainSource->getId());
-    domainDestination->solveRefInheritance(true);
-  }
-
-  if (domainDstRef.empty()) domainDestination->domain_ref.reset();
-  else domainDestination->domain_ref.setValue(domainDstRef);
-
-  
-  // Here are attributes of source need tranfering
-  int niGloSrc = domainSource->ni_glo;
-  int njGloSrc = domainSource->nj_glo;
-  int niSrc = domainSource->ni, ibegin = domainSource->ibegin;
-  int njSrc = domainSource->nj, jbegin = domainSource->jbegin;
-  int dataDimSrc = domainSource->data_dim;
-  CArray<bool,1>& mask_1d_src = domainSource->domainMask;
-  CArray<int,1>& i_index_src = domainSource->i_index;
-  CArray<int,1>& j_index_src = domainSource->j_index;
-  CArray<int,1>& data_i_index_src = domainSource->data_i_index;
-  CArray<int,1>& data_j_index_src = domainSource->data_j_index;
-  int data_i_begin_src = domainSource->data_ibegin;
-  int data_j_begin_src = domainSource->data_jbegin;
-  CArray<double,1>& lon_src = domainSource->lonvalue;
-  CArray<double,1>& lat_src = domainSource->latvalue;
-
-  // We need to generate boundary for longitude and latitude
-  if (domainSource->bounds_lon_1d.isEmpty() || domainSource->bounds_lat_1d.isEmpty())
-  {
-    CArray<double,1> lon = lon_src(Range(0,niSrc-1));
-    CArray<double,1> lat = lat_src(Range(0,lat_src.numElements()-niSrc,niSrc));
-    CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d;
-    CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d;
-    domainSource->fillInRectilinearBoundLonLat(lon_src, lat_src, bounds_lon_src, bounds_lat_src);
-  }
-
-
-  CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d;
-  CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d;
-
-  int nVertex       = bounds_lon_src.shape()[0];
-  int oldNbLocal = i_index_src.numElements();
-  // Calculate ni, nj by using i_index and j_index
-  int niSrcByIndex = max(i_index_src) - min(i_index_src) + 1;
-  int njSrcByIndex = max(j_index_src) - min(j_index_src) + 1;  
-  int dataIindexBoundSrc = (1 == dataDimSrc) ? (niSrcByIndex * njSrcByIndex) : niSrcByIndex;
-  int dataJindexBoundSrc = (1 == dataDimSrc) ? (niSrcByIndex * njSrcByIndex) : njSrcByIndex;
-
-  // Uncompress data_i_index, data_j_index
-  CArray<int,1> data_i_index_src_full(oldNbLocal);
-  CArray<int,1> data_j_index_src_full(oldNbLocal);
-  int nbUnMaskedPointOnLocalDomain = 0;
-  data_i_index_src_full = -1; // Suppose all values are masked
-  data_j_index_src_full = -1; // Suppose all values are masked
-  for (idx = 0; idx < data_i_index_src.numElements(); ++idx)
-  {
-    int dataIidx = data_i_index_src(idx) + data_i_begin_src;
-    int dataJidx = data_j_index_src(idx) + data_j_begin_src;
-    if ((0 <= dataIidx) && (dataIidx < dataIindexBoundSrc) &&
-        (0 <= dataJidx) && (dataJidx < dataJindexBoundSrc))
-    {
-      data_i_index_src_full(nbUnMaskedPointOnLocalDomain) = dataIidx;
-      data_j_index_src_full(nbUnMaskedPointOnLocalDomain) = dataJidx;
-      ++nbUnMaskedPointOnLocalDomain;
-    }
-  }
-
-  // Expand domain destination, not only local but also global
-  int niGloDst = niGloSrc + 2;
-  int njGloDst = njGloSrc + 2;
-  int niDst = niSrc + 2;
-  int njDst = njSrc + 2;
-  domainDestination->ni_glo.setValue(niGloDst);
-  domainDestination->nj_glo.setValue(njGloDst);
-  domainDestination->ni.setValue(niDst);
-  domainDestination->nj.setValue(njDst);
-
-  CArray<bool,1>& mask_1d_dst = domainDestination->domainMask;
-  CArray<int,1>& i_index_dst  = domainDestination->i_index;
-  CArray<int,1>& j_index_dst  = domainDestination->j_index;  
-  CArray<int,1>& data_i_index_dst  = domainDestination->data_i_index;
-  CArray<int,1>& data_j_index_dst  = domainDestination->data_j_index;
-  
-  // Make sure that we use only lonvalue_client, latvalue_client
-  if (!domainDestination->lonvalue_1d.isEmpty()) domainDestination->lonvalue_1d.reset();
-  if (!domainDestination->latvalue_1d.isEmpty()) domainDestination->latvalue_1d.reset();
-  if (!domainDestination->lonvalue_2d.isEmpty()) domainDestination->lonvalue_2d.reset();
-  if (!domainDestination->latvalue_2d.isEmpty()) domainDestination->latvalue_2d.reset();
-
-  // Recalculate i_index, j_index of extended domain
-  // Should be enough for common case, but if we have arbitrary distribution?
-  int newNbLocalDst = niDst * njDst;     
-
-  mask_1d_dst.resize(newNbLocalDst);
-  i_index_dst.resize(newNbLocalDst);
-  j_index_dst.resize(newNbLocalDst);
-  CArray<int,1> data_i_index_dst_full(newNbLocalDst);
-  CArray<int,1> data_j_index_dst_full(newNbLocalDst);
-
-  if (newNbLocalDst==0)
-  {
-    domainDestination->lonvalue.resize(newNbLocalDst);
-    domainDestination->latvalue.resize(newNbLocalDst);
-    domainDestination->bounds_lon_1d.resize(nVertex, newNbLocalDst);
-    domainDestination->bounds_lat_1d.resize(nVertex, newNbLocalDst);
-  }
-  else 
-  {
-    domainDestination->lonvalue.resizeAndPreserve(newNbLocalDst);
-    domainDestination->latvalue.resizeAndPreserve(newNbLocalDst);
-    domainDestination->bounds_lon_1d.resizeAndPreserve(nVertex, newNbLocalDst);
-    domainDestination->bounds_lat_1d.resizeAndPreserve(nVertex, newNbLocalDst);
-  }
-  CArray<double,1>& lon_dst   = domainDestination->lonvalue;
-  CArray<double,1>& lat_dst   = domainDestination->latvalue;
-  CArray<double,2>& bounds_lon_dst = domainDestination->bounds_lon_1d;
-  CArray<double,2>& bounds_lat_dst = domainDestination->bounds_lat_1d;
-
-  // Update i_index, j_index
-  for (int j = 0; j < njDst; ++j)
-    for (int i = 0; i < niDst; ++i)
-    {
-      idx = j * niDst + i; 
-      i_index_dst(idx) = i + ibegin;
-      j_index_dst(idx) = j + jbegin;
-    }
- 
-
-  // 1. Fill in array relating to global index (i_index, j_index, transmap, etc, ...)
-  // Global index mapping between destination and source
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  transMap.rehash(std::ceil(newNbLocalDst/transMap.max_load_factor()));
-  transWeight.rehash(std::ceil(newNbLocalDst/transWeight.max_load_factor()));
-  
-  // Index mapping for local domain
-  // Mapping global index of expanded domain into original one 
-  // (Representing global index of expanded domain in form of global index of original one)
-  CArray<size_t,1> globalIndexSrcOnDstDomain(newNbLocalDst); 
-  for (idx = 0; idx < newNbLocalDst; ++idx)
-  {
-    iindexDst = i_index_dst(idx);
-    jindexDst = j_index_dst(idx);
-    globIndexDst = jindexDst * niGloDst + iindexDst;
-    globIndexSrc = (((jindexDst-1)+njGloSrc) % njGloSrc) * niGloSrc + (((iindexDst-1)+niGloSrc) % niGloSrc) ;
-    globalIndexSrcOnDstDomain(idx) = globIndexSrc;
-
-    transMap[globIndexDst].push_back(globIndexSrc);
-    transWeight[globIndexDst].push_back(1.0); 
-  }
-
-  // 2. Exchange local info among domains (lon,lat,bounds,mask,etc,...)
-  CClientClientDHTDouble::Index2VectorInfoTypeMap localData;
-  localData.rehash(std::ceil(oldNbLocal/localData.max_load_factor()));
-
-  // Information exchanged among domains (attention to their order), number in parentheses presents size of data
-  // lon(1) + lat(1) + bounds_lon(nVertex) + bounds_lat(nVertex) + mask(1) + data_i_index(1)
-  int dataPackageSize =  1 + 1 + // lon + lat
-                         nVertex + nVertex + //bounds_lon + bounds_lat
-                         1 + // mask_1d_dst;
-                         1 + 1; // data_i_index + data_j_index
-  // Initialize database
-  for (int idx = 0; idx < oldNbLocal; ++idx)
-  {
-    index = i_index_src(idx) + j_index_src(idx) * niGloSrc;
-    localData[index].resize(dataPackageSize);
-    std::vector<double>& data = localData[index];
-
-    //Pack data
-    int dataIdx = 0;
-    data[dataIdx] = lon_src(idx);++dataIdx;
-    data[dataIdx] = lat_src(idx);++dataIdx;
-    for (int i = 0; i < nVertex; ++i)
-    {
-      data[dataIdx] = bounds_lon_src(i,idx); ++dataIdx;
-    }
-    for (int i = 0; i < nVertex; ++i)
-    {
-      data[dataIdx] = bounds_lat_src(i,idx); ++dataIdx;
-    }
-    data[dataIdx] = mask_1d_src(idx) ? 1.0 : -1.0; ++dataIdx;
-    data[dataIdx] = data_i_index_src_full(idx);++dataIdx;
-    data[dataIdx] = data_j_index_src_full(idx);
-  }
-
-  CClientClientDHTDouble dhtData(localData,context->intraComm_);
-  dhtData.computeIndexInfoMapping(globalIndexSrcOnDstDomain);
-  CClientClientDHTDouble::Index2VectorInfoTypeMap& neighborData = dhtData.getInfoIndexMap();
-  CClientClientDHTDouble::Index2VectorInfoTypeMap::iterator ite = neighborData.end(), it;
-
-  // Ok get all data for destination
-  // If domain is not periodic, then we mask all extended part.
-  int nbUnMaskedPointOnExtendedPart = 0, remainder = 0, dataIIndex, dataJIndex;
-  size_t nIdx;
-  double maskValue = 1.0;
-  for (index = 0; index < newNbLocalDst; ++index)
-  {
-     nIdx = globalIndexSrcOnDstDomain(index);
-     it = neighborData.find(nIdx);
-     if (ite != it)
-     {
-        std::vector<double>& data = it->second;
-        // Unpack data
-        int dataIdx = 0;
-        lon_dst(index) = data[dataIdx]; ++dataIdx;
-        lat_dst(index) = data[dataIdx]; ++dataIdx;
-        for (int i = 0; i < nVertex; ++i)
-        {
-          bounds_lon_dst(i,index) = data[dataIdx]; ++dataIdx;
-        }
-        for (int i = 0; i < nVertex; ++i)
-        {
-          bounds_lat_dst(i,index) = data[dataIdx]; ++dataIdx;
-        }
-        
-        // Check whether we have x periodic. If we don't, we should mask all point at 0 and niGloDst-1
-        maskValue = data[dataIdx];
-        if (!isXPeriodic_) 
-        {
-          remainder = i_index_dst(index) % (niGloDst-1);
-          if (0 == remainder) 
-          {
-            maskValue = -1.0;
-          }
-        }
-
-        if (!isYPeriodic_) 
-        {
-          remainder = j_index_dst(index) % (njGloDst-1);
-          if (0 == remainder) 
-          {
-            maskValue = -1.0;
-          }
-        }
-
-        mask_1d_dst(index) = (1.0 == maskValue) ? true : false; ++dataIdx;
-
-        dataIIndex = (int) data[dataIdx];
-        if (!isXPeriodic_) 
-        {
-          remainder = i_index_dst(index) % (niGloDst-1);
-          if (0 == remainder) 
-          {
-            dataIIndex = -1;
-          }
-        }
-        data_i_index_dst_full(index) = dataIIndex; ++dataIdx;
-        
-        dataJIndex = (int) data[dataIdx];
-        if (!isYPeriodic_) 
-        {
-          remainder = j_index_dst(index) % (njGloDst-1);
-          if (0 == remainder) 
-          {
-            dataJIndex = -1;
-          }
-        }        
-        data_j_index_dst_full(index) = dataJIndex;
-
-        if ((0 <= data_i_index_dst_full(index)) && (0 <= data_j_index_dst_full(index)))
-        {
-          ++nbUnMaskedPointOnExtendedPart;
-        }
-     }
-  }
-
-  
-  // Finally, update data_i_index, data_j_index
-  int dataDstDim = domainDestination->data_dim;
-  data_i_index_dst.resize(nbUnMaskedPointOnExtendedPart);
-  data_j_index_dst.resize(nbUnMaskedPointOnExtendedPart); 
-  int count = 0; 
-  for (idx = 0; idx < newNbLocalDst; ++idx)
-  {
-    dataIIndex = data_i_index_dst_full(idx);
-    dataJIndex = data_j_index_dst_full(idx);
-    if ((0 <= dataIIndex) && (0 <= dataJIndex))
-    {
-      data_i_index_dst(count) = (1 == dataDstDim) ? idx : i_index_dst(idx) - i_index_dst(0);
-      data_j_index_dst(count) = (1 == dataDstDim) ? 0   : j_index_dst(idx) - j_index_dst(0);
-      ++count;
-    }
-  }
-
-  // Update data_ni, data_nj
-  
-  domainDestination->data_ni.setValue((1==dataDstDim) ? niDst * njDst : niDst);
-  domainDestination->data_nj.setValue((1==dataDstDim) ? niDst * njDst : njDst);  
-  domainDestination->data_ibegin.setValue(0);
-  domainDestination->data_jbegin.setValue(0);
-
-  // Update longitude and latitude 
-  if (niSrc == domainSource->lonvalue_1d.numElements() && njSrc == domainSource->latvalue_1d.numElements()) // Ok, we have rectilinear here
-  {
-     domainDestination->lonvalue_1d.resize(niDst);
-     domainDestination->lonvalue_1d = lon_dst(Range(0,niDst-1));
-     domainDestination->latvalue_1d.resize(njDst);
-     domainDestination->latvalue_1d = lat_dst(Range(0,lat_dst.numElements()-niDst,niDst));
-  }
-  else // It should be curvilinear
-  {
-     domainDestination->lonvalue_1d.resize(lon_dst.numElements());
-     domainDestination->lonvalue_1d = lon_dst;
-     domainDestination->latvalue_1d.resize(lat_dst.numElements());
-     domainDestination->latvalue_1d = (lat_dst);
-  }
-   domainDestination->mask_1d.resize(domainDestination->domainMask.numElements()) ;
-   domainDestination->mask_1d=domainDestination->domainMask ;
-   domainDestination->computeLocalMask() ;
-}
-CATCH
-
-/*!
- *  Extend domain destination and update its attributes
- *  Suppose that domain destination and domain source have the same values for all attributes (by inheritance)
- *  \param [in/out] domainDestination domain destination
- *  \param [in] domainSource domain source
- *  \param [in] neighborsDomainSrc domain extended part
- */
-void CDomainAlgorithmExpand::updateUnstructuredDomainAttributes(CDomain* domainDestination,
-                                                                CDomain* domainSource,
-                                                                CArray<int,2>& neighborsDomainSrc)
-TRY
-{
-
-  CContext* context = CContext::getCurrent();
-
-  // First of all, "copy" all attributes of domain source to domain destination
-  StdString domainDstRef = (!domainDestination->domain_ref.isEmpty()) ? domainDestination->domain_ref.getValue()
-                                                                      : "";
-  if (domainDstRef != domainSource->getId())
-  {
-    domainDestination->domain_ref.setValue(domainSource->getId());
-    domainDestination->solveRefInheritance(true);
-  }
-
-  if (domainDstRef.empty()) domainDestination->domain_ref.reset();
-  else domainDestination->domain_ref.setValue(domainDstRef);
-
-  // Now extend domain destination
-  int niGlob = domainSource->ni_glo;
-  CArray<bool,1>& mask_1d_src = domainSource->domainMask;
-  CArray<int,1>& i_index_src = domainSource->i_index;
-  CArray<double,1>& lon_src = domainSource->lonvalue_1d;
-  CArray<double,1>& lat_src = domainSource->latvalue_1d;
-  CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d;
-  CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d;
-  CArray<int,1>& data_i_index_src = domainSource->data_i_index;
-
-  int oldNbLocal = i_index_src.numElements(), index, globalIndex;
-  // Uncompress data_i_index
-  CArray<int,1> data_i_index_src_full(oldNbLocal);
-  int nbUnMaskedPointOnLocalDomain = 0;
-  data_i_index_src_full = -1; // Suppose all values are masked
-  for (int idx = 0; idx < data_i_index_src.numElements(); ++idx)
-  {
-    int dataIdx = data_i_index_src(idx);
-    if ((0 <= dataIdx) && (dataIdx < oldNbLocal))
-    {
-      data_i_index_src_full(nbUnMaskedPointOnLocalDomain) = dataIdx;
-      ++nbUnMaskedPointOnLocalDomain;
-    }
-  }
-
-  CArray<bool,1>& mask_1d_dst = domainDestination->domainMask;
-  CArray<int,1>& i_index_dst = domainDestination->i_index;
-  CArray<int,1>& j_index_dst = domainDestination->j_index;
-  CArray<double,1>& lon_dst = domainDestination->lonvalue_1d;
-  CArray<double,1>& lat_dst = domainDestination->latvalue_1d;
-  CArray<double,2>& bounds_lon_dst = domainDestination->bounds_lon_1d;
-  CArray<double,2>& bounds_lat_dst = domainDestination->bounds_lat_1d;
-  CArray<int,1>& data_i_index_dst = domainDestination->data_i_index;
-  CArray<int,1>& data_j_index_dst = domainDestination->data_j_index;
-
-  // Resize all array-like attributes of domain destination
-  int nbNeighbor    = neighborsDomainSrc.shape()[1];
-  int newNbLocalDst = nbNeighbor + oldNbLocal;
-  int nVertex       = bounds_lon_dst.shape()[0];
-
-  if (newNbLocalDst==0)
-  {
-    mask_1d_dst.resize(newNbLocalDst);
-    i_index_dst.resize(newNbLocalDst);
-    j_index_dst.resize(newNbLocalDst);
-    lon_dst.resize(newNbLocalDst);
-    lat_dst.resize(newNbLocalDst);
-    bounds_lon_dst.resize(nVertex, newNbLocalDst);
-    bounds_lat_dst.resize(nVertex, newNbLocalDst);
-  }
-  else
-  {
-    mask_1d_dst.resizeAndPreserve(newNbLocalDst);
-    i_index_dst.resizeAndPreserve(newNbLocalDst);
-    j_index_dst.resizeAndPreserve(newNbLocalDst);
-    lon_dst.resizeAndPreserve(newNbLocalDst);
-    lat_dst.resizeAndPreserve(newNbLocalDst);
-    bounds_lon_dst.resizeAndPreserve(nVertex, newNbLocalDst);
-    bounds_lat_dst.resizeAndPreserve(nVertex, newNbLocalDst);
-  }
-  CArray<int,1> data_i_index_dst_full(newNbLocalDst);
-  data_i_index_dst_full(Range(0,oldNbLocal-1)) = data_i_index_src_full;
-  data_i_index_dst_full(Range(oldNbLocal,newNbLocalDst-1)) = -1;
-
-  // 1. Fill in array relating to global index (i_index, j_index, transmap, etc, ...)
-  // Global index mapping between destination and source
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  transMap.rehash(std::ceil(newNbLocalDst/transMap.max_load_factor()));
-  transWeight.rehash(std::ceil(newNbLocalDst/transWeight.max_load_factor()));
-  // First, index mapping for local domain
-  for (int idx = 0; idx < oldNbLocal; ++idx)
-  {
-    index = i_index_dst(idx);
-    transMap[index].push_back(index);
-    transWeight[index].push_back(1.0);
-  }
-  // Then, index mapping for extended part
-  for (int idx = 0; idx < nbNeighbor; ++idx)
-  {
-    index = idx + oldNbLocal;
-    globalIndex = neighborsDomainSrc(0,idx);
-    i_index_dst(index) = globalIndex;
-    j_index_dst(index) = 0;
-    transMap[globalIndex].push_back(globalIndex);
-    transWeight[globalIndex].push_back(1.0);
-  }
-
-  // 2. Exchange local info among domains (lon,lat,bounds,mask,etc,...)
-  CClientClientDHTDouble::Index2VectorInfoTypeMap localData;
-  localData.rehash(std::ceil(oldNbLocal/localData.max_load_factor()));
-  // Information exchanged among domains (attention to their order), number in parentheses presents size of data
-  // lon(1) + lat(1) + bounds_lon(nVertex) + bounds_lat(nVertex) + mask(1) + data_i_index(1)
-  int dataPackageSize =  1 + 1 + // lon + lat
-                         nVertex + nVertex + //bounds_lon + bounds_lat
-                         1 + // mask_1d_dst;
-                         1; // data_i_index
-  // Initialize database
-  for (int idx = 0; idx < oldNbLocal; ++idx)
-  {
-    index = i_index_src(idx);
-    localData[index].resize(dataPackageSize);
-    std::vector<double>& data = localData[index];
-
-    //Pack data
-    int dataIdx = 0;
-    data[dataIdx] = lon_src(idx);++dataIdx;
-    data[dataIdx] = lat_src(idx);++dataIdx;
-    for (int i = 0; i < nVertex; ++i)
-    {
-      data[dataIdx] = bounds_lon_src(i,idx); ++dataIdx;
-    }
-    for (int i = 0; i < nVertex; ++i)
-    {
-      data[dataIdx] = bounds_lat_src(i,idx); ++dataIdx;
-    }
-    data[dataIdx] = mask_1d_src(idx) ? 1.0 : -1.0; ++dataIdx;
-    data[dataIdx] = data_i_index_src_full(idx);
-  }
-
-  CClientClientDHTDouble dhtData(localData, context->intraComm_);
-  CArray<size_t,1> neighborInd(nbNeighbor);
-  for (int idx = 0; idx < nbNeighbor; ++idx)
-    neighborInd(idx) = neighborsDomainSrc(0,idx);
-
-  // Compute local data on other domains
-  dhtData.computeIndexInfoMapping(neighborInd);
-  CClientClientDHTDouble::Index2VectorInfoTypeMap& neighborData = dhtData.getInfoIndexMap();
-  CClientClientDHTDouble::Index2VectorInfoTypeMap::iterator ite = neighborData.end(), it;
-  // Ok get neighbor data
-  size_t nIdx;
-  int nbUnMaskedPointOnExtendedPart = 0;
-  for (int idx = 0; idx < nbNeighbor; ++idx)
-  {
-    nIdx  = neighborInd(idx);
-    it = neighborData.find(nIdx);
-    if (ite != it)
-    {
-      index = idx + oldNbLocal;
-      std::vector<double>& data = it->second;
-      // Unpack data
-      int dataIdx = 0;
-      lon_dst(index) = data[dataIdx]; ++dataIdx;
-      lat_dst(index) = data[dataIdx]; ++dataIdx;
-      for (int i = 0; i < nVertex; ++i)
-      {
-        bounds_lon_dst(i,index) = data[dataIdx]; ++dataIdx;
-      }
-      for (int i = 0; i < nVertex; ++i)
-      {
-        bounds_lat_dst(i,index) = data[dataIdx]; ++dataIdx;
-      }
-      mask_1d_dst(index) = (1.0 == data[dataIdx]) ? true : false; ++dataIdx;
-      data_i_index_dst_full(index) = (int)(data[dataIdx]);
-      if (0 <= data_i_index_dst_full(index))
-      {
-        data_i_index_dst_full(index) = index;
-        ++nbUnMaskedPointOnExtendedPart;
-      }
-    }
-  }
-
-
-  // Finally, update data_i_index
-  int nbUnMaskedPointOnNewDstDomain = (nbUnMaskedPointOnExtendedPart + nbUnMaskedPointOnLocalDomain);
-  int count = 0, dataIdx;
-  for (int idx = 0; idx < newNbLocalDst; ++idx)
-  {
-    dataIdx = data_i_index_dst_full(idx);
-    if ((0 <= dataIdx))
-    {
-      ++count;
-    }
-  }
-
-  data_i_index_dst.resize(count);
-  data_j_index_dst.resize(count);
-  data_j_index_dst = 0;
-
-  count = 0;
-  for (int idx = 0; idx < newNbLocalDst; ++idx)
-  {
-    dataIdx = data_i_index_dst_full(idx);
-    if ((0 <= dataIdx))
-    {
-      data_i_index_dst(count) = dataIdx;
-      ++count;
-    }
-  }
-
-  // Update ni
-  domainDestination->ni.setValue(newNbLocalDst);
-  domainDestination->mask_1d.resize(domainDestination->domainMask.numElements()) ;
-  domainDestination->mask_1d=domainDestination->domainMask ;
-  domainDestination->computeLocalMask() ;
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CDomainAlgorithmExpand::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-
-}
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_expand.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_expand.hpp	(revision 1975)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*!
-   \file domain_algorithm_expand.hpp
-   \author Ha NGUYEN
-   \since 08 Aug 2016
-   \date 08 Aug 2016
-
-   \brief Algorithm for expanding an domain.
- */
-#ifndef __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__
-
-#include "domain_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-class CDomain;
-class CExpandDomain;
-
-/*!
-  \class CDomainAlgorithmExpand
-*/
-class CDomainAlgorithmExpand : public CDomainAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmExpand(CDomain* domainDestination, CDomain* domainSource, CExpandDomain* expandDomain);
-
-  virtual ~CDomainAlgorithmExpand() {}
-
-  static bool registerTrans();
-
-protected:
-  bool isXPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear)
-  bool isYPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear)
-
-protected:
-  void expandDomainEdgeConnectivity(CDomain* domainDestination, CDomain* domainSource);
-  void expandDomainNodeConnectivity(CDomain* domainDestination, CDomain* domainSource);
-  void updateRectilinearDomainAttributes(CDomain* domainDestination,
-                                         CDomain* domainSource,
-                                         CArray<int,2>& neighborsDomainSrc);
-
-  void updateUnstructuredDomainAttributes(CDomain* domainDestination,
-                                          CDomain* domainSource,
-                                          CArray<int,2>& neighborsDomainSrc);
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CDomain>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_extract.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_extract.cpp	(revision 1975)
+++ 	(revision )
@@ -1,237 +1,0 @@
-#include "domain_algorithm_extract.hpp"
-#include "extract_domain.hpp"
-#include "domain.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "attribute_template.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CDomainAlgorithmExtract::create(CGrid* gridDst, CGrid* gridSrc,
-                                                             CTransformation<CDomain>* transformation,
-                                                             int elementPositionInGrid,
-                                                             std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                             std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                             std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
-  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
-
-  CExtractDomain* extractDomain = dynamic_cast<CExtractDomain*> (transformation);
-  int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CDomainAlgorithmExtract(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], extractDomain));
-}
-CATCH
-
-bool CDomainAlgorithmExtract::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_EXTRACT_DOMAIN, create);
-}
-CATCH
-
-CDomainAlgorithmExtract::CDomainAlgorithmExtract(CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource)
-TRY
-{
-  extractDomain->checkValid(domainSource);
-  extractIBegin_ = extractDomain->ibegin.getValue();
-  extractJBegin_ = extractDomain->jbegin.getValue();
-
-  extractNi_  = extractDomain->ni.getValue();
-  extractNj_  = extractDomain->nj.getValue();
-
-  extractIEnd_ = extractIBegin_ + extractNi_ - 1;
-  extractJEnd_ = extractJBegin_ + extractNj_ - 1;
-
-  if (extractNi_ > domainSource->ni_glo.getValue())
-  {
-    ERROR("CDomainAlgorithmExtract::CDomainAlgorithmExtract(CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain)",
-           << "Extract size is greater than size of domain source"
-           << "Size ni_glo of domain source " <<domainSource->getId() << " is " << domainSource->ni_glo.getValue()  << std::endl
-           << "Extract size is " << extractNi_ );
-  }
-
-  if (extractNj_ > domainSource->nj_glo.getValue())
-  {
-    ERROR("CDomainAlgorithmExtract::CDomainAlgorithmExtract(CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain)",
-           << "Extract size is greater than size of domain source"
-           << "Size nj_glo of domain source " <<domainSource->getId() << " is " << domainSource->nj_glo.getValue()  << std::endl
-           << "Extract size is " << extractNj_ );
-  }
-
-  // Calculate the size of local domain
-  int ind, indLocSrc, indLocDest, iIdxSrc, jIdxSrc, destIBegin = -1, destJBegin = -1, niDest = 0, njDest = 0, ibeginDest, jbeginDest ;
-  int indGloDest, indGloSrc, niGloSrc = domainSrc_->ni_glo, iSrc, jSrc;
-  for (int j = 0; j < domainSrc_->nj.getValue(); j++)
-  {
-    for (int i = 0; i < domainSrc_->ni.getValue(); i++)
-    {
-      ind = j*domainSrc_->ni + i;
-      iIdxSrc = domainSrc_->i_index(ind);
-      if ((iIdxSrc >= extractIBegin_) && (iIdxSrc <= extractIEnd_))
-      {
-        jIdxSrc = domainSrc_->j_index(ind);
-        if ((jIdxSrc >= extractJBegin_) && (jIdxSrc <= extractJEnd_))
-        {
-          if ((niDest == 0) && (njDest == 0))
-          {
-            destIBegin = i;
-            destJBegin = j;
-          }
-          if (i == destIBegin) ++njDest;
-        }
-        if (j == destJBegin) ++niDest;
-
-      }
-    }
-  }
-  ibeginDest = destIBegin + domainSrc_->ibegin - extractIBegin_;
-  jbeginDest = destJBegin + domainSrc_->jbegin - extractJBegin_;
-  domainDest_->ni_glo.setValue(extractNi_);
-  domainDest_->nj_glo.setValue(extractNj_);
-  domainDest_->ni.setValue(niDest);
-  domainDest_->nj.setValue(njDest);
-  domainDest_->ibegin.setValue(ibeginDest);
-  domainDest_->jbegin.setValue(jbeginDest);
-  domainDest_->i_index.resize(niDest*njDest);
-  domainDest_->j_index.resize(niDest*njDest);
-
-  domainDest_->data_ni.setValue(niDest);
-  domainDest_->data_nj.setValue(njDest);
-  domainDest_->data_ibegin.setValue(0);  // local position
-  domainDest_->data_jbegin.setValue(0);  // local position
-  domainDest_->data_i_index.resize(niDest*njDest); // local position
-  domainDest_->data_j_index.resize(niDest*njDest); // local position
-
-  domainDest_->domainMask.resize(niDest*njDest);
-
-  if (!domainSrc_->lonvalue_1d.isEmpty())
-  {
-    if (domainDest_->type == CDomain::type_attr::rectilinear)
-    {
-      domainDest_->lonvalue_1d.resize(niDest);
-      domainDest_->latvalue_1d.resize(njDest);
-    }
-    else if (domainDest_->type == CDomain::type_attr::unstructured)
-    {
-      domainDest_->lonvalue_1d.resize(niDest);
-      domainDest_->latvalue_1d.resize(niDest);
-    }
-  }
-  else if (!domainSrc_->lonvalue_2d.isEmpty())
-  {
-    domainDest_->lonvalue_2d.resize(niDest,njDest);
-    domainDest_->latvalue_2d.resize(niDest,njDest);
-  }
-
-  if (domainSrc_->hasBounds)
-  {
-    if (!domainSrc_->bounds_lon_2d.isEmpty())
-    {
-      domainDest_->bounds_lon_2d.resize(domainDest_->nvertex, niDest, njDest);
-      domainDest_->bounds_lon_2d.resize(domainDest_->nvertex, niDest, njDest);
-    }
-    else if (!domainSrc_->bounds_lon_1d.isEmpty())
-    {
-      domainDest_->bounds_lon_1d.resize(domainDest_->nvertex, niDest);
-      domainDest_->bounds_lon_1d.resize(domainDest_->nvertex, niDest);
-    }
-  }
-  if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest);
-
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  for (int iDest = 0; iDest < niDest; iDest++)
-  {
-    iSrc = iDest + destIBegin;
-    for (int jDest = 0; jDest < njDest; jDest++)
-    {
-      jSrc = jDest + destJBegin;
-      ind = jSrc * domainSrc_->ni + iSrc;
-      iIdxSrc = domainSrc_->i_index(ind);
-      jIdxSrc = domainSrc_->j_index(ind);
-      indLocDest = jDest*niDest + iDest;
-      indGloDest = (jDest + jbeginDest)*extractNi_ + (iDest + ibeginDest);
-      indLocSrc = (jDest+destJBegin)*domainSrc_->ni + (iDest+destIBegin);
-      indGloSrc = (jIdxSrc )* niGloSrc + iIdxSrc;
-      domainDest_->i_index(indLocDest) = iDest + ibeginDest;                                             // i_index contains global positions
-      domainDest_->j_index(indLocDest) = jDest + jbeginDest;                                             // i_index contains global positions
-      domainDest_->data_i_index(indLocDest) = (domainSrc_->data_dim == 1) ? indLocDest : iDest;          // data_i_index contains local positions
-      domainDest_->data_j_index(indLocDest) = (domainSrc_->data_dim == 1) ? 0 :jDest;                    // data_i_index contains local positions
-      domainDest_->domainMask(indLocDest) = domainSrc_->domainMask(indLocSrc);
-
-      if (domainSrc_->hasArea)
-        domainDest_->area(iDest,jDest) = domainSrc_->area(iSrc,jSrc);
-
-      if (domainSrc_->hasBounds)
-      {
-        if (!domainSrc_->bounds_lon_2d.isEmpty())
-        {
-          for (int n = 0; n < domainSrc_->nvertex; ++n)
-          {
-            domainDest_->bounds_lon_2d(n,iDest,jDest) = domainSrc_->bounds_lon_2d(n,iSrc,jSrc);
-            domainDest_->bounds_lat_2d(n,iDest,jDest) = domainSrc_->bounds_lat_2d(n,iSrc,jSrc);
-          }
-        }
-        else if (!domainSrc_->bounds_lon_1d.isEmpty())
-        {
-          for (int n = 0; n < domainSrc_->nvertex; ++n)
-          {
-            domainDest_->bounds_lon_1d(n,iDest) = domainSrc_->bounds_lon_1d(n,iSrc);
-            domainDest_->bounds_lat_1d(n,iDest) = domainSrc_->bounds_lat_1d(n,iSrc);
-          }
-        }
-      }
-
-      if (domainSrc_->hasLonLat)
-      {
-        if (domainDest_->type == CDomain::type_attr::rectilinear)
-        {
-          domainDest_->latvalue_1d(jDest) = domainSrc_->latvalue_1d(jSrc);
-        }
-        else if (domainDest_->type == CDomain::type_attr::curvilinear)
-        {
-          domainDest_->lonvalue_2d(iDest,jDest) = domainSrc_->lonvalue_2d(iSrc,jSrc);
-          domainDest_->latvalue_2d(iDest,jDest) = domainSrc_->latvalue_2d(iSrc,jSrc);
-        }
-      }
-
-      transMap[indGloDest].push_back(indGloSrc);
-      transWeight[indGloDest].push_back(1.0);
-
-    }
-    if (domainSrc_->hasLonLat)
-    {
-      if (domainDest_->type == CDomain::type_attr::unstructured)
-      {
-        domainDest_->lonvalue_1d(iDest) = domainSrc_->lonvalue_1d(iSrc);
-        domainDest_->latvalue_1d(iDest) = domainSrc_->latvalue_1d(iSrc);
-      }
-      else if (domainDest_->type == CDomain::type_attr::rectilinear)
-      {
-        domainDest_->lonvalue_1d(iDest) = domainSrc_->lonvalue_1d(iSrc);
-      }
-    }
-  }
-
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CDomainAlgorithmExtract::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_extract.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_extract.hpp	(revision 1975)
+++ 	(revision )
@@ -1,59 +1,0 @@
-
-#ifndef __XIOS_DOMAIN_ALGORITHM_EXTRACT_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_EXTRACT_HPP__
-
-#include "domain_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CDomain;
-class CExtractDomain;
-
-/*!
-  \class CDomainAlgorithmExtract
-  Implementing extract (alternative zoom) on domain
-*/
-class CDomainAlgorithmExtract : public CDomainAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmExtract(CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain);
-
-  virtual ~CDomainAlgorithmExtract() {}
-
-  static bool registerTrans();
-protected:
-  void updateDomainAttributes();
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  void updateExtract();
-
-private:
-  //! Global extract begin on domain
-  int extractIBegin_;
-  int extractJBegin_;
-
-  //! Global extract end on domain
-  int extractIEnd_;
-  int extractJEnd_;
-
-  //! Global extract size on domain
-  int extractNi_;
-  int extractNj_;
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CDomain>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_EXTRACT_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_generate_rectilinear.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_generate_rectilinear.cpp	(revision 1975)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*!
-   \file domain_algorithm_generate_rectilinear.cpp
-   \author Ha NGUYEN
-   \since 31 Aug 2015
-   \date 31 Aug 2015
-
-   \brief Algorithm for automatic generation of rectilinear domain.
- */
-#include "domain_algorithm_generate_rectilinear.hpp"
-#include "grid.hpp"
-#include "domain.hpp"
-#include "context.hpp"
-#include "context_client.hpp"
-#include "generate_rectilinear_domain.hpp"
-
-namespace xios {
-
-CDomainAlgorithmGenerateRectilinear::CDomainAlgorithmGenerateRectilinear(CDomain* domainDestination, CDomain* domainSource,
-                                                                         CGrid* gridDest, CGrid* gridSource,
-                                                                         CGenerateRectilinearDomain* genRectDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource), nbDomainDistributedPart_(0)
-TRY
-{
-  type_ = ELEMENT_GENERATION;
-  genRectDomain->checkValid(domainDestination);
-  if (0 != gridSource) computeDistributionGridSource(gridSource);
-  else
-  {
-    computeDistributionGridDestination(gridDest);
-  }
-  fillInAttributesDomainDestination();
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CDomainAlgorithmGenerateRectilinear::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
- /* Nothing to do */
-}
-
-/*!
-  Calculate the number of distributed parts on domain source
-*/
-void CDomainAlgorithmGenerateRectilinear::computeDistributionGridSource(CGrid* gridSrc)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int clientSize = context->intraCommSize_ ;
-  int clientRank = context->intraCommRank_ ;
-  
-  std::vector<CDomain*> domListSrcP = gridSrc->getDomains();
-  std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();
-
-  for (int i = 0; i < domListSrcP.size(); ++i) // support we have only domain, more than one, for now, dont know how to process
-  {
-    // First, find (roundly) distribution of associated axis (if any)
-    if (axisListSrcP.empty()) nbDomainDistributedPart_ = clientSize;
-    else
-    {
-      gridSrc->solveAxisRef(false);
-      int nbAxis = axisListSrcP.size();
-      std::vector<int> nbLocalAxis(nbAxis, 0);
-      for (int j = 0; j < nbAxis; ++j)
-      {
-        std::vector<int> globalAxisIndex(axisListSrcP[j]->n);
-        for (int idx = 0; idx < axisListSrcP[j]->n; ++idx)
-          globalAxisIndex[idx] = axisListSrcP[j]->begin + idx;
-        HashXIOS<int> hashFunc;
-        StdSize hashValue = hashFunc.hashVec(globalAxisIndex);
-        std::vector<StdSize> recvBuff(clientSize);
-        MPI_Gather(&hashValue, 1, MPI_UNSIGNED_LONG,
-                   &recvBuff[0], 1, MPI_UNSIGNED_LONG,
-                   0,
-                   context->intraComm_);
-        if (0 == clientRank)
-        {
-          std::set<StdSize> setTmp;
-          for (int k = 0; k < recvBuff.size(); ++k)
-          {
-            if (setTmp.end() == setTmp.find(recvBuff[k]))
-            {
-              ++nbLocalAxis[j];
-              setTmp.insert(recvBuff[k]);
-            }
-          }
-        }
-
-        MPI_Bcast(&nbLocalAxis[0], nbAxis, MPI_INT,
-                  0, context->intraComm_);
-      }
-
-      int nbAxisDistributedPart = 1;
-      for (int j = 0; j < nbAxis; ++j) nbAxisDistributedPart *= nbLocalAxis[j];
-      nbDomainDistributedPart_ = clientSize/nbAxisDistributedPart;
-    }
-  }
-}
-CATCH
-
-/*!
-  Compute the distribution of the domain destination by using available information provided by user such as n_distributed_partition of axis
-*/
-void CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest)
-TRY
-{
-  // For now, just suppose that the grid contains only one domain
-  std::vector<CAxis*> axisListDestP = gridDest->getAxis();
-  int nbPartition = 1, idx = 0;
-  for (int i = 0; i < gridDest->axis_domain_order.numElements(); ++i)
-  {
-    if (false == (gridDest->axis_domain_order)(i))
-    {
-      nbPartition *= (axisListDestP[idx]->n_distributed_partition.isEmpty()) ? 1: (axisListDestP[idx]->n_distributed_partition.getValue());
-      ++idx;
-    }
-  }
-
-  CContext* context = CContext::getCurrent();
-  int modPart = (context->intraCommSize_) % nbPartition;
-  if (0 != modPart)
-    ERROR("CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest)",
-       << "The grid " <<gridDest->getId() << " is not well-distributed. There is an incompatibility between distribution of axis and domain.");
-  nbDomainDistributedPart_ = context->intraCommSize_/nbPartition;
-
-}
-CATCH
-
-/*!
-  Fill in all necessary attributes of domain destination and their values
-*/
-void CDomainAlgorithmGenerateRectilinear::fillInAttributesDomainDestination()
-TRY
-{
-  if (!domainDest_->distributionAttributesHaveValue())
-    domainDest_->redistribute(nbDomainDistributedPart_);
-  domainDest_->fillInLonLat();
-}
-CATCH
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_generate_rectilinear.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_generate_rectilinear.hpp	(revision 1975)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*!
-   \file domain_algorithm_generate_rectilinear.hpp
-   \author Ha NGUYEN
-   \since 31 Aug 2015
-   \date 01 Sep 2015
-
-   \brief Algorithm for automatic generation of rectilinear domain.
- */
-#ifndef __XIOS_DOMAIN_ALGORITHM_GENERATE_RECTILINEAR_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_GENERATE_RECTILINEAR_HPP__
-
-#include "domain_algorithm_transformation.hpp"
-
-namespace xios {
-
-class CGrid;
-class CDomain;
-class CGenerateRectilinearDomain;
-
-/*!
-  \class CDomainAlgorithmGenerateRectilinear
-  Generate a rectilinear or CURVILINEAR domain and fill in necessary its attributes automatically
-  A new rectilinear (or CURVILINEAR) domain will also be distributed automatically among the processes.
-  The number of processes is deduced from the distribution of the grid source.
-*/
-class CDomainAlgorithmGenerateRectilinear : public CDomainAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmGenerateRectilinear(CDomain* domainDestination, CDomain* domainSource,
-                                      CGrid* gridDest, CGrid* gridSource,
-                                      CGenerateRectilinearDomain* zoomDomain);
-
-  virtual ~CDomainAlgorithmGenerateRectilinear() {}
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  void computeDistributionGridSource(CGrid* gridSrc);
-  void computeDistributionGridDestination(CGrid* gridDest);
-  void fillInAttributesDomainDestination();
-
-private:
-  int nbDomainDistributedPart_; //! Number of local domain.
-
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_GENERATE_RECTILINEAR_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_interpolate.cpp	(revision 1975)
+++ 	(revision )
@@ -1,1025 +1,0 @@
-/*!
-   \file domain_algorithm_interpolate_from_file.cpp
-   \author Ha NGUYEN
-   \since 09 Jul 2015
-   \date 15 Sep 2015
-
-   \brief Algorithm for interpolation on a domain.
- */
-#include "domain_algorithm_interpolate.hpp"
-#include <unordered_map>
-#include "context.hpp"
-#include "context_client.hpp"
-#include "distribution_client.hpp"
-#include "client_server_mapping_distributed.hpp"
-#include "netcdf.hpp"
-#include "mapper.hpp"
-#include "mpi_tag.hpp"
-#include "domain.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "interpolate_domain.hpp"
-#include "grid.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CDomainAlgorithmInterpolate::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CDomain>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
-  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
-
-  CInterpolateDomain* interpolateDomain = dynamic_cast<CInterpolateDomain*> (transformation);
-  int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CDomainAlgorithmInterpolate(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], interpolateDomain));
-}
-CATCH
-
-bool CDomainAlgorithmInterpolate::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_INTERPOLATE_DOMAIN, create);
-}
-CATCH
-
-CDomainAlgorithmInterpolate::CDomainAlgorithmInterpolate(CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource), interpDomain_(interpDomain), writeToFile_(false), readFromFile_(false)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  interpDomain_->checkValid(domainSource);
-
-  detectMissingValue = interpDomain_->detect_missing_value ;
-  renormalize = interpDomain_->renormalize ;
-  quantity = interpDomain_->quantity ;
-
-  if (interpDomain_->read_write_convention == CInterpolateDomain::read_write_convention_attr::fortran) fortranConvention=true ;
-  else fortranConvention=false ;
-  
-  fileToReadWrite_ = "xios_interpolation_weights_";
-
-  if (interpDomain_->weight_filename.isEmpty())
-  {
-    fileToReadWrite_ += context->getId() + "_" + 
-                    domainSource->getDomainOutputName() + "_" + 
-                    domainDestination->getDomainOutputName() + ".nc";    
-  }
-  else 
-    fileToReadWrite_ = interpDomain_->weight_filename;
-
-  ifstream f(fileToReadWrite_.c_str());  
-  switch (interpDomain_->mode)
-  {
-    case CInterpolateDomain::mode_attr::read:
-      readFromFile_ = true;      
-      break;
-    case CInterpolateDomain::mode_attr::compute:
-      readFromFile_ = false;
-      break;
-    case CInterpolateDomain::mode_attr::read_or_compute:      
-      if (!f.good())
-        readFromFile_ = false;
-      else
-        readFromFile_ = true;
-      break;
-    default:
-      break;
-  } 
-
-  writeToFile_ = interpDomain_->write_weight;  
-    
-}
-CATCH
-
-/*!
-  Compute remap with integrated remap calculation module
-*/
-void CDomainAlgorithmInterpolate::computeRemap()
-TRY
-{
-  using namespace sphereRemap;
-
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-  int i, j, k, idx;
-  std::vector<double> srcPole(3,0), dstPole(3,0);
-  int orderInterp = interpDomain_->order.getValue();
-
-
-  const double poleValue = 90.0;
-  const int constNVertex = 4; // Value by default number of vertex for rectangular domain
-  int nVertexSrc, nVertexDest;
-  nVertexSrc = nVertexDest = constNVertex;
-
-  // First of all, try to retrieve the boundary values of domain source and domain destination
-  int localDomainSrcSize = domainSrc_->i_index.numElements();
-  int niSrc = domainSrc_->ni.getValue(), njSrc = domainSrc_->nj.getValue();
-  bool hasBoundSrc = domainSrc_->hasBounds;
-  if (hasBoundSrc) nVertexSrc = domainSrc_->nvertex.getValue();
-  CArray<double,2> boundsLonSrc(nVertexSrc,localDomainSrcSize);
-  CArray<double,2> boundsLatSrc(nVertexSrc,localDomainSrcSize);
-
-  if (domainSrc_->hasPole) srcPole[2] = 1;
-  if (hasBoundSrc)  // Suppose that domain source is curvilinear or unstructured
-  {
-    if (!domainSrc_->bounds_lon_2d.isEmpty())
-    {
-      for (j = 0; j < njSrc; ++j)
-        for (i = 0; i < niSrc; ++i)
-        {
-          k=j*niSrc+i;
-          for(int n=0;n<nVertexSrc;++n)
-          {
-            boundsLonSrc(n,k) = domainSrc_->bounds_lon_2d(n,i,j);
-            boundsLatSrc(n,k) = domainSrc_->bounds_lat_2d(n,i,j);
-          }
-        }
-    }
-    else
-    {
-      boundsLonSrc = domainSrc_->bounds_lon_1d;
-      boundsLatSrc = domainSrc_->bounds_lat_1d;
-    }
-  }
-  else // if domain source is rectilinear, not do anything now
-  {
-    CArray<double,1> lon_g ;
-    CArray<double,1> lat_g ;
-
-    if (!domainSrc_->lonvalue_1d.isEmpty() && !domainSrc_->latvalue_1d.isEmpty())
-    {
-      domainSrc_->AllgatherRectilinearLonLat(domainSrc_->lonvalue_1d,domainSrc_->latvalue_1d, lon_g,lat_g) ;
-    }
-    else if (! domainSrc_->latvalue_rectilinear_read_from_file.isEmpty() && ! domainSrc_->lonvalue_rectilinear_read_from_file.isEmpty() )
-    {
-      lat_g=domainSrc_->latvalue_rectilinear_read_from_file ;
-      lon_g=domainSrc_->lonvalue_rectilinear_read_from_file ;
-    }
-    else if (!domainSrc_->lon_start.isEmpty() && !domainSrc_->lon_end.isEmpty() &&
-             !domainSrc_->lat_start.isEmpty() && !domainSrc_->lat_end.isEmpty())
-    {
-      double step=(domainSrc_->lon_end-domainSrc_->lon_start)/domainSrc_->ni_glo ;
-      for (int i=0; i<domainSrc_->ni_glo; ++i) lon_g(i)=domainSrc_->lon_start+i*step ;
-      step=(domainSrc_->lat_end-domainSrc_->lat_start)/domainSrc_->nj_glo ;
-      for (int i=0; i<domainSrc_->ni_glo; ++i) lat_g(i)=domainSrc_->lat_start+i*step ;
-    }
-    else if (!domainSrc_->lonvalue.isEmpty() && !domainSrc_->latvalue.isEmpty())  // data can come possibly from coupler so only lonvalue and latvalue are defined ?
-    {
-      CArray<double,1> lon(niSrc), lat(njSrc) ;
-      for(int i=0; i< niSrc;++i) lon(i) = domainSrc_->lonvalue(i) ;
-      for(int j=0, n=0; j<njSrc; ++j, n+=niSrc) lat(j) = domainSrc_->latvalue(n) ;
-      domainSrc_->AllgatherRectilinearLonLat(lon, lat, lon_g, lat_g) ;
-    }
-    else ERROR("void CDomainAlgorithmInterpolate::computeRemap()",<<"Cannot compute bounds for rectilinear domain") ;
-
-    nVertexSrc = constNVertex;
-    domainSrc_->fillInRectilinearBoundLonLat(lon_g,lat_g, boundsLonSrc, boundsLatSrc);
-  }
-
-  std::map<int,std::vector<std::pair<int,double> > > interpMapValueNorthPole;
-  std::map<int,std::vector<std::pair<int,double> > > interpMapValueSouthPole;
-
-  int localDomainDestSize = domainDest_->i_index.numElements();
-  int niDest = domainDest_->ni.getValue(), njDest = domainDest_->nj.getValue();
-  bool hasBoundDest = domainDest_->hasBounds;
-  if (hasBoundDest) nVertexDest = domainDest_->nvertex.getValue();
-  CArray<double,2> boundsLonDest(nVertexDest,localDomainDestSize);
-  CArray<double,2> boundsLatDest(nVertexDest,localDomainDestSize);
-
-  if (domainDest_->hasPole) dstPole[2] = 1;
-  if (hasBoundDest)
-  {
-    if (!domainDest_->bounds_lon_2d.isEmpty())
-    {
-      for (j = 0; j < njDest; ++j)
-        for (i = 0; i < niDest; ++i)
-        {
-          k=j*niDest+i;
-          for(int n=0;n<nVertexDest;++n)
-          {
-            boundsLonDest(n,k) = domainDest_->bounds_lon_2d(n,i,j);
-            boundsLatDest(n,k) = domainDest_->bounds_lat_2d(n,i,j);
-          }
-        }
-    }
-    else
-    {
-      boundsLonDest = domainDest_->bounds_lon_1d;
-      boundsLatDest = domainDest_->bounds_lat_1d;
-    }
-  }
-  else
-  {
-    bool isNorthPole = false;
-    bool isSouthPole = false;
-
-    CArray<double,1> lon_g ;
-    CArray<double,1> lat_g ;
-
-    if (!domainDest_->lonvalue_1d.isEmpty() && !domainDest_->latvalue_1d.isEmpty())
-    {
-      domainDest_->AllgatherRectilinearLonLat(domainDest_->lonvalue_1d,domainDest_->latvalue_1d, lon_g,lat_g) ;
-    }
-    else if (! domainDest_->latvalue_rectilinear_read_from_file.isEmpty() && ! domainDest_->lonvalue_rectilinear_read_from_file.isEmpty() )
-    {
-      lat_g=domainDest_->latvalue_rectilinear_read_from_file ;
-      lon_g=domainDest_->lonvalue_rectilinear_read_from_file ;
-    }
-    else if (!domainDest_->lon_start.isEmpty() && !domainDest_->lon_end.isEmpty() &&
-             !domainDest_->lat_start.isEmpty() && !domainDest_->lat_end.isEmpty())
-    {
-      double step=(domainDest_->lon_end-domainDest_->lon_start)/domainDest_->ni_glo ;
-      for(int i=0; i<domainDest_->ni_glo; ++i) lon_g(i)=domainDest_->lon_start+i*step ;
-      step=(domainDest_->lat_end-domainDest_->lat_start)/domainDest_->nj_glo ;
-      for(int i=0; i<domainDest_->ni_glo; ++i) lat_g(i)=domainDest_->lat_start+i*step ;
-    }
-    else ERROR("void CDomainAlgorithmInterpolate::computeRemap()",<<"Cannot compute bounds for rectilinear domain") ;
-    
-    if (std::abs(poleValue - std::abs(lat_g(0))) < NumTraits<double>::epsilon()) isNorthPole = true;
-    if (std::abs(poleValue - std::abs(lat_g(domainDest_->nj_glo-1))) < NumTraits<double>::epsilon()) isSouthPole = true;
-
-
-
-
-    if (isNorthPole && (0 == domainDest_->jbegin.getValue()))
-    {
-      int ibegin = domainDest_->ibegin.getValue();
-      for (i = 0; i < niDest; ++i)
-      {
-        interpMapValueNorthPole[i+ibegin];
-      }
-    }
-
-    if (isSouthPole && (domainDest_->nj_glo.getValue() == (domainDest_->jbegin.getValue() + njDest)))
-    {
-      int ibegin = domainDest_->ibegin.getValue();
-      int njGlo = domainDest_->nj_glo.getValue();
-      int niGlo = domainDest_->ni_glo.getValue();
-      for (i = 0; i < niDest; ++i)
-      {
-        k = (njGlo - 1)*niGlo + i + ibegin;
-        interpMapValueSouthPole[k];
-      }
-    }
-
-    // Ok, fill in boundary values for rectangular domain
-    nVertexDest = constNVertex;
-    domainDest_->fillInRectilinearBoundLonLat(lon_g,lat_g, boundsLonDest, boundsLatDest);
-  }
-
-
-
-  // Ok, now use mapper to calculate
-  int nSrcLocal = domainSrc_->i_index.numElements();
-  int nDstLocal = domainDest_->i_index.numElements();
-  long int * globalSrc = new long int [nSrcLocal];
-  long int * globalDst = new long int [nDstLocal];
-
-  long int globalIndex;
-  int i_ind, j_ind;
-  for (int idx = 0; idx < nSrcLocal; ++idx)
-  {
-    i_ind=domainSrc_->i_index(idx) ;
-    j_ind=domainSrc_->j_index(idx) ;
-
-    globalIndex = i_ind + j_ind * domainSrc_->ni_glo;
-    globalSrc[idx] = globalIndex;
-  }
-
-  for (int idx = 0; idx < nDstLocal; ++idx)
-  {
-    i_ind=domainDest_->i_index(idx) ;
-    j_ind=domainDest_->j_index(idx) ;
-
-    globalIndex = i_ind + j_ind * domainDest_->ni_glo;
-    globalDst[idx] = globalIndex;
-  }
-
-
-  // Calculate weight index
-  Mapper mapper(context->intraComm_);
-  mapper.setVerbosity(PROGRESS) ;
-
-     
-  // supress masked data for the source
-  int nSrcLocalUnmasked = 0 ;
-  for (int idx=0 ; idx < nSrcLocal; idx++) if (domainSrc_->localMask(idx)) ++nSrcLocalUnmasked ;
-
-
-  CArray<double,2> boundsLonSrcUnmasked(nVertexSrc,nSrcLocalUnmasked);
-  CArray<double,2> boundsLatSrcUnmasked(nVertexSrc,nSrcLocalUnmasked);
-  CArray<double,1> areaSrcUnmasked(nSrcLocalUnmasked);
-  
-  long int * globalSrcUnmasked = new long int [nSrcLocalUnmasked];
-
-  nSrcLocalUnmasked=0 ;
-  bool hasSrcArea=domainSrc_->hasArea && !domainSrc_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true  ;
-  double srcAreaFactor ;
-  if (hasSrcArea) srcAreaFactor=1./(domainSrc_->radius*domainSrc_->radius) ;
-  
-  for (int idx=0 ; idx < nSrcLocal; idx++)
-  {
-    if (domainSrc_->localMask(idx))
-    {
-      for(int n=0;n<nVertexSrc;++n)
-      {
-        boundsLonSrcUnmasked(n,nSrcLocalUnmasked) = boundsLonSrc(n,idx) ;
-        boundsLatSrcUnmasked(n,nSrcLocalUnmasked) = boundsLatSrc(n,idx) ;
-      }
-      if (hasSrcArea) areaSrcUnmasked(nSrcLocalUnmasked) = domainSrc_->areavalue(idx)*srcAreaFactor ;
-      globalSrcUnmasked[nSrcLocalUnmasked]=globalSrc[idx] ;
-      ++nSrcLocalUnmasked ;
-    }
-  }
- 
-
-  int nDstLocalUnmasked = 0 ;
-  for (int idx=0 ; idx < nDstLocal; idx++) if (domainDest_->localMask(idx)) ++nDstLocalUnmasked ;
-
-  CArray<double,2> boundsLonDestUnmasked(nVertexDest,nDstLocalUnmasked);
-  CArray<double,2> boundsLatDestUnmasked(nVertexDest,nDstLocalUnmasked);
-  CArray<double,1>   areaDstUnmasked(nDstLocalUnmasked);
-
-  long int * globalDstUnmasked = new long int [nDstLocalUnmasked];
-
-  nDstLocalUnmasked=0 ;
-  bool hasDstArea=domainDest_->hasArea && !domainDest_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true ;
-  double dstAreaFactor ;
-  if (hasDstArea) dstAreaFactor=1./(domainDest_->radius*domainDest_->radius) ;
-  for (int idx=0 ; idx < nDstLocal; idx++)
-  {
-    if (domainDest_->localMask(idx))
-    {
-      for(int n=0;n<nVertexDest;++n)
-      {
-        boundsLonDestUnmasked(n,nDstLocalUnmasked) = boundsLonDest(n,idx) ;
-        boundsLatDestUnmasked(n,nDstLocalUnmasked) = boundsLatDest(n,idx) ;
-      }
-      if (hasDstArea) areaDstUnmasked(nDstLocalUnmasked) = domainDest_->areavalue(idx)*dstAreaFactor ;
-      globalDstUnmasked[nDstLocalUnmasked]=globalDst[idx] ;
-      ++nDstLocalUnmasked ;
-    }
-  }
-
-  double* ptAreaSrcUnmasked = NULL ;
-  if (hasSrcArea) ptAreaSrcUnmasked=areaSrcUnmasked.dataFirst() ;
-
-  double* ptAreaDstUnmasked = NULL ;
-  if (hasDstArea) ptAreaDstUnmasked=areaDstUnmasked.dataFirst() ;
-
-  mapper.setSourceMesh(boundsLonSrcUnmasked.dataFirst(), boundsLatSrcUnmasked.dataFirst(), ptAreaSrcUnmasked, nVertexSrc, nSrcLocalUnmasked, &srcPole[0], globalSrcUnmasked);
-  mapper.setTargetMesh(boundsLonDestUnmasked.dataFirst(), boundsLatDestUnmasked.dataFirst(), ptAreaDstUnmasked, nVertexDest, nDstLocalUnmasked, &dstPole[0], globalDstUnmasked);
-
-  std::vector<double> timings = mapper.computeWeights(orderInterp,renormalize,quantity);
-
-  std::map<int,std::vector<std::pair<int,double> > > interpMapValue;
-  std::map<int,std::vector<std::pair<int,double> > >::const_iterator iteNorthPole = interpMapValueNorthPole.end(),
-                                                                     iteSouthPole = interpMapValueSouthPole.end();
-  for (int idx = 0;  idx < mapper.nWeights; ++idx)
-  {
-    interpMapValue[mapper.targetWeightId[idx]].push_back(make_pair(mapper.sourceWeightId[idx],mapper.remapMatrix[idx]));
-    if (iteNorthPole != interpMapValueNorthPole.find(mapper.targetWeightId[idx]))
-    {
-      interpMapValueNorthPole[mapper.targetWeightId[idx]].push_back(make_pair(mapper.sourceWeightId[idx],mapper.remapMatrix[idx]));
-    }
-
-    if (iteSouthPole != interpMapValueSouthPole.find(mapper.targetWeightId[idx]))
-    {
-      interpMapValueSouthPole[mapper.targetWeightId[idx]].push_back(make_pair(mapper.sourceWeightId[idx],mapper.remapMatrix[idx]));
-    }
-  }
-  int niGloDst = domainDest_->ni_glo.getValue();
-  processPole(interpMapValueNorthPole, niGloDst);
-  processPole(interpMapValueSouthPole, niGloDst);
-
-  if (!interpMapValueNorthPole.empty())
-  {
-     std::map<int,std::vector<std::pair<int,double> > >::iterator itNorthPole = interpMapValueNorthPole.begin();
-     for (; itNorthPole != iteNorthPole; ++itNorthPole)
-     {
-       if (!(itNorthPole->second.empty()))
-        itNorthPole->second.swap(interpMapValue[itNorthPole->first]);
-     }
-  }
-
-  if (!interpMapValueSouthPole.empty())
-  {
-     std::map<int,std::vector<std::pair<int,double> > >::iterator itSouthPole = interpMapValueSouthPole.begin();
-     for (; itSouthPole != iteSouthPole; ++itSouthPole)
-     {
-       if (!(itSouthPole->second.empty()))
-        itSouthPole->second.swap(interpMapValue[itSouthPole->first]);
-     }
-  }
-
-  if (writeToFile_ && !readFromFile_) writeRemapInfo(interpMapValue);
-//  exchangeRemapInfo(interpMapValue);
-  convertRemapInfo(interpMapValue) ;
-
-  delete [] globalSrc;
-  delete [] globalSrcUnmasked;
-  delete [] globalDst;
-  delete [] globalDstUnmasked;
-
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::processPole(std::map<int,std::vector<std::pair<int,double> > >& interMapValuePole,
-                                              int nbGlobalPointOnPole)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  
-  MPI_Comm poleComme(MPI_COMM_NULL);
-  MPI_Comm_split(context->intraComm_, interMapValuePole.empty() ? MPI_UNDEFINED : 1, 0, &poleComme);
-  if (MPI_COMM_NULL != poleComme)
-  {
-    int nbClientPole;
-    MPI_Comm_size(poleComme, &nbClientPole);
-
-    std::map<int,std::vector<std::pair<int,double> > >::iterator itePole = interMapValuePole.end(), itPole,
-                                                                 itbPole = interMapValuePole.begin();
-
-    int nbWeight = 0;
-    for (itPole = itbPole; itPole != itePole; ++itPole)
-       nbWeight += itPole->second.size();
-
-    std::vector<int> recvCount(nbClientPole,0);
-    std::vector<int> displ(nbClientPole,0);
-    MPI_Allgather(&nbWeight,1,MPI_INT,&recvCount[0],1,MPI_INT,poleComme) ;
-
-    displ[0]=0;
-    for(int n=1;n<nbClientPole;++n) displ[n]=displ[n-1]+recvCount[n-1] ;
-    int recvSize=displ[nbClientPole-1]+recvCount[nbClientPole-1] ;
-
-    std::vector<int> sendSourceIndexBuff(nbWeight);
-    std::vector<double> sendSourceWeightBuff(nbWeight);
-    int k = 0;
-    for (itPole = itbPole; itPole != itePole; ++itPole)
-    {
-      for (int idx = 0; idx < itPole->second.size(); ++idx)
-      {
-        sendSourceIndexBuff[k] = (itPole->second)[idx].first;
-        sendSourceWeightBuff[k] = (itPole->second)[idx].second;
-        ++k;
-      }
-    }
-
-    std::vector<int> recvSourceIndexBuff(recvSize);
-    std::vector<double> recvSourceWeightBuff(recvSize);
-
-    // Gather all index and weight for pole
-    MPI_Allgatherv(&sendSourceIndexBuff[0],nbWeight,MPI_INT,&recvSourceIndexBuff[0],&recvCount[0],&displ[0],MPI_INT,poleComme);
-    MPI_Allgatherv(&sendSourceWeightBuff[0],nbWeight,MPI_DOUBLE,&recvSourceWeightBuff[0],&recvCount[0],&displ[0],MPI_DOUBLE,poleComme);
-
-    std::map<int,double> recvTemp;
-    for (int idx = 0; idx < recvSize; ++idx)
-    {
-      if (recvTemp.end() != recvTemp.find(recvSourceIndexBuff[idx]))
-        recvTemp[recvSourceIndexBuff[idx]] += recvSourceWeightBuff[idx]/nbGlobalPointOnPole;
-      else
-        recvTemp[recvSourceIndexBuff[idx]] = recvSourceWeightBuff[idx]/nbGlobalPointOnPole;
-    }
-
-    std::map<int,double>::const_iterator itRecvTemp, itbRecvTemp = recvTemp.begin(), iteRecvTemp = recvTemp.end();
-
-    for (itPole = itbPole; itPole != itePole; ++itPole)
-    {
-      itPole->second.clear();
-      for (itRecvTemp = itbRecvTemp; itRecvTemp != iteRecvTemp; ++itRecvTemp)
-          itPole->second.push_back(make_pair(itRecvTemp->first, itRecvTemp->second));
-    }
-  }
-
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CDomainAlgorithmInterpolate::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  if (readFromFile_)  
-    readRemapInfo();
-  else
-  {
-    computeRemap(); 
-  }
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue)
-TRY
-{  
-  writeInterpolationInfo(fileToReadWrite_, interpMapValue);
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::readRemapInfo()
-TRY
-{  
-  std::map<int,std::vector<std::pair<int,double> > > interpMapValue;
-  readInterpolationInfo(fileToReadWrite_, interpMapValue);
-
-  exchangeRemapInfo(interpMapValue);
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  std::map<int,std::vector<std::pair<int,double> > >::const_iterator itb = interpMapValue.begin(), it,
-                                                                     ite = interpMapValue.end();
-  
-  for (it = itb; it != ite; ++it)
-  {    
-    const std::vector<std::pair<int,double> >& tmp = it->second;
-    for (int i = 0; i < tmp.size(); ++i)
-    {
-      transMap[it->first].push_back(tmp[i].first);
-      transWeight[it->first].push_back(tmp[i].second);
-    }      
-  }      
-}
-CATCH
-
-/*!
-  Read remap information from file then distribute it among clients
-*/
-void CDomainAlgorithmInterpolate::exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-  int nbClient = context-> intraCommSize_;
-
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  std::unordered_map<size_t,int> globalIndexOfDomainDest;
-  int ni = domainDest_->ni.getValue();
-  int nj = domainDest_->nj.getValue();
-  int ni_glo = domainDest_->ni_glo.getValue();
-  size_t globalIndex;
-  int nIndexSize = domainDest_->i_index.numElements(), i_ind, j_ind;
-  for (int idx = 0; idx < nIndexSize; ++idx)
-  {
-    i_ind=domainDest_->i_index(idx) ;
-    j_ind=domainDest_->j_index(idx) ;
-
-    globalIndex = i_ind + j_ind * ni_glo;
-    globalIndexOfDomainDest[globalIndex] = clientRank;
-  }
-
-  CClientServerMappingDistributed domainIndexClientClientMapping(globalIndexOfDomainDest,
-                                                                 context->intraComm_,
-                                                                 true);
-  CArray<size_t,1> globalIndexInterp(interpMapValue.size());
-  std::map<int,std::vector<std::pair<int,double> > >::const_iterator itb = interpMapValue.begin(), it,
-                                                                     ite = interpMapValue.end();
-  size_t globalIndexCount = 0;
-  for (it = itb; it != ite; ++it)
-  {
-    globalIndexInterp(globalIndexCount) = it->first;
-    ++globalIndexCount;
-  }
-
-  domainIndexClientClientMapping.computeServerIndexMapping(globalIndexInterp, nbClient);
-  const CClientServerMapping::GlobalIndexMap& globalIndexInterpSendToClient = domainIndexClientClientMapping.getGlobalIndexOnServer();
-
-  //Inform each client number of index they will receive
-  int* sendBuff = new int[nbClient];
-  int* recvBuff = new int[nbClient];
-  for (int i = 0; i < nbClient; ++i)
-  {
-    sendBuff[i] = 0;
-    recvBuff[i] = 0;
-  }
-  int sendBuffSize = 0;
-  CClientServerMapping::GlobalIndexMap::const_iterator itbMap = globalIndexInterpSendToClient.begin(), itMap,
-                                                       iteMap = globalIndexInterpSendToClient.end();
-  for (itMap = itbMap; itMap != iteMap; ++itMap)
-  {
-    const std::vector<size_t>& tmp = itMap->second;
-    int sizeIndex = 0, mapSize = (itMap->second).size();
-    for (int idx = 0; idx < mapSize; ++idx)
-    {
-//      sizeIndex += interpMapValue.at((itMap->second)[idx]).size();
-      sizeIndex += (interpMapValue[(int)(itMap->second)[idx]]).size();
-    }
-    sendBuff[itMap->first] = sizeIndex;
-    sendBuffSize += sizeIndex;
-  }
-
-
-  MPI_Allreduce(sendBuff, recvBuff, nbClient, MPI_INT, MPI_SUM, context->intraComm_);
-
-  int* sendIndexDestBuff = new int [sendBuffSize];
-  int* sendIndexSrcBuff  = new int [sendBuffSize];
-  double* sendWeightBuff = new double [sendBuffSize];
-
-  std::vector<MPI_Request> sendRequest;
-
-  int sendOffSet = 0, l = 0;
-  for (itMap = itbMap; itMap != iteMap; ++itMap)
-  {
-    const std::vector<size_t>& indexToSend = itMap->second;
-    int mapSize = indexToSend.size();
-    int k = 0;
-    for (int idx = 0; idx < mapSize; ++idx)
-    {
-      std::vector<std::pair<int,double> >& interpMap = interpMapValue[(int)indexToSend[idx]]; //interpMapValue.at(indexToSend[idx]);
-      for (int i = 0; i < interpMap.size(); ++i)
-      {
-        sendIndexDestBuff[l] = indexToSend[idx];
-        sendIndexSrcBuff[l]  = interpMap[i].first;
-        sendWeightBuff[l]    = interpMap[i].second;
-        ++k;
-        ++l;
-      }
-    }
-
-    sendRequest.push_back(MPI_Request());
-    MPI_Isend(sendIndexDestBuff + sendOffSet,
-             k,
-             MPI_INT,
-             itMap->first,
-             MPI_DOMAIN_INTERPOLATION_DEST_INDEX,
-             context->intraComm_,
-             &sendRequest.back());
-    sendRequest.push_back(MPI_Request());
-    MPI_Isend(sendIndexSrcBuff + sendOffSet,
-             k,
-             MPI_INT,
-             itMap->first,
-             MPI_DOMAIN_INTERPOLATION_SRC_INDEX,
-             context->intraComm_,
-             &sendRequest.back());
-    sendRequest.push_back(MPI_Request());
-    MPI_Isend(sendWeightBuff + sendOffSet,
-             k,
-             MPI_DOUBLE,
-             itMap->first,
-             MPI_DOMAIN_INTERPOLATION_WEIGHT,
-             context->intraComm_,
-             &sendRequest.back());
-    sendOffSet += k;
-  }
-
-  int recvBuffSize = recvBuff[clientRank];
-  int* recvIndexDestBuff = new int [recvBuffSize];
-  int* recvIndexSrcBuff  = new int [recvBuffSize];
-  double* recvWeightBuff = new double [recvBuffSize];
-  int receivedSize = 0;
-  int clientSrcRank;
-  while (receivedSize < recvBuffSize)
-  {
-    MPI_Status recvStatus;
-    MPI_Recv((recvIndexDestBuff + receivedSize),
-             recvBuffSize,
-             MPI_INT,
-             MPI_ANY_SOURCE,
-             MPI_DOMAIN_INTERPOLATION_DEST_INDEX,
-             context->intraComm_,
-             &recvStatus);
-
-    int countBuff = 0;
-    MPI_Get_count(&recvStatus, MPI_INT, &countBuff);
-    clientSrcRank = recvStatus.MPI_SOURCE;
-
-    MPI_Recv((recvIndexSrcBuff + receivedSize),
-             recvBuffSize,
-             MPI_INT,
-             clientSrcRank,
-             MPI_DOMAIN_INTERPOLATION_SRC_INDEX,
-             context->intraComm_,
-             &recvStatus);
-
-    MPI_Recv((recvWeightBuff + receivedSize),
-             recvBuffSize,
-             MPI_DOUBLE,
-             clientSrcRank,
-             MPI_DOMAIN_INTERPOLATION_WEIGHT,
-             context->intraComm_,
-             &recvStatus);
-
-    for (int idx = 0; idx < countBuff; ++idx)
-    {
-      transMap[*(recvIndexDestBuff + receivedSize + idx)].push_back(*(recvIndexSrcBuff + receivedSize + idx));
-      transWeight[*(recvIndexDestBuff + receivedSize + idx)].push_back(*(recvWeightBuff + receivedSize + idx));
-    }
-    receivedSize += countBuff;
-  }
-
-  std::vector<MPI_Status> requestStatus(sendRequest.size());
-  MPI_Waitall(sendRequest.size(), &sendRequest[0], MPI_STATUS_IGNORE);
-
-  delete [] sendIndexDestBuff;
-  delete [] sendIndexSrcBuff;
-  delete [] sendWeightBuff;
-  delete [] recvIndexDestBuff;
-  delete [] recvIndexSrcBuff;
-  delete [] recvWeightBuff;
-  delete [] sendBuff;
-  delete [] recvBuff;
-}
-CATCH
- 
-/*! Redefined some functions of CONetCDF4 to make use of them */
-CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const MPI_Comm comm)
-  : CNc4DataOutput(NULL, filename, false, false, true, comm, false, true) {}
-int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name, 
-                                                                const StdSize size)
-TRY
-{
-  return CONetCDF4::addDimension(name, size);  
-}
-CATCH
-
-int CDomainAlgorithmInterpolate::WriteNetCdf::addVariableWrite(const StdString& name, nc_type type,
-                                                               const std::vector<StdString>& dim)
-TRY
-{
-  return CONetCDF4::addVariable(name, type, dim);
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::WriteNetCdf::endDefinition()
-TRY
-{
-  CONetCDF4::definition_end();
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray<int,1>& data, const StdString& name,
-                                                              bool collective, StdSize record,
-                                                              const std::vector<StdSize>* start,
-                                                              const std::vector<StdSize>* count)
-TRY
-{
-  CONetCDF4::writeData<int,1>(data, name, collective, record, start, count);
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray<double,1>& data, const StdString& name,
-                                                              bool collective, StdSize record,
-                                                              const std::vector<StdSize>* start,
-                                                              const std::vector<StdSize>* count)
-TRY
-{
-  CONetCDF4::writeData<double,1>(data, name, collective, record, start, count);
-}
-CATCH
-
-/*
-   Write interpolation weights into a file
-   \param [in] filename name of output file
-   \param interpMapValue mapping of global index of domain destination and domain source as well as the corresponding weight
-*/
-void CDomainAlgorithmInterpolate::writeInterpolationInfo(std::string& filename,
-                                                         std::map<int,std::vector<std::pair<int,double> > >& interpMapValue)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  
-  size_t n_src = domainSrc_->ni_glo * domainSrc_->nj_glo;
-  size_t n_dst = domainDest_->ni_glo * domainDest_->nj_glo;
-
-  long localNbWeight = 0;
-  long globalNbWeight;
-  long startIndex;
-  typedef std::map<int,std::vector<std::pair<int,double> > > IndexRemap;
-  IndexRemap::iterator itb = interpMapValue.begin(), it,
-                       ite = interpMapValue.end();
-  for (it = itb; it!=ite; ++it)
-  {
-    localNbWeight += (it->second).size();
-  }
-
-  CArray<int,1> src_idx(localNbWeight);
-  CArray<int,1> dst_idx(localNbWeight);
-  CArray<double,1> weights(localNbWeight);
-
-  int index = 0;
-  int indexOffset=0 ;
-  if (fortranConvention) indexOffset=1 ;
-  for (it = itb; it !=ite; ++it)
-  {
-    std::vector<std::pair<int,double> >& tmp = it->second;
-    for (int idx = 0; idx < tmp.size(); ++idx)
-    {
-      dst_idx(index) = it->first + indexOffset;
-      src_idx(index) = tmp[idx].first + indexOffset;
-      weights(index) = tmp[idx].second;
-      ++index;
-    }    
-  }
-
-  MPI_Allreduce(&localNbWeight, &globalNbWeight, 1, MPI_LONG, MPI_SUM, context->intraComm_);
-  MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, context->intraComm_);
-  
-  if (0 == globalNbWeight)
-  {
-    info << "There is no interpolation weights calculated between "
-         << "domain source: " << domainSrc_->getDomainOutputName()
-         << " and domain destination: " << domainDest_->getDomainOutputName()
-         << std::endl;
-    return;
-  }
-
-  std::vector<StdSize> start(1, startIndex - localNbWeight);
-  std::vector<StdSize> count(1, localNbWeight);
-  
-  WriteNetCdf netCdfWriter(filename, context->intraComm_);  
-
-  // Define some dimensions
-  netCdfWriter.addDimensionWrite("n_src", n_src);
-  netCdfWriter.addDimensionWrite("n_dst", n_dst);
-  netCdfWriter.addDimensionWrite("n_weight", globalNbWeight);
-  
-  std::vector<StdString> dims(1,"n_weight");
-
-  // Add some variables
-  netCdfWriter.addVariableWrite("src_idx", NC_INT, dims);
-  netCdfWriter.addVariableWrite("dst_idx", NC_INT, dims);
-  netCdfWriter.addVariableWrite("weight", NC_DOUBLE, dims);
-
-  // End of definition
-  netCdfWriter.endDefinition();
-
-  // // Write variables
-  if (0 != localNbWeight)
-  {
-    netCdfWriter.writeDataIndex(src_idx, "src_idx", false, 0, &start, &count);
-    netCdfWriter.writeDataIndex(dst_idx, "dst_idx", false, 0, &start, &count);
-    netCdfWriter.writeDataIndex(weights, "weight", false, 0, &start, &count);
-  }
-
-  netCdfWriter.closeFile();
-}
-CATCH
-
-/*!
-  Read interpolation information from a file
-  \param [in] filename interpolation file
-  \param [in/out] interpMapValue Mapping between (global) index of domain on grid destination and
-         corresponding global index of domain and associated weight value on grid source
-*/
-void CDomainAlgorithmInterpolate::readInterpolationInfo(std::string& filename,
-                                                        std::map<int,std::vector<std::pair<int,double> > >& interpMapValue)
-TRY
-{
-  int ncid ;
-  int weightDimId ;
-  size_t nbWeightGlo ;
-
-
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-  int clientSize = context->intraCommSize_;
-
-
-  {
-    ifstream f(filename.c_str());
-    if (!f.good()) ERROR("void CDomainAlgorithmInterpolate::readInterpolationInfo",
-                      << "Attempt to read file weight :"  << filename << " which doesn't seem to exist." << std::endl
-                      << "Please check this file ");
-  }
-                  
-  nc_open(filename.c_str(),NC_NOWRITE, &ncid) ;
-  nc_inq_dimid(ncid,"n_weight",&weightDimId) ;
-  nc_inq_dimlen(ncid,weightDimId,&nbWeightGlo) ;
-
-  size_t nbWeight ;
-  size_t start ;
-  size_t div = nbWeightGlo/clientSize ;
-  size_t mod = nbWeightGlo%clientSize ;
-  if (clientRank < mod)
-  {
-    nbWeight=div+1 ;
-    start=clientRank*(div+1) ;
-  }
-  else
-  {
-    nbWeight=div ;
-    start= mod * (div+1) + (clientRank-mod) * div ;
-  }
-
-  double* weight=new double[nbWeight] ;
-  int weightId ;
-  nc_inq_varid (ncid, "weight", &weightId) ;
-  nc_get_vara_double(ncid, weightId, &start, &nbWeight, weight) ;
-
-  long* srcIndex=new long[nbWeight] ;
-  int srcIndexId ;
-  nc_inq_varid (ncid, "src_idx", &srcIndexId) ;
-  nc_get_vara_long(ncid, srcIndexId, &start, &nbWeight, srcIndex) ;
-
-  long* dstIndex=new long[nbWeight] ;
-  int dstIndexId ;
-  nc_inq_varid (ncid, "dst_idx", &dstIndexId) ;
-  nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ;
-
-  int indexOffset=0 ;
-  if (fortranConvention) indexOffset=1 ;
-    for(size_t ind=0; ind<nbWeight;++ind)
-      interpMapValue[dstIndex[ind]-indexOffset].push_back(make_pair(srcIndex[ind]-indexOffset,weight[ind]));
- }
-CATCH
-
-void CDomainAlgorithmInterpolate::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                            const double* dataInput,
-                                            CArray<double,1>& dataOut,
-                                            std::vector<bool>& flagInitial,
-                                            bool ignoreMissingValue, bool firstPass  )
-TRY
-{
-  int nbLocalIndex = localIndex.size();   
-  double defaultValue = std::numeric_limits<double>::quiet_NaN();
-   
-  if (detectMissingValue)
-  {
-     if (firstPass && renormalize)
-     {
-       renormalizationFactor.resize(dataOut.numElements()) ;
-       renormalizationFactor=1 ;
-     }
-
-    if (firstPass)
-    {
-      allMissing.resize(dataOut.numElements()) ;
-      allMissing=true ;
-    }
-
-    for (int idx = 0; idx < nbLocalIndex; ++idx)
-    {
-      if (NumTraits<double>::isNan(*(dataInput + idx)))
-      {
-        allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && true;
-        if (renormalize) renormalizationFactor(localIndex[idx].first)-=localIndex[idx].second ;
-      }
-      else
-      {
-        dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second;
-        allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && false; // Reset flag to indicate not all data source are nan
-      }
-    }
-
-  }
-  else
-  {
-    for (int idx = 0; idx < nbLocalIndex; ++idx)
-    {
-      dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second;
-    }
-  }
-}
-CATCH
-
-void CDomainAlgorithmInterpolate::updateData(CArray<double,1>& dataOut)
-TRY
-{
-  if (detectMissingValue)
-  {
-    double defaultValue = std::numeric_limits<double>::quiet_NaN();
-    size_t nbIndex=dataOut.numElements() ; 
-
-    if (allMissing.numElements()>0)
-    {
-      for (int idx = 0; idx < nbIndex; ++idx)
-      {
-        if (allMissing(idx)) dataOut(idx) = defaultValue; // If all data source are nan then data destination must be nan
-      }
-    }
-    
-    if (renormalize)
-    {
-      if (renormalizationFactor.numElements()>0) dataOut/=renormalizationFactor ; // In some case, process doesn't received any data for interpolation (mask)
-                                                                                 // so renormalizationFactor is not initialized
-    }
-  }
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_interpolate.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_interpolate.hpp	(revision 1975)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*!
-   \file domain_algorithm_interpolate_from_file.hpp
-   \author Ha NGUYEN
-   \since 09 July 2015
-   \date 09 Sep 2015
-
-   \brief Algorithm for interpolation on a domain.
- */
-#ifndef __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
-
-#include "domain_algorithm_transformation.hpp"
-#include "transformation.hpp"
-#include "nc4_data_output.hpp"
-
-namespace xios {
-
-class CDomain;
-class CInterpolateDomain;
-
-
-/*!
-  \class CDomainAlgorithmInterpolate
-  Reading interpolation from file then apply on a domain
-*/
-class CDomainAlgorithmInterpolate : public CDomainAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmInterpolate(CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain);
-
-  virtual ~CDomainAlgorithmInterpolate() {}
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,                     
-                     bool ignoreMissingValue, bool firstPass);
-  virtual void updateData(CArray<double,1>& dataOut);
-
-  static bool registerTrans();
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  void readInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
-  void writeInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
-  void processPole(std::map<int,std::vector<std::pair<int,double> > >& interMapValuePole,
-                   int nbGlobalPointOnPole);
-  void computeRemap();
-  void readRemapInfo();
-  void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&);
-  void exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
-  void convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
-
-private:
-  CArray<double,1> renormalizationFactor ;
-  CArray<bool,1> allMissing ;
-  bool detectMissingValue ;
-  bool renormalize ;
-  bool quantity ;
-  
-  CInterpolateDomain* interpDomain_;
-  bool writeToFile_;
-  bool readFromFile_;
-  StdString fileToReadWrite_;
-  bool fortranConvention ;
-
-  // class WriteNetCdf;
-  class WriteNetCdf : public CNc4DataOutput
-  {
-  public:
-    WriteNetCdf(const StdString& filename, const MPI_Comm comm);
-    int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM);
-    int addVariableWrite(const StdString& name, nc_type type,
-                         const std::vector<StdString>& dim);
-    void endDefinition();
-    void writeDataIndex(const CArray<int,1>& data, const StdString& name,
-                        bool collective, StdSize record,
-                        const std::vector<StdSize>* start = NULL,
-                        const std::vector<StdSize>* count = NULL);
-    void writeDataIndex(const CArray<double,1>& data, const StdString& name,
-                        bool collective, StdSize record,
-                        const std::vector<StdSize>* start = NULL,
-                        const std::vector<StdSize>* count = NULL);
-  };
-
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CDomain>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_reorder.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_reorder.cpp	(revision 1975)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*!
-   \file domain_algorithm_reorder.cpp
-   \brief Algorithm for reorder a domain.
- */
-#include "domain_algorithm_reorder.hpp"
-#include "reorder_domain.hpp"
-#include "domain.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CDomainAlgorithmReorder::create(CGrid* gridDst, CGrid* gridSrc,
-                                                             CTransformation<CDomain>* transformation,
-                                                             int elementPositionInGrid,
-                                                             std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                             std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                             std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
-  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
-
-  CReorderDomain* reorderDomain = dynamic_cast<CReorderDomain*> (transformation);
-  int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CDomainAlgorithmReorder(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], reorderDomain));
-}
-CATCH
-
-bool CDomainAlgorithmReorder::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_REORDER_DOMAIN, create);
-}
-CATCH
-
-CDomainAlgorithmReorder::CDomainAlgorithmReorder(CDomain* domainDestination, CDomain* domainSource, CReorderDomain* reorderDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource)
-TRY
-{
-  reorderDomain->checkValid(domainSource);
-  if (domainDestination->type !=  CDomain::type_attr::rectilinear)
-  {
-      ERROR("CDomainAlgorithmReorder::CDomainAlgorithmReorder(CDomain* domainDestination, CDomain* domainSource, CReorderDomain* reorderDomain)",
-           << "Domain destination is not rectilinear. This filter work only for rectilinear domain and destination domain with < id = "
-           <<domainDestination->getId() <<" > is of type "<<domainDestination->type<<std::endl);
-  }
-  
-  if (domainDestination == domainSource)
-  {
-    ERROR("CDomainAlgorithmReorder::CDomainAlgorithmReorder(CDomain* domainDestination, CDomain* domainSource, CReorderDomain* reorderDomain)",
-           << "Domain source and domain destination are the same. Please make sure domain destination refers to domain source" << std::endl
-           << "Domain source " <<domainSource->getId() << std::endl
-           << "Domain destination " <<domainDestination->getId() << std::endl);
-  }
-  this->type_ = (ELEMENT_MODIFICATION_WITHOUT_DATA);
-
-  if (!reorderDomain->invert_lat.isEmpty())
-  {
-    CArray<int,1>& j_index=domainDestination->j_index ;
-    int nglo = j_index.numElements() ;
-    int nj_glo =domainDestination->nj_glo ;
-    
-    for (size_t i = 0; i < nglo ; ++i)
-    {
-      j_index(i)=(nj_glo-1)-j_index(i) ;
-    }
-  }
-
-  if (!reorderDomain->shift_lon_fraction.isEmpty())
-  {
-    int ni_glo =domainDestination->ni_glo ;
-    int  offset = ni_glo*reorderDomain->shift_lon_fraction ;
-    CArray<int,1>& i_index=domainDestination->i_index ;
-    int nglo = i_index.numElements() ;
-    
-    for (size_t i = 0; i < nglo ; ++i)
-    {
-      i_index(i)=  (i_index(i)+offset+ni_glo)%ni_glo ;
-    }
-  }
-
-  if (!reorderDomain->min_lon.isEmpty() && !reorderDomain->max_lon.isEmpty())
-  {
-    double min_lon=reorderDomain->min_lon ;
-    double max_lon=reorderDomain->max_lon ;
-    double delta=max_lon-min_lon ;
-    
-    if (!domainDestination->lonvalue_1d.isEmpty() )
-    {
-      CArray<double,1>& lon=domainDestination->lonvalue_1d ;
-      for (int i=0;i<lon.numElements();++i)
-      {
-        while  (lon(i) > max_lon) lon(i)=lon(i)-delta ;
-        while  (lon(i) < min_lon) lon(i)=lon(i)+delta ;
-      }
-    }
-
-    if (!domainDestination->bounds_lon_1d.isEmpty() )
-    {
-      CArray<double,2>& bounds_lon=domainDestination->bounds_lon_1d ;
-      for (int i=0;i<bounds_lon.extent(0);++i)
-      {
-        while  (bounds_lon(0,i) > max_lon) bounds_lon(0,i)=bounds_lon(0,i)-delta ;
-        while  (bounds_lon(1,i) > max_lon) bounds_lon(1,i)=bounds_lon(1,i)-delta ;
-
-        while  (bounds_lon(0,i) < min_lon) bounds_lon(0,i)=bounds_lon(0,i)+delta ;
-        while  (bounds_lon(1,i) < min_lon) bounds_lon(1,i)=bounds_lon(1,i)+delta ;
-      }
-    }
-  }
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CDomainAlgorithmReorder::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-/*
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-*/
-}
-
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_reorder.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_reorder.hpp	(revision 1975)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*!
-   \brief Algorithm for reordering domain.
- */
-#ifndef __XIOS_DOMAIN_ALGORITHM_REORDER_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_REORDER_HPP__
-
-#include "domain_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CDomain;
-class CReorderDomain;
-
-/*!
-  \class CDomainAlgorithmReorder
-  Reordering data on domain
-*/
-class CDomainAlgorithmReorder : public CDomainAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmReorder(CDomain* domainDestination, CDomain* domainSource, CReorderDomain* reorderDomain);
-
-  virtual ~CDomainAlgorithmReorder() {}
-
-  static bool registerTrans();
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CDomain>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_REORDER_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_transformation.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_transformation.cpp	(revision 1975)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*!
-   \file domain_algorithm_transformation.hpp
-   \author Ha NGUYEN
-   \since 02 Jul 2015
-   \date 02 Jul 2015
-
-   \brief Interface for all domain transformation algorithms.
- */
-
-#include "domain_algorithm_transformation.hpp"
-#include "context.hpp"
-#include "context_client.hpp"
-#include "domain.hpp"
-
-namespace xios {
-
-CDomainAlgorithmTransformation::CDomainAlgorithmTransformation(CDomain* domainDestination, CDomain* domainSource)
- : CGenericAlgorithmTransformation(), domainDest_(domainDestination), domainSrc_(domainSource)
-{
-}
-
-CDomainAlgorithmTransformation::~CDomainAlgorithmTransformation()
-{
-}
-
-void CDomainAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-/*!
-  Compute global index of domain on different processes
-  \param [in] globalDomainIndex global index of domain source
-  \param [out] globalDomainIndexOnProc processes which contain the corresponding global index of domain source
-*/
-void CDomainAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex,
-                                                                int elementType,
-                                                                CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-  int clientSize = context->intraCommSize_;
-
-  int niGlob = domainSrc_->ni_glo.getValue();
-  int njGlob = domainSrc_->nj_glo.getValue();
-  size_t globalIndex;
-  int nIndexSize = domainSrc_->i_index.numElements(), i_ind, j_ind;
-  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;
-  globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));
-  CArray<bool,1>& localMask=domainSrc_->localMask ;
-  for (int idx = 0; idx < nIndexSize; ++idx)
-  {
-    if (localMask(idx))
-    {
-      i_ind=domainSrc_->i_index(idx) ;
-      j_ind=domainSrc_->j_index(idx) ;
-
-      globalIndex = i_ind + j_ind * niGlob;
-      globalIndex2ProcRank[globalIndex].push_back(clientRank);
-    }
-  }
-
-  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);
-  dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex);
-  globalDomainIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_transformation.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_transformation.hpp	(revision 1975)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*!
-   \file domain_algorithm_transformation.hpp
-   \author Ha NGUYEN
-   \since 02 Jul 2015
-   \date 02 Jul 2015
-
-   \brief Interface for all domain transformation algorithms.
- */
-#ifndef __XIOS_DOMAIN_ALGORITHM_TRANSFORMATION_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_TRANSFORMATION_HPP__
-
-#include "generic_algorithm_transformation.hpp"
-#include "client_client_dht_template.hpp"
-
-namespace xios {
-
-class CDomain;
-/*!
-  \class CDomainAlgorithmTransformation
-  Algorithms for domain.
-*/
-class CDomainAlgorithmTransformation : public virtual CGenericAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmTransformation(CDomain* domainDestination, CDomain* domainSource);
-
-  virtual ~CDomainAlgorithmTransformation();
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&);
-
-  virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex,
-                                          int elementType,
-                                          CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc);
-
-protected:
-    //! Domain on grid destination
-  CDomain* domainDest_;
-
-  //! Domain on grid source
-  CDomain* domainSrc_;
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_TRANSFORMATION_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_zoom.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_zoom.cpp	(revision 1975)
+++ 	(revision )
@@ -1,286 +1,0 @@
-#include "domain_algorithm_zoom.hpp"
-#include "zoom_domain.hpp"
-#include "domain.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "attribute_template.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CDomainAlgorithmZoom::create(CGrid* gridDst, CGrid* gridSrc,
-                                                             CTransformation<CDomain>* transformation,
-                                                             int elementPositionInGrid,
-                                                             std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                             std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                             std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                             std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CDomain*> domainListDestP = gridDst->getDomains();
-  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
-
-  CZoomDomain* zoomDomain = dynamic_cast<CZoomDomain*> (transformation);
-  int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CDomainAlgorithmZoom(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], zoomDomain));
-}
-CATCH
-
-bool CDomainAlgorithmZoom::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_ZOOM_DOMAIN, create);
-}
-CATCH
-
-CDomainAlgorithmZoom::CDomainAlgorithmZoom(CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain)
-: CDomainAlgorithmTransformation(domainDestination, domainSource)
-TRY
-{
-  zoomDomain->checkValid(domainSource);
-  zoomIBegin_ = zoomDomain->ibegin.getValue();
-  zoomJBegin_ = zoomDomain->jbegin.getValue();
-
-  zoomNi_  = zoomDomain->ni.getValue();
-  zoomNj_  = zoomDomain->nj.getValue();
-
-  zoomIEnd_ = zoomIBegin_ + zoomNi_ - 1;
-  zoomJEnd_ = zoomJBegin_ + zoomNj_ - 1;
-
-  if (zoomNi_ > domainSource->ni_glo.getValue())
-  {
-    ERROR("CDomainAlgorithmZoom::CDomainAlgorithmZoom(CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain)",
-           << "Zoom size is greater than size of domain source"
-           << "Size ni_glo of domain source " <<domainSource->getId() << " is " << domainSource->ni_glo.getValue()  << std::endl
-           << "Zoom size is " << zoomNi_ );
-  }
-
-  if (zoomNj_ > domainSource->nj_glo.getValue())
-  {
-    ERROR("CDomainAlgorithmZoom::CDomainAlgorithmZoom(CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain)",
-           << "Zoom size is greater than size of domain source"
-           << "Size nj_glo of domain source " <<domainSource->getId() << " is " << domainSource->nj_glo.getValue()  << std::endl
-           << "Zoom size is " << zoomNj_ );
-  }
-
-  // Calculate the size of local domain
-  int ind, indLocSrc, indLocDest, iIdxSrc, jIdxSrc, destIBegin = -1, destJBegin = -1, niDest = 0, njDest = 0, ibeginDest, jbeginDest ;
-  int indGloDest, indGloSrc, niGloSrc = domainSrc_->ni_glo, iSrc, jSrc, nvertex = 0;
-  for (int j = 0; j < domainSrc_->nj.getValue(); j++)
-  {
-    for (int i = 0; i < domainSrc_->ni.getValue(); i++)
-    {
-      ind = j*domainSrc_->ni + i;
-      iIdxSrc = domainSrc_->i_index(ind);
-      if ((iIdxSrc >= zoomIBegin_) && (iIdxSrc <= zoomIEnd_))
-      {
-        jIdxSrc = domainSrc_->j_index(ind);
-        if ((jIdxSrc >= zoomJBegin_) && (jIdxSrc <= zoomJEnd_))
-        {
-          if ((niDest == 0) && (njDest == 0))
-          {
-            destIBegin = i;
-            destJBegin = j;
-          }
-          if (i == destIBegin) ++njDest;
-        }
-        if (j == destJBegin) ++niDest;
-
-      }
-    }
-  }
-  ibeginDest = destIBegin + domainSrc_->ibegin - zoomIBegin_;
-  jbeginDest = destJBegin + domainSrc_->jbegin - zoomJBegin_;
-  domainDest_->ni_glo.setValue(zoomNi_);
-  domainDest_->nj_glo.setValue(zoomNj_);
-  domainDest_->ni.setValue(niDest);
-  domainDest_->nj.setValue(njDest);
-  if ( (niDest==0) || (njDest==0))
-  {
-    domainDest_->ibegin.setValue(0);
-    domainDest_->jbegin.setValue(0);
-  }
-  else
-  {
-    domainDest_->ibegin.setValue(ibeginDest);
-    domainDest_->jbegin.setValue(jbeginDest);
-  }
-  domainDest_->i_index.resize(niDest*njDest);
-  domainDest_->j_index.resize(niDest*njDest);
-
-  domainDest_->data_ni.setValue(niDest);
-  domainDest_->data_nj.setValue(njDest);
-  domainDest_->data_ibegin.setValue(0);
-  domainDest_->data_jbegin.setValue(0);
-  domainDest_->data_i_index.resize(niDest*njDest);
-  domainDest_->data_j_index.resize(niDest*njDest);
-
-  domainDest_->domainMask.resize(niDest*njDest);
-
-  if (!domainSrc_->lonvalue_1d.isEmpty())
-  {
-    if (domainDest_->type == CDomain::type_attr::rectilinear)
-    {
-      domainDest_->lonvalue_1d.resize(niDest);
-      domainDest_->latvalue_1d.resize(njDest);
-    }
-    else if (domainDest_->type == CDomain::type_attr::unstructured)
-    {
-      domainDest_->lonvalue_1d.resize(niDest);
-      domainDest_->latvalue_1d.resize(niDest);
-    }
-    else if (domainDest_->type == CDomain::type_attr::curvilinear)
-    {
-      domainDest_->lonvalue_1d.resize(niDest*njDest);
-      domainDest_->latvalue_1d.resize(niDest*njDest);
-    }
-  }
-  else if (!domainSrc_->lonvalue_2d.isEmpty())
-  {
-    domainDest_->lonvalue_2d.resize(niDest,njDest);
-    domainDest_->latvalue_2d.resize(niDest,njDest);
-  }
-
-  if (domainSrc_->hasBounds)
-  {
-    nvertex = domainSrc_->nvertex;
-    domainDest_->nvertex.setValue(nvertex);
-    if (!domainSrc_->bounds_lon_1d.isEmpty())
-    {
-      if (domainDest_->type == CDomain::type_attr::rectilinear)
-      {
-        domainDest_->bounds_lon_1d.resize(nvertex, niDest);
-        domainDest_->bounds_lat_1d.resize(nvertex, njDest);
-      }
-      else if (domainDest_->type == CDomain::type_attr::unstructured)
-      {
-        domainDest_->bounds_lon_1d.resize(nvertex, niDest);
-        domainDest_->bounds_lat_1d.resize(nvertex, niDest);
-      }
-      else if (domainDest_->type == CDomain::type_attr::curvilinear)
-      {
-        domainDest_->bounds_lon_1d.resize(nvertex, niDest*njDest);
-        domainDest_->bounds_lat_1d.resize(nvertex, niDest*njDest);
-      }
-    }
-    else if (!domainSrc_->bounds_lon_2d.isEmpty())
-    {
-      domainDest_->bounds_lon_2d.resize(nvertex, niDest, njDest);
-      domainDest_->bounds_lat_2d.resize(nvertex, niDest, njDest);
-    }
-  }
-  if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest);
-
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  for (int iDest = 0; iDest < niDest; iDest++)
-  {
-    iSrc = iDest + destIBegin;
-    for (int jDest = 0; jDest < njDest; jDest++)
-    {
-      jSrc = jDest + destJBegin;
-      ind = jSrc * domainSrc_->ni + iSrc;
-      iIdxSrc = domainSrc_->i_index(ind);
-      jIdxSrc = domainSrc_->j_index(ind);
-      indLocDest = jDest*niDest + iDest;
-      indGloDest = (jDest + jbeginDest)*zoomNi_ + (iDest + ibeginDest);
-      indLocSrc = (jDest+destJBegin)*domainSrc_->ni + (iDest+destIBegin);
-      indGloSrc = (jIdxSrc )* niGloSrc + iIdxSrc;
-      domainDest_->i_index(indLocDest) = iDest + ibeginDest;                                             // i_index contains global positions
-      domainDest_->j_index(indLocDest) = jDest + jbeginDest;                                             // i_index contains global positions
-      domainDest_->data_i_index(indLocDest) = (domainSrc_->data_dim == 1) ? indLocDest : iDest;          // data_i_index contains local positions
-      domainDest_->data_j_index(indLocDest) = (domainSrc_->data_dim == 1) ? 0 :jDest;                    // data_i_index contains local positions
-      domainDest_->domainMask(indLocDest) = domainSrc_->domainMask(indLocSrc);
-
-      if (domainSrc_->hasArea)
-        domainDest_->area(iDest,jDest) = domainSrc_->area(iSrc,jSrc);
-
-      if (domainSrc_->hasLonLat)
-      {
-        if (!domainSrc_->latvalue_1d.isEmpty())
-        {
-          if (domainDest_->type == CDomain::type_attr::rectilinear)
-          {
-            domainDest_->latvalue_1d(jDest) = domainSrc_->latvalue_1d(jSrc);
-          }
-          else
-          {
-            domainDest_->lonvalue_1d(indLocDest) = domainSrc_->lonvalue_1d(ind);
-            domainDest_->latvalue_1d(indLocDest) = domainSrc_->latvalue_1d(ind);
-          }
-        }
-        else if (!domainSrc_->latvalue_2d.isEmpty())
-        {
-          domainDest_->lonvalue_2d(iDest,jDest) = domainSrc_->lonvalue_2d(iSrc,jSrc);
-          domainDest_->latvalue_2d(iDest,jDest) = domainSrc_->latvalue_2d(iSrc,jSrc);
-        }
-      }
-
-      if (domainSrc_->hasBounds)
-      {
-        if (!domainSrc_->bounds_lon_1d.isEmpty())
-        {
-          if (domainDest_->type == CDomain::type_attr::rectilinear)
-          {
-            for (int n = 0; n < nvertex; ++n)
-              domainDest_->bounds_lat_1d(n,jDest) = domainSrc_->bounds_lat_1d(n,jSrc);
-          }
-          else
-          {
-            for (int n = 0; n < nvertex; ++n)
-            {
-              domainDest_->bounds_lon_1d(n,indLocDest) = domainSrc_->bounds_lon_1d(n,ind);
-              domainDest_->bounds_lat_1d(n,indLocDest) = domainSrc_->bounds_lat_1d(n,ind);
-            }
-          }
-        }
-        else if (!domainSrc_->bounds_lon_2d.isEmpty())
-        {
-          for (int n = 0; n < nvertex; ++n)
-          {
-            domainDest_->bounds_lon_2d(n,iDest,jDest) = domainSrc_->bounds_lon_2d(n,iSrc,jSrc);
-            domainDest_->bounds_lat_2d(n,iDest,jDest) = domainSrc_->bounds_lat_2d(n,iSrc,jSrc);
-          }
-        }
-
-      }
-
-      transMap[indGloDest].push_back(indGloSrc);
-      transWeight[indGloDest].push_back(1.0);
-    }
-
-    if (domainSrc_->hasLonLat && !domainSrc_->latvalue_1d.isEmpty())
-    {
-      if (domainDest_->type == CDomain::type_attr::rectilinear)
-      {
-        domainDest_->lonvalue_1d(iDest) = domainSrc_->lonvalue_1d(iSrc);
-      }
-    }
-
-    if (domainSrc_->hasBounds && !domainSrc_->bounds_lon_1d.isEmpty())
-    {
-      if (domainDest_->type == CDomain::type_attr::rectilinear)
-      {
-        for (int n = 0; n < nvertex; ++n)
-          domainDest_->bounds_lon_1d(n,iDest) = domainSrc_->bounds_lon_1d(n,iSrc);
-      }
-    }
-  }
-  domainDest_->computeLocalMask();
-}
-CATCH
-
-/*!
-  Compute the index mapping between domain on grid source and one on grid destination
-*/
-void CDomainAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_zoom.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_zoom.hpp	(revision 1975)
+++ 	(revision )
@@ -1,59 +1,0 @@
-
-#ifndef __XIOS_DOMAIN_ALGORITHM_ZOOM_HPP__
-#define __XIOS_DOMAIN_ALGORITHM_ZOOM_HPP__
-
-#include "domain_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CDomain;
-class CZoomDomain;
-
-/*!
-  \class CDomainAlgorithmZoom
-  Implementing zoom (alternative zoom) on domain
-*/
-class CDomainAlgorithmZoom : public CDomainAlgorithmTransformation
-{
-public:
-  CDomainAlgorithmZoom(CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain);
-
-  virtual ~CDomainAlgorithmZoom() {}
-
-  static bool registerTrans();
-protected:
-  void updateDomainAttributes();
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-private:
-  void updateZoom();
-
-private:
-  //! Global zoom begin on domain
-  int zoomIBegin_;
-  int zoomJBegin_;
-
-  //! Global zoom end on domain
-  int zoomIEnd_;
-  int zoomJEnd_;
-
-  //! Global zoom size on domain
-  int zoomNi_;
-  int zoomNj_;
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CDomain>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_DOMAIN_ALGORITHM_ZOOM_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.cpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.cpp	(revision 1984)
@@ -14,6 +14,9 @@
 #include "timer.hpp"
 #include "mpi.hpp"
-
-namespace xios {
+#include "transform_connector.hpp"
+#include "weight_transform_connector.hpp"
+
+namespace xios 
+{
 
 CGenericAlgorithmTransformation::CGenericAlgorithmTransformation()
@@ -1135,3 +1138,41 @@
 CATCH
 
-}
+
+///////////////////////////////////////////////////////////////
+////////// new algorithm for new method               /////////
+///////////////////////////////////////////////////////////////
+
+
+
+void CGenericAlgorithmTransformation::computeAlgorithm(CLocalView* srcView, CLocalView* dstView)
+{
+  auto& srcMap = transformationMapping_[0] ;
+  set<size_t> srcIndex ;
+  for(auto& it : srcMap)
+    for(size_t index : it.second) srcIndex.insert(index) ;
+
+  CArray<size_t,1> srcArrayIndex(srcIndex.size()) ;
+  int i=0 ;
+  for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;}
+  CLocalElement recvElement(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ;
+  recvElement.addFullView() ;
+
+  transformConnector_ = new CTransformConnector(srcView, recvElement.getView(CElementView::FULL), CContext::getCurrent()->getIntraComm())  ;
+  transformConnector_->computeConnector() ;
+  weightTransformConnector_ = new  CWeightTransformConnector( recvElement.getView(CElementView::FULL), dstView, transformationMapping_[0], transformationWeight_[0]) ; 
+}
+ 
+
+void CGenericAlgorithmTransformation::apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut)
+{
+  CArray<double,1> dataOutTmp ;
+  transformConnector_->transfer(dimBefore, dimAfter, dataIn, dataOutTmp) ;
+  weightTransformConnector_ -> transfer(dimBefore, dimAfter, dataOutTmp, dataOut) ;
+}
+
+
+
+
+
+
+}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp	(revision 1984)
@@ -14,6 +14,10 @@
 #include "array_new.hpp"
 #include "client_client_dht_template.hpp"
+#include "local_view.hpp"
+#include "transform_connector.hpp"
+#include "weight_transform_connector.hpp"
 
-namespace xios {
+namespace xios
+{
   class CGrid;
   class CDomain;
@@ -169,4 +173,16 @@
   bool eliminateRedondantSrc_ ; // flag to indicate if the transformation must select only one global source point for all proc.
                                // In this case it will choose preferentially the current process 
+
+  
+// new methods for new algorithm
+
+  public : 
+  
+    void computeAlgorithm(CLocalView* srcView, CLocalView* dstView) ;
+    void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut);
+    
+    CTransformConnector* transformConnector_ ;
+    CWeightTransformConnector* weightTransformConnector_ ;
+
 };
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation_new.cpp.xxx
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation_new.cpp.xxx	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation_new.cpp.xxx	(revision 1984)
@@ -0,0 +1,93 @@
+/*!
+   \file generic_algorithm_transformation.hpp
+   \author Ha NGUYEN
+   \since 14 May 2015
+   \date 21 Mars 2016
+
+   \brief Interface for all transformation algorithms.
+ */
+#include "generic_algorithm_transformation.hpp"
+#include "context.hpp"
+#include "context_client.hpp"
+#include "client_client_dht_template.hpp"
+#include "utils.hpp"
+#include "timer.hpp"
+#include "mpi.hpp"
+
+namespace xios {
+
+CGenericAlgorithmTransformation::CGenericAlgorithmTransformation()
+ : transformationMapping_(), transformationWeight_(), transformationPosition_(),
+   idAuxInputs_(), type_(ELEMENT_NO_MODIFICATION_WITH_DATA), indexElementSrc_(),
+   computedProcSrcNonTransformedElement_(false), eliminateRedondantSrc_(true), isDistributedComputed_(false)
+{
+}
+
+void CGenericAlgorithmTransformation::updateData(CArray<double,1>& dataOut)
+{
+
+}
+
+void CGenericAlgorithmTransformation::apply(const std::vector<std::pair<int,double> >& localIndex,
+                                            const double* dataInput,
+                                            CArray<double,1>& dataOut,
+                                            std::vector<bool>& flagInitial,
+                                            bool ignoreMissingValue, bool firstPass  )
+TRY
+{
+  int nbLocalIndex = localIndex.size();   
+  double defaultValue = std::numeric_limits<double>::quiet_NaN();
+    
+  if (ignoreMissingValue)
+  {
+    if (firstPass) dataOut=defaultValue ;
+    
+    for (int idx = 0; idx < nbLocalIndex; ++idx)
+    {
+      if (! NumTraits<double>::isNan(*(dataInput + idx)))
+      {
+        if (flagInitial[localIndex[idx].first]) dataOut(localIndex[idx].first) = *(dataInput + idx) * localIndex[idx].second;
+        else dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second;
+        flagInitial[localIndex[idx].first] = false; // Reset flag to indicate not all data source are nan
+      }
+    }
+
+  }
+  else
+  {
+    for (int idx = 0; idx < nbLocalIndex; ++idx)
+    {
+      dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second;
+    }
+  }
+}
+CATCH
+
+
+/*!
+  Compute index mapping between element source and element destination with an auxiliary inputs which determine
+position of each mapped index in global index of grid destination.
+  \param [in] dataAuxInputs auxiliary inputs
+*/
+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
+
+}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation_new.hpp.xxx
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation_new.hpp.xxx	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation_new.hpp.xxx	(revision 1984)
@@ -0,0 +1,113 @@
+/*!
+   \file generic_algorithm_transformation.hpp
+   \author Ha NGUYEN
+   \since 14 May 2015
+   \date 29 June 2015
+
+   \brief Interface for all transformation algorithms.
+ */
+#ifndef __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_NEW_HPP__
+#define __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_NEW_HPP__
+
+#include <map>
+#include <set>
+#include "array_new.hpp"
+#include "client_client_dht_template.hpp"
+
+namespace xios {
+  class CGrid;
+  class CDomain;
+  class CAxis;
+  class CScalar;
+
+  /*!
+  \class CGenericAlgorithmTransformation
+  This class defines the interface for all other inherited algorithms class
+  */
+class CGenericAlgorithmTransformationNew
+{
+public:
+  enum AlgoTransType {
+    ELEMENT_GENERATION = 0,
+    ELEMENT_MODIFICATION_WITHOUT_DATA = 1,
+    ELEMENT_MODIFICATION_WITH_DATA = 2,
+    ELEMENT_NO_MODIFICATION_WITH_DATA = 3,
+    ELEMENT_NO_MODIFICATION_WITHOUT_DATA = 4
+  } ;
+
+protected:
+  typedef std::unordered_map<int, std::vector<int> > TransformationIndexMap;
+  typedef std::unordered_map<int, std::vector<double> > TransformationWeightMap;
+  typedef std::unordered_map<int, std::vector<int> > TransformationPositionMap;
+
+public:
+  CGenericAlgorithmTransformationNew();
+
+  virtual ~CGenericAlgorithmTransformationNew() {}
+
+    /*!
+    Apply a operation on local data.
+    \param [in] localIndex vector contains local index of local data output and the corresponding weight
+    \param [in] dataInput Pointer to the first element of data input array (in form of buffer)
+    \param [in/out] dataOut Array contains local data
+    \param [in/out] flagInitial vector of boolean to mark the local index already initialized. True means there is a need for initalization
+    \param [in] ignoreMissingValue don't count missing value in operation if this flag is true
+    \param [in] firstPass indicate if it is the first time the apply funtion is called for a same transformation, in order to make a clean initialization 
+  */
+  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
+                     const double* dataInput,
+                     CArray<double,1>& dataOut,
+                     std::vector<bool>& flagInitial,                     
+                     bool ignoreMissingValue, bool firstPass);
+
+  /*!
+   * Update whole dataOut (on necessary).
+   * (Example:  Impose a weight, whose value is only known after being applied an operation, on dataOut)
+   * \param [in/out] dataOut dataOut
+   */
+  virtual void updateData(CArray<double,1>& dataOut);
+
+  std::vector<StdString> getIdAuxInputs();
+  AlgoTransType type();
+  /*!
+  Compute global index mapping from one element of destination grid to the corresponding element of source grid
+  */
+  void computeIndexSourceMapping(const std::vector<CArray<double,1>* >& dataAuxInputs = std::vector<CArray<double,1>* >());
+  
+protected:
+  virtual void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&) = 0;
+
+  /*!
+  Compute proc which contains global index of an element
+    \param[in] globalElementIndex demanding global index of an element of source grid
+    \param[in] elementType type of source element, 2: domain, 1: axis and 0: scalar
+    \param[out] globalElementIndexOnProc Proc contains the demanding global index
+  */
+  virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalElementIndex,
+                                          int elementType,
+                                          CClientClientDHTInt::Index2VectorInfoTypeMap& globalElementIndexOnProc) = 0;
+
+protected:
+  //! indicate if the transformation is performed on a distributed element
+  bool isDistributed_ ;
+  //! indicate if the method  isDistributedTransformation has been called before
+  bool isDistributedComputed_ ;
+  
+  //! Map between global index of destination element and source element
+  std::vector<TransformationIndexMap> transformationMapping_;
+  //! Weight corresponding of source to destination
+  std::vector<TransformationWeightMap> transformationWeight_;
+  //! Map of global index of destination element and corresponding global index of other elements in the same grid
+  //! By default, one index of an element corresponds to all index of remaining element in the grid. So it's empty
+  std::vector<TransformationPositionMap> transformationPosition_;
+
+  //! Id of auxillary inputs which helps doing transformation dynamically
+  std::vector<StdString> idAuxInputs_;
+  AlgoTransType type_;
+  
+  bool eliminateRedondantSrc_ ; // flag to indicate if the transformation must select only one global source point for all proc.
+                               // In this case it will choose preferentially the current process 
+};
+
+}
+#endif // __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_extract_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_extract_axis.cpp	(revision 1975)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*!
-   \file scalar_algorithm_extract_scalar.cpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for extract an axis to a scalar
- */
-#include "scalar_algorithm_extract_axis.hpp"
-#include "axis.hpp"
-#include "scalar.hpp"
-#include "extract_axis_to_scalar.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-
-#include "reduction.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CScalarAlgorithmExtractAxis::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CScalar>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CScalar*> scalarListDestP = gridDst->getScalars();
-  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
-
-  CExtractAxisToScalar* extractAxis = dynamic_cast<CExtractAxisToScalar*> (transformation);
-  int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid];
-  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CScalarAlgorithmExtractAxis(scalarListDestP[scalarDstIndex], axisListSrcP[axisSrcIndex], extractAxis));
-}
-CATCH
-
-bool CScalarAlgorithmExtractAxis::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CScalar>::registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, create);
-}
-CATCH
-
-CScalarAlgorithmExtractAxis::CScalarAlgorithmExtractAxis(CScalar* scalarDestination, CAxis* axisSource, CExtractAxisToScalar* algo)
- : CScalarAlgorithmTransformation(scalarDestination, axisSource),
-   reduction_(0)
-TRY
-{
-  algo->checkValid(scalarDestination, axisSource);
-  StdString op = "extract";
-  pos_ = algo->position;
-  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]);
-}
-CATCH
-
-void CScalarAlgorithmExtractAxis::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                         const double* dataInput,
-                                         CArray<double,1>& dataOut,
-                                         std::vector<bool>& flagInitial,                     
-                                         bool ignoreMissingValue, bool firstPass)
-TRY
-{
-  reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass);
-}
-CATCH
-
-CScalarAlgorithmExtractAxis::~CScalarAlgorithmExtractAxis()
-TRY
-{
-  if (0 != reduction_) delete reduction_;
-}
-CATCH
-
-void CScalarAlgorithmExtractAxis::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  transMap[0].push_back(pos_);
-  transWeight[0].push_back(1.0);
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_extract_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_extract_axis.hpp	(revision 1975)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*!
-   \file scalar_algorithm_extract_scalar.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for extract an axis to a scalar
- */
-#ifndef __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__
-#define __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__
-
-#include "scalar_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CScalar;
-class CAxis;
-class CExtractAxisToScalar;
-class CReductionAlgorithm;
-
-/*!
-  \class CScalarAlgorithmExtractAxis
-  Extract a scalar from an axis
-*/
-class CScalarAlgorithmExtractAxis : public CScalarAlgorithmTransformation
-{
-public:
-  CScalarAlgorithmExtractAxis(CScalar* scalarDestination, CAxis* axisSource, CExtractAxisToScalar* algo);
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,                     
-                     bool ignoreMissingValue, bool firstPass);
-
-  virtual ~CScalarAlgorithmExtractAxis();
-
-  static bool registerTrans();
-
-protected:
-  int pos_;
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-protected:
-  CReductionAlgorithm* reduction_;
-
-private:
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CScalar>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_axis.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_axis.cpp	(revision 1975)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*!
-   \file scalar_algorithm_reduce_scalar.cpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce an axis to a scalar
- */
-#include "scalar_algorithm_reduce_axis.hpp"
-#include "axis.hpp"
-#include "scalar.hpp"
-#include "reduce_axis_to_scalar.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "reduction.hpp"
-
-#include "reduction.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CScalarAlgorithmReduceAxis::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CScalar>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CScalar*> scalarListDestP = gridDst->getScalars();
-  std::vector<CAxis*> axisListSrcP  = gridSrc->getAxis();
-
-  CReduceAxisToScalar* reduceAxis = dynamic_cast<CReduceAxisToScalar*> (transformation);
-  int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid];
-  int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CScalarAlgorithmReduceAxis(scalarListDestP[scalarDstIndex], axisListSrcP[axisSrcIndex], reduceAxis));
-}
-CATCH
-
-bool CScalarAlgorithmReduceAxis::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CScalar>::registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, create);
-}
-CATCH
-
-CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo)
- : CScalarAlgorithmTransformation(scalarDestination, axisSource),
-   reduction_(0)
-TRY
-{
-  if (algo->operation.isEmpty())
-    ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToScalar* algo)",
-           << "Operation must be defined."
-           << "Axis source " <<axisSource->getId() << std::endl
-           << "Scalar destination " << scalarDestination->getId());
-  StdString op;
-  switch (algo->operation)
-  {
-    case CReduceAxisToScalar::operation_attr::sum:
-      op = "sum";
-      break;
-    case CReduceAxisToScalar::operation_attr::min:
-      op = "min";
-      break;
-    case CReduceAxisToScalar::operation_attr::max:
-      op = "max";
-      break;
-    case CReduceAxisToScalar::operation_attr::average:
-      op = "average";
-      break;
-    default:
-        ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo)",
-         << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl
-         << "Domain source " <<axisSource->getId() << std::endl
-         << "Scalar destination " << scalarDestination->getId());
-
-  }
-  
-  if (CReductionAlgorithm::ReductionOperations.end() == CReductionAlgorithm::ReductionOperations.find(op))
-    ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToScalar* algo)",
-       << "Operation '" << op << "' not found. Please make sure to use a supported one"
-       << "Axis source " <<axisSource->getId() << std::endl
-       << "Scalar destination " << scalarDestination->getId());
-
-  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]);
-}
-CATCH
-
-void CScalarAlgorithmReduceAxis::apply(const std::vector<std::pair<int,double> >& localIndex, const double* dataInput, CArray<double,1>& dataOut,
-                                         std::vector<bool>& flagInitial, bool ignoreMissingValue, bool firstPass)
-TRY
-{
-  reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass);
-}
-CATCH
-
-void CScalarAlgorithmReduceAxis::updateData(CArray<double,1>& dataOut)
-TRY
-{
-  reduction_->updateData(dataOut);
-}
-CATCH
-
-CScalarAlgorithmReduceAxis::~CScalarAlgorithmReduceAxis()
-TRY
-{
-  if (0 != reduction_) delete reduction_;
-}
-CATCH
-
-void CScalarAlgorithmReduceAxis::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  int globalIndexSize = axisSrc_-> n_glo;
-
-  for (int idx = 0; idx < globalIndexSize; ++idx)
-  {
-    transMap[0].push_back(idx);
-    transWeight[0].push_back(1.0);
-  }
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_axis.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_axis.hpp	(revision 1975)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*!
-   \file scalar_algorithm_reduce_scalar.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce an axis to a scalar
- */
-#ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__
-#define __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__
-
-#include "scalar_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CScalar;
-class CAxis;
-class CReduceAxisToScalar;
-class CReductionAlgorithm;
-
-/*!
-  \class CScalarAlgorithmReduceAxis
-  Reducing an axis to a scalar
-*/
-class CScalarAlgorithmReduceAxis : public CScalarAlgorithmTransformation
-{
-public:
-  CScalarAlgorithmReduceAxis(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo);
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,
-                     bool ignoreMissingValue, bool firstPass);
-
-  virtual void updateData(CArray<double,1>& dataOut);
-  
-  virtual ~CScalarAlgorithmReduceAxis();
-
-  static bool registerTrans();
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-protected:
-  CReductionAlgorithm* reduction_;
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CScalar>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_domain.cpp	(revision 1975)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*!
-   \file scalar_algorithm_reduce_domain.cpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Algorithm for reduce a domain to a scalar
- */
-#include "scalar_algorithm_reduce_domain.hpp"
-#include "domain.hpp"
-#include "scalar.hpp"
-#include "reduce_domain_to_scalar.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-
-#include "reduction.hpp"
-
-namespace xios {
-CGenericAlgorithmTransformation* CScalarAlgorithmReduceDomain::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CScalar>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CScalar*> scalarListDestP = gridDst->getScalars();
-  std::vector<CDomain*> domainListSrcP  = gridSrc->getDomains();
-
-  CReduceDomainToScalar* reduceDomain = dynamic_cast<CReduceDomainToScalar*> (transformation);
-  int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid];
-  int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid];
-
-  return (new CScalarAlgorithmReduceDomain(scalarListDestP[scalarDstIndex], domainListSrcP[domainSrcIndex], reduceDomain));
-}
-CATCH
-
-bool CScalarAlgorithmReduceDomain::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CScalar>::registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, create);
-}
-CATCH
-
-CScalarAlgorithmReduceDomain::CScalarAlgorithmReduceDomain(CScalar* scalarDestination, CDomain* domainSource, CReduceDomainToScalar* algo)
- : CScalarAlgorithmTransformation(scalarDestination, domainSource),
-   reduction_(0)
-TRY
-{
-  algo->checkValid(scalarDestination, domainSource);
-  
-  StdString op;
-  switch (algo->operation)
-  {
-    case CReduceDomainToScalar::operation_attr::sum:
-      op = "sum";
-      break;
-    case CReduceDomainToScalar::operation_attr::min:
-      op = "min";
-      break;
-    case CReduceDomainToScalar::operation_attr::max:
-      op = "max";
-      break;
-    case CReduceDomainToScalar::operation_attr::average:
-      op = "average";
-      break;
-    default:
-        ERROR("CScalarAlgorithmReduceDomain::CScalarAlgorithmReduceDomain(CDomain* domainDestination, CDomain* domainSource, CReduceDomainToScalar* algo)",
-         << "Operation must be defined."
-         << "Domain source " <<domainSource->getId() << std::endl
-         << "Scalar destination " << scalarDestination->getId());
-
-  }
-  
-  if (CReductionAlgorithm::ReductionOperations.end() == CReductionAlgorithm::ReductionOperations.find(op))
-    ERROR("CScalarAlgorithmReduceDomain::CScalarAlgorithmReduceDomain(CDomain* domainDestination, CDomain* domainSource, CReduceDomainToScalar* algo)",
-       << "Operation '" << op << "' not found. Please make sure to use a supported one"
-       << "Domain source " <<domainSource->getId() << std::endl
-       << "Scalar destination " << scalarDestination->getId());
-
-  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]);
-  local = algo->local ;
-}
-CATCH
-
-void CScalarAlgorithmReduceDomain::apply(const std::vector<std::pair<int,double> >& localIndex,
-                                         const double* dataInput,
-                                         CArray<double,1>& dataOut,
-                                         std::vector<bool>& flagInitial,                     
-                                         bool ignoreMissingValue, bool firstPass)
-TRY
-{
-  reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass);
-}
-CATCH
-
-void CScalarAlgorithmReduceDomain::updateData(CArray<double,1>& dataOut)
-TRY
-{
-  reduction_->updateData(dataOut);
-}
-CATCH
-
-CScalarAlgorithmReduceDomain::~CScalarAlgorithmReduceDomain()
-TRY
-{
-  if (0 != reduction_) delete reduction_;
-}
-CATCH
-
-void CScalarAlgorithmReduceDomain::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  int ni_glo = domainSrc_->ni_glo ;
-  int nj_glo = domainSrc_->nj_glo ;
-  int nbDomainIdx ;
-  
-  if (local)
-  {
-      const CArray<int, 1>& i_index = domainSrc_-> i_index.getValue() ;
-      const CArray<int, 1>& j_index = domainSrc_-> j_index.getValue() ;
-      const CArray<bool,1>& localMask = domainSrc_-> localMask ;
-      int nbDomainIdx = i_index.numElements();
-
-      for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain)
-      {
-        if (localMask(idxDomain))
-        { 
-          transMap[0].push_back(j_index(idxDomain)* ni_glo + i_index(idxDomain));
-          transWeight[0].push_back(1.0) ;
-        }
-      }
-  }
-  else
-  {  
-    nbDomainIdx = ni_glo * nj_glo;
-    transMap[0].resize(nbDomainIdx);
-    transWeight[0].resize(nbDomainIdx, 1.0);
-    for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain) transMap[0][idxDomain] = idxDomain;    
-  }
-  
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_domain.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_domain.hpp	(revision 1975)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*!
-   \file scalar_algorithm_reduce_scalar.hpp
-   \author Ha NGUYEN
-   \since 13 Oct 2016
-   \date 13 Oct 2016
-
-   \brief Algorithm for reduce an DOMAIN to a scalar
- */
-#ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__
-#define __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__
-
-#include "scalar_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CScalar;
-class CDomain;
-class CReduceDomainToScalar;
-class CReductionAlgorithm;
-
-/*!
-  \class CScalarAlgorithmReduceDomain
-  Reducing an DOMAIN to a scalar
-*/
-class CScalarAlgorithmReduceDomain : public CScalarAlgorithmTransformation
-{
-public:
-  CScalarAlgorithmReduceDomain(CScalar* scalarDestination, CDomain* domainSource, CReduceDomainToScalar* algo);
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,                     
-                     bool ignoreMissingValue, bool firstPass);
-
-  virtual void updateData(CArray<double,1>& dataOut);
-  
-  virtual ~CScalarAlgorithmReduceDomain();
-
-  static bool registerTrans();
-protected:
-  bool local ;
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-protected:
-  CReductionAlgorithm* reduction_;
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CScalar>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DOMAINPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DOMAINPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_scalar.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_scalar.cpp	(revision 1975)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*!
-   \file scalar_algorithm_reduce_scalar.cpp
- 
-   \brief Algorithm for reduce an scalar to a scalar
- */
-#include "scalar_algorithm_reduce_scalar.hpp"
-#include "scalar.hpp"
-#include "reduce_scalar_to_scalar.hpp"
-#include "grid.hpp"
-#include "grid_transformation_factory_impl.hpp"
-#include "reduction.hpp"
-
-
-namespace xios {
-CGenericAlgorithmTransformation* CScalarAlgorithmReduceScalar::create(CGrid* gridDst, CGrid* gridSrc,
-                                                                     CTransformation<CScalar>* transformation,
-                                                                     int elementPositionInGrid,
-                                                                     std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition)
-TRY
-{
-  std::vector<CScalar*> scalarListDestP = gridDst->getScalars();
-  std::vector<CScalar*> scalarListSrcP  = gridSrc->getScalars();
-
-  CReduceScalarToScalar* reduceScalar = dynamic_cast<CReduceScalarToScalar*> (transformation);
-  int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid];
-  int scalarSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid];
-
-  return (new CScalarAlgorithmReduceScalar(scalarListDestP[scalarDstIndex], scalarListSrcP[scalarSrcIndex], reduceScalar));
-}
-CATCH
-
-bool CScalarAlgorithmReduceScalar::registerTrans()
-TRY
-{
-  CGridTransformationFactory<CScalar>::registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, create);
-}
-CATCH
-
-CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)
- : CScalarAlgorithmTransformation(scalarDestination, scalarSource),
-   reduction_(0)
-TRY
-{
-  eliminateRedondantSrc_= false ;
-  if (algo->operation.isEmpty())
-    ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",
-           << "Operation must be defined."
-           << "Scalar source " <<scalarSource->getId() << std::endl
-           << "Scalar destination " << scalarDestination->getId());
-  StdString op;
-  switch (algo->operation)
-  {
-    case CReduceScalarToScalar::operation_attr::sum:
-      op = "sum";
-      break;
-    case CReduceScalarToScalar::operation_attr::min:
-      op = "min";
-      break;
-    case CReduceScalarToScalar::operation_attr::max:
-      op = "max";
-      break;
-    case CReduceScalarToScalar::operation_attr::average:
-      op = "average";
-      break;
-    default:
-        ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",
-         << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl
-         << "Scalar source " <<scalarSource->getId() << std::endl
-         << "Scalar destination " << scalarDestination->getId());
-
-  }
-  
-  if (CReductionAlgorithm::ReductionOperations.end() == CReductionAlgorithm::ReductionOperations.find(op))
-    ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",
-       << "Operation '" << op << "' not found. Please make sure to use a supported one"
-       << "Scalar source " <<scalarSource->getId() << std::endl
-       << "Scalar destination " << scalarDestination->getId());
-
-  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]);
-}
-CATCH
-
-void CScalarAlgorithmReduceScalar::apply(const std::vector<std::pair<int,double> >& localIndex, const double* dataInput, CArray<double,1>& dataOut,
-                                         std::vector<bool>& flagInitial, bool ignoreMissingValue, bool firstPass)
-TRY
-{
-  reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass);
-}
-CATCH
-
-void CScalarAlgorithmReduceScalar::updateData(CArray<double,1>& dataOut)
-TRY
-{
-  reduction_->updateData(dataOut);
-}
-CATCH
-
-CScalarAlgorithmReduceScalar::~CScalarAlgorithmReduceScalar()
-TRY
-{
-  if (0 != reduction_) delete reduction_;
-}
-CATCH
-
-void CScalarAlgorithmReduceScalar::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-TRY
-{
-  this->transformationMapping_.resize(1);
-  this->transformationWeight_.resize(1);
-
-  TransformationIndexMap& transMap = this->transformationMapping_[0];
-  TransformationWeightMap& transWeight = this->transformationWeight_[0];
-
-  transMap[0].push_back(0);
-  transWeight[0].push_back(1.0);
-
-}
-CATCH
-
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_scalar.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_reduce_scalar.hpp	(revision 1975)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*!
-   \file scalar_algorithm_reduce_scalar.hpp
-   \brief Algorithm for reduce an scalar to a scalar
- */
-#ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__
-#define __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__
-
-#include "scalar_algorithm_transformation.hpp"
-#include "transformation.hpp"
-
-namespace xios {
-
-class CScalar;
-class CReduceScalarToScalar;
-class CReductionAlgorithm;
-
-/*!
-  \class CScalarAlgorithmReduceScalar
-  Reducing an scalar to a scalar
-*/
-class CScalarAlgorithmReduceScalar : public CScalarAlgorithmTransformation
-{
-public:
-  CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo);
-
-  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
-                     const double* dataInput,
-                     CArray<double,1>& dataOut,
-                     std::vector<bool>& flagInitial,
-                     bool ignoreMissingValue, bool firstPass);
-
-  virtual void updateData(CArray<double,1>& dataOut);
-  
-  virtual ~CScalarAlgorithmReduceScalar();
-
-  static bool registerTrans();
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-protected:
-  CReductionAlgorithm* reduction_;
-
-private:
-
-  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
-                                                CTransformation<CScalar>* transformation,
-                                                int elementPositionInGrid,
-                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
-                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
-                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
-                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
-};
-
-}
-#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_transformation.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_transformation.cpp	(revision 1975)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*!
-   \file scalar_algorithm_transformation.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 Oct 2016
-
-   \brief Interface for all scalar transformation algorithms.
- */
-
-#include "scalar_algorithm_transformation.hpp"
-#include "context.hpp"
-#include "context_client.hpp"
-#include "client_client_dht_template.hpp"
-#include "domain.hpp"
-#include "axis.hpp"
-#include "scalar.hpp"
-
-namespace xios {
-
-CScalarAlgorithmTransformation::CScalarAlgorithmTransformation(CScalar* scalarDestination, CScalar* scalarSource)
- : CGenericAlgorithmTransformation(),
-   scalarDest_(scalarDestination),
-   scalarSrc_(scalarSource), axisSrc_(0), domainSrc_(0)
-{
-}
-
-CScalarAlgorithmTransformation::CScalarAlgorithmTransformation(CScalar* scalarDestination, CAxis* axisSource)
- : CGenericAlgorithmTransformation(),
-   scalarDest_(scalarDestination),
-   scalarSrc_(0), axisSrc_(axisSource), domainSrc_(0)
-{
-}
-
-CScalarAlgorithmTransformation::CScalarAlgorithmTransformation(CScalar* scalarDestination, CDomain* domainSource)
- : CGenericAlgorithmTransformation(),
-   scalarDest_(scalarDestination),
-   scalarSrc_(0), axisSrc_(0), domainSrc_(domainSource)
-{
-}
-
-CScalarAlgorithmTransformation::~CScalarAlgorithmTransformation()
-{
-}
-
-void CScalarAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)
-{
-}
-
-/*!
-  Compute global index of element source on different processes on knowing the global index source of transformation
-
-  \param [in] globalIndexElementSource global index source of transformation (represented in the transformation mapping)
-  \param [in] elementSourceType type of element source
-  \param [out] globalIndexElementSourceOnProc processes which contain the corresponding global index of scalar source
-*/
-void CScalarAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalIndexElementSource,
-                                                                int elementSourceType,
-                                                                CClientClientDHTInt::Index2VectorInfoTypeMap& globalIndexElementSourceOnProc)
-TRY
-{
-  CContext* context = CContext::getCurrent();
-  int clientRank = context->intraCommRank_;
-  int clientSize = context->intraCommSize_;
-
-  if (2 == elementSourceType) // Source is a domain
-  {
-    size_t globalIndex;
-    int nIndexSize = domainSrc_->i_index.numElements();
-    CArray<int,1>& iIndex = domainSrc_->i_index;
-    CArray<int,1>& jIndex = domainSrc_->j_index;
-    int niGlo = domainSrc_->ni_glo;
-    CArray<bool,1>& localMask = domainSrc_ -> localMask ;
-    CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;
-    globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));
-    for (int idx = 0; idx < nIndexSize; ++idx)
-    {
-      if (localMask(idx))
-      {
-        globalIndex = jIndex(idx) * niGlo + iIndex(idx);
-        globalIndex2ProcRank[globalIndex].resize(1);
-        globalIndex2ProcRank[globalIndex][0] = clientRank;
-      }
-    }
-
-    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);
-    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource);
-    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap();
-  }
-  else if (1 == elementSourceType) // Source is an axis
-  {
-    size_t globalIndex;
-    int nIndexSize = axisSrc_->index.numElements();
-    CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;
-    globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));
-    CArray<bool,1>& localMask = axisSrc_ -> mask ;
-   
-    for (int idx = 0; idx < nIndexSize; ++idx)
-    {
-      if (localMask(idx))
-      {
-        globalIndex = axisSrc_->index(idx);
-        globalIndex2ProcRank[globalIndex].resize(1);
-        globalIndex2ProcRank[globalIndex][0] = clientRank;
-      }
-    }
-
-    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);
-    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource);
-    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap();
-  }
-  else // scalar
-  {
-    size_t globalIndex = 0;    
-    CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;
-    globalIndex2ProcRank[globalIndex].resize(1);
-    globalIndex2ProcRank[globalIndex][0] = clientRank;
-
-    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);
-    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource);
-    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap();
-  }
-}
-CATCH
-}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_transformation.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_transformation.hpp	(revision 1975)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*!
-   \file scalar_algorithm_transformation.hpp
-   \author Ha NGUYEN
-   \since 23 June 2016
-   \date 23 June 2016
-
-   \brief Interface for all scalar transformation algorithms.
- */
-#ifndef __XIOS_SCALAR_ALGORITHM_TRANSFORMATION_HPP__
-#define __XIOS_SCALAR_ALGORITHM_TRANSFORMATION_HPP__
-
-#include "generic_algorithm_transformation.hpp"
-
-namespace xios {
-
-class CScalar;
-class CAxis;
-class CDomain;
-
-/*!
-  \class CScalarAlgorithmTransformation
-  Algorithms for scalar.
-*/
-class CScalarAlgorithmTransformation : public virtual CGenericAlgorithmTransformation
-{
-public:
-  CScalarAlgorithmTransformation(CScalar* scalarDestination, CScalar* scalarSource);
-  CScalarAlgorithmTransformation(CScalar* scalarDestination, CAxis* axisSource);
-  CScalarAlgorithmTransformation(CScalar* scalarDestination, CDomain* domainSource);
-
-  virtual ~CScalarAlgorithmTransformation();
-
-protected:
-  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
-
-  virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalScalarIndex,
-                                          int elementType,
-                                          CClientClientDHTInt::Index2VectorInfoTypeMap& globalScalarIndexOnProc);
-
-protected:
-  //! Global index of an scalar on grid destination
-  std::vector<int> scalarDestGlobalIndex_;
-
-  //! Size of
-  int scalarDestGlobalSize_;
-
-    //! Scalar on grid destination
-  CScalar* scalarDest_;
-
-  //! Scalar on grid source
-  CScalar* scalarSrc_;
-  //! Axis source
-  CAxis* axisSrc_;
-  //! Domain source
-  CDomain* domainSrc_;
-};
-
-}
-#endif // __XIOS_SCALAR_ALGORITHM_TRANSFORMATION_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation.hpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation.hpp	(revision 1984)
@@ -0,0 +1,103 @@
+#ifndef __XIOS_CTransformation__
+#define __XIOS_CTransformation__
+
+#include "xios_spl.hpp"
+#include "xml_node.hpp"
+#include "transformation_enum.hpp"
+
+namespace xios {
+
+  ///--------------------------------------------------------------
+  /*!
+    \class CTransformation
+    This class describes inverse_axis in xml file.
+  */
+  template<typename T>
+  class CTransformation
+  {
+  public:
+    typedef typename std::list<std::pair<ETranformationType, CTransformation<T>* > > TransformationMapTypes;
+    typedef TransformationMapTypes TransMapTypes;
+
+    public :
+      /// Constructeurs ///
+      CTransformation(void) {}
+      virtual void checkValid(T* dest) {}
+
+      std::vector<StdString> checkAuxInputs() { return checkAuxInputs_(); }
+      static CTransformation<T>* createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node=0);
+      static CTransformation<T>* getTransformation(ETranformationType transType, const StdString& id);
+
+      virtual const string& getId(void) = 0 ;
+      virtual ETranformationType getTransformationType(void)=0;
+      virtual void inheritFrom(CTransformation<T>* src) = 0 ;
+
+      virtual const string& getId_(void) { ERROR("string Transformation<T>::getId())",<< "unimplemented virtual function for child"); } ;
+      virtual const string& getName(void) { ERROR("string Transformation<T>::getId())",<< "unimplemented virtual function for child"); } ;
+      virtual const string& getDefName(void) { ERROR("string Transformation<T>::getId())",<< "unimplemented virtual function for child"); } ;
+      /// Destructeur ///
+    public:
+      virtual ~CTransformation(void) {}
+
+    protected:
+      typedef CTransformation<T>* (*createTransformationCallBack)(const StdString&, xml::CXMLNode*);
+      typedef CTransformation<T>* (*getIdTransformationCallBack)(const StdString&);
+      typedef std::map<ETranformationType, tuple<createTransformationCallBack,getIdTransformationCallBack>> callBackMap;
+      static callBackMap* callBacks_;
+
+      static bool registerTransformation(ETranformationType transType, tuple<createTransformationCallBack,getIdTransformationCallBack> callBackFunctions);
+      static bool unregisterTransformation(ETranformationType transType);
+
+    protected:
+      virtual std::vector<StdString> checkAuxInputs_() { return std::vector<StdString>(); }
+
+  }; // class CTransformation
+
+  template<typename T>
+  typename CTransformation<T>::callBackMap* CTransformation<T>::callBacks_ = 0; //CTransformation<T>::CallBackMap();
+
+  template<typename T>
+  CTransformation<T>* CTransformation<T>::createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node)
+  {
+    int transTypeInt = transType;
+    typename callBackMap::const_iterator it = (*callBacks_).find(transType);
+    if ((*callBacks_).end() == it)
+    {
+       ERROR("CTransformation<T>::createTransformation(ETranformationType transType)",
+             << "Transformation type " << transType
+             << "doesn't exist. Please define.");
+    }
+    return (get<0>(it->second))(id,node);
+  }
+
+  template<typename T>
+  CTransformation<T>* CTransformation<T>::getTransformation(ETranformationType transType, const StdString& id)
+  {
+    int transTypeInt = transType;
+    typename callBackMap::const_iterator it = (*callBacks_).find(transType);
+    if ((*callBacks_).end() == it)
+    {
+       ERROR("CTransformation<T>::getTransformation(ETranformationType transType, const StdString& id)",
+             << "Transformation type " << transType
+             << "doesn't exist. Please define.");
+    }
+    return (get<1>(it->second))(id);
+  }
+
+  template<typename T>
+  bool CTransformation<T>::registerTransformation(ETranformationType transType,  tuple<createTransformationCallBack, getIdTransformationCallBack> functions)
+  {
+    if (0 == callBacks_) callBacks_ = new callBackMap();
+    return (* callBacks_).insert(make_pair(transType, functions)).second;
+  }
+
+  template<typename T>
+  bool CTransformation<T>::unregisterTransformation(ETranformationType transType)
+  {
+    int transTypeInt = transType;
+    return (1 == (*callBacks_).erase(transType));
+  }
+
+} // namespace xios
+
+#endif // __XIOS_CTransformation__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_enum.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_enum.hpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_enum.hpp	(revision 1984)
@@ -0,0 +1,33 @@
+#ifndef __XIOS_TRANSFORMATION_ENUM__
+#define __XIOS_TRANSFORMATION_ENUM__
+
+namespace xios
+{
+      /// ////////////////////// DÃ©finitions ////////////////////// ///
+      typedef enum transformation_type
+      {
+        TRANS_ZOOM_AXIS = 0,
+        TRANS_INVERSE_AXIS = 1,
+        TRANS_INTERPOLATE_AXIS = 2,
+        TRANS_ZOOM_DOMAIN = 3,
+        TRANS_INTERPOLATE_DOMAIN = 4,
+        TRANS_GENERATE_RECTILINEAR_DOMAIN = 5,
+        TRANS_REDUCE_AXIS_TO_SCALAR = 6,
+        TRANS_REDUCE_DOMAIN_TO_AXIS = 7,
+        TRANS_EXTRACT_DOMAIN_TO_AXIS = 8,
+        TRANS_COMPUTE_CONNECTIVITY_DOMAIN = 9,
+        TRANS_EXPAND_DOMAIN = 10,
+        TRANS_EXTRACT_AXIS_TO_SCALAR = 11,
+        TRANS_REDUCE_DOMAIN_TO_SCALAR = 12,
+        TRANS_TEMPORAL_SPLITTING = 13,
+        TRANS_REDUCE_AXIS_TO_AXIS = 14,
+        TRANS_DUPLICATE_SCALAR_TO_AXIS = 15,
+        TRANS_REDUCE_SCALAR_TO_SCALAR = 16,
+        TRANS_REORDER_DOMAIN = 17,
+        TRANS_EXTRACT_DOMAIN = 18,
+        TRANS_EXTRACT_AXIS = 19
+      } ETranformationType;
+
+} // namespace xios
+
+#endif // __XIOS_TRANSFORMATION_ENUM__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_path.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_path.cpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_path.cpp	(revision 1984)
@@ -0,0 +1,140 @@
+#include "transformation_path.hpp"
+
+namespace xios
+{
+  void CTransformationPaths::mergePaths(const CTransformationPaths& transformationPaths)
+  {
+    donePath_ = transformationPaths.donePath_ ;
+    //? if (donePath_.empty()) donePath_.push_back(transformationPaths.path_) ; // entry point
+    
+    if (!donePath_.empty())
+    {
+      TPath& remotePath = donePath_.back() ;
+      
+      // same element type and element id
+      if (std::get<0>(remotePath)==std::get<0>(path_) && std::get<1>(remotePath)==std::get<1>(path_))
+      {
+        auto it = get<2>(path_).begin() ;
+        auto remoteIt = get<2>(remotePath).begin() ;
+        for(  ; remoteIt !=get<2>(remotePath).end() ; remoteIt++ )
+        {
+          if (it==get<2>(path_).end() || *it != *remoteIt) break ;
+          else it++ ;
+        }
+
+        if (remoteIt==get<2>(remotePath).end()) get<2>(remainPath_).insert( get<2>(remainPath_).begin(), it , std::get<2>(path_).end() ) ;
+        else  remainPath_ = path_ ;
+
+      }
+      else remainPath_=path_ ;
+    }
+    else
+    {
+      remainPath_=path_ ;
+    } 
+  }
+  
+  void CTransformationPaths::mergePaths(void)
+  {
+    CTransformationPaths transformationPath ;
+    mergePaths(transformationPath) ;
+  }
+
+  CTransformationPaths CTransformationPaths::getDonePath(void)
+  {
+    CTransformationPaths returnDonePath ;
+    returnDonePath.donePath_ = donePath_ ;
+    return  returnDonePath ;
+  }
+
+  EElement CTransformationPaths::getNextElementType(void)
+  {
+    if (get<1>(remainPath_)=="") return get<0>(donePath_.back());
+    else return get<0>(remainPath_) ;
+  }
+
+  string CTransformationPaths::getNextElementId(void)
+  {
+    string sep="/" ;
+    string doneId=getPathsId(donePath_) ;
+    if (doneId=="") sep="" ;
+    TPath next = remainPath_ ;
+    get<2>(next).erase(++(get<2>(next).begin()),get<2>(next).end()) ;
+    string remainId=getPathId(next) ;
+    if (remainId=="") sep="" ;
+    return doneId+sep+remainId ;
+  }
+
+  string CTransformationPaths::getNextElementSrcId(void)
+  {
+    return getPathsId(donePath_) ;
+  }
+
+  ETranformationType CTransformationPaths::getNextTransformationType(void)
+  {
+    return get<2>(remainPath_).front().first ;
+  }
+
+  string CTransformationPaths::getNextTransformationId(void)
+  {
+    return get<2>(remainPath_).front().second ;
+  }
+
+  void CTransformationPaths::removeNextTransform(void)
+  {
+    if (get<1>(remainPath_)!="")
+    {
+      TPath newPath;
+      get<0>(newPath)=get<0>(remainPath_) ;
+      get<1>(newPath)=get<1>(remainPath_) ;
+      if (!get<2>(remainPath_).empty()) get<2>(newPath).push_back(get<2>(remainPath_).front()) ;
+      donePath_.push_back(newPath);
+      get<1>(newPath)="" ;
+      if (!get<2>(newPath).empty()) get<2>(remainPath_).pop_front() ;
+    }
+    else
+    {
+      if (!get<2>(remainPath_).empty())
+      {
+        get<2>(donePath_.back()).push_back(get<2>(remainPath_).front()) ;
+        get<2>(remainPath_).pop_front() ;
+      }
+    }
+  }
+
+
+  string CTransformationPaths::getPathId(const TPath& path)
+  {
+    string id,id1 ;
+    if (get<1>(path)!="")
+    {
+      if (get<0>(path)==EElement::DOMAIN) id="CDomain" ;
+      if (get<0>(path)==EElement::AXIS)   id="CAxis" ;
+      if (get<0>(path)==EElement::SCALAR) id="CScalar" ;
+      id=id+":"+get<1>(path) ;
+      id1="/" ;
+    }
+
+    for(auto transform : get<2>(path))
+    {
+      
+      id=id+id1 ;
+      id=id+to_string(transform.first) ; // not very nice but enough for now. Should be replace by string tranformation name
+      id=id+":"+transform.second ;
+      id1="/" ;
+    }
+    return id ;
+  }
+
+  string CTransformationPaths::getPathsId(const list<TPath>& paths)
+  {
+    string id ;
+    string sep("") ;
+    for(auto path:paths) 
+    {
+      id=id+sep+getPathId(path) ;
+      sep="//" ;
+    }
+    return id ;
+  }
+}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_path.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_path.hpp	(revision 1984)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation_path.hpp	(revision 1984)
@@ -0,0 +1,40 @@
+#ifndef __XIOS_TRANSFORMATION_PATH_HPP__
+#define __XIOS_TRANSFORMATION_PATH_HPP__
+
+#include "transformation_enum.hpp"
+#include "element_type.hpp"
+#include "xios_spl.hpp"
+
+namespace xios
+{
+  class CTransformationPaths 
+  {
+    public:
+      typedef std::tuple<EElement, string, std::list<std::pair<ETranformationType,std::string>>> TPath ;
+    
+    private:
+      TPath path_ ;
+      std::list<TPath> fullPath_ ; 
+      std::list<TPath> donePath_ ; 
+      TPath remainPath_ ; 
+      string getPathId(const TPath& path) ;
+      string getPathsId(const list<TPath>& paths) ;
+    
+    public:
+      void addPath(TPath& path) {path_=path;}
+      void mergePaths(const CTransformationPaths& transformationPath) ;
+      void mergePaths(void) ;
+      bool hasTransform(void) { return !std::get<2>(remainPath_).empty();}
+      CTransformationPaths getDonePath(void) ;
+
+      EElement getNextElementType(void);
+      std::string getNextElementId(void) ;
+      std::string getNextElementSrcId(void) ;
+      ETranformationType getNextTransformationType(void) ;
+      std::string getNextTransformationId(void) ;
+      void removeNextTransform(void) ;
+  };
+
+}
+
+#endif // __XIOS_TRANSFORMATION_PATH_HPP__
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/xios_spl.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/xios_spl.hpp	(revision 1975)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/xios_spl.hpp	(revision 1984)
@@ -8,9 +8,14 @@
 #include <unordered_map>
 #include <memory>
-
 // standard C
 #include <cstring>
 #include <cstdlib>
+
 #include <cmath>
+// bug in cmath header => macro collision marco with DOMAIN
+#ifdef DOMAIN
+#undef DOMAIN
+#endif
+
 #include <ctime>
 
@@ -24,4 +29,6 @@
 #include <queue>
 #include <valarray>
+#include <tuple>
+
 // Flux.
 #include <iostream>
@@ -32,4 +39,5 @@
 #include <boost/cast.hpp>
 #include <boost/current_function.hpp>
+
 /// Map ///
 #define xios_map std::map
@@ -61,6 +69,5 @@
 #include "log.hpp"
 using namespace std;
-using namespace boost ;
-
+//using namespace boost ;
 
 #endif //__XIOS_SPL__
