Index: /XIOS/trunk/arch/arch-X64_CURIE.path
===================================================================
--- /XIOS/trunk/arch/arch-X64_CURIE.path	(revision 659)
+++ /XIOS/trunk/arch/arch-X64_CURIE.path	(revision 660)
@@ -1,5 +1,5 @@
 NETCDF_INCDIR="-I $NETCDF_INCDIR"
 NETCDF_LIBDIR="-L $NETCDF_LIBDIR"
-NETCDF_LIB="-lnetcdf"
+NETCDF_LIB="-lnetcdf -lnetcdff"
 
 MPI_INCDIR=""
Index: /XIOS/trunk/bld.cfg
===================================================================
--- /XIOS/trunk/bld.cfg	(revision 659)
+++ /XIOS/trunk/bld.cfg	(revision 660)
@@ -31,5 +31,7 @@
 bld::target libxios.a
 #bld::target generate_fortran_interface.exe 
-bld::target xios_server.exe test_client.exe parse_xml.exe test_complete.exe test_xios_interface.exe test_new_features.exe test_unstruct_complete.exe
+bld::target xios_server.exe test_remap.exe
+bld::target test_new_features.exe test_unstruct_complete.exe 
+bld::target test_client.exe test_complete.exe
 bld::exe_dep
 
@@ -56,3 +58,4 @@
 bld::excl_dep        use::mod_prism_proto
 bld::excl_dep        use::mod_prism
+bld::excl_dep        use::netcdf
 bld::excl_dep        inc::mpif.h
Index: /XIOS/trunk/inputs/REMAP/iodef.xml
===================================================================
--- /XIOS/trunk/inputs/REMAP/iodef.xml	(revision 660)
+++ /XIOS/trunk/inputs/REMAP/iodef.xml	(revision 660)
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<simulation>
+
+ <context id="test">
+   <calendar type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-28 15:00:00 + 1d" />
+
+
+   <field_definition level="1" >
+     <field id="src_field"  operation="instant" grid_ref="src_grid"/>
+     <field id="dst_field"  operation="instant" field_ref="src_field" grid_ref="dst_grid"/>
+   </field_definition>
+
+
+   <file_definition type="multiple_file" par_access="collective" output_freq="1ts" output_level="10" enabled=".TRUE.">
+     <file id="output" name="output">
+        <field field_ref="src_field" name="field" />
+     </file>
+     <file id="output_dst" name="output_dst">
+        <field field_ref="dst_field" name="field" />
+     </file>
+   </file_definition>
+
+
+   <axis_definition>
+   </axis_definition>
+
+   <domain_definition>
+     <domain id="src_domain" />
+     <domain id="dst_domain" >
+       <interpolate_from_file_domain file="weight.nc" />
+     </domain>
+   </domain_definition>
+
+   <grid_definition>
+     <grid id="dst_grid">
+       <domain domain_ref="dst_domain" />
+     </grid>
+     <grid id="src_grid">
+       <domain domain_ref="src_domain" />
+     </grid>
+   </grid_definition>
+  </context>
+
+
+  <context id="xios">
+      <variable_definition>
+        <variable_group id="buffer">
+            <variable id="optimal_buffer_size" type="string">performance</variable>
+            <variable id="buffer_factor_size" type="double">30.0</variable>
+         </variable_group>
+
+        <variable_group id="parameters" >
+          <variable id="using_server" type="bool">true</variable>
+          <variable id="info_level" type="int">50</variable>
+          <variable id="print_file" type="bool">true</variable>
+        </variable_group>
+      </variable_definition>
+  </context>
+
+</simulation>
+
Index: /XIOS/trunk/make_xios
===================================================================
--- /XIOS/trunk/make_xios	(revision 659)
+++ /XIOS/trunk/make_xios	(revision 660)
@@ -156,5 +156,5 @@
 
 XIOS_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR"
-XIOS_FINCDIR="$XIOS_FINCDIR $MPI_INCDIR"
+XIOS_FINCDIR="$NETCDF_INCDIR $XIOS_FINCDIR $MPI_INCDIR"
 
 XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
Index: /XIOS/trunk/src/distribution_client.cpp
===================================================================
--- /XIOS/trunk/src/distribution_client.cpp	(revision 659)
+++ /XIOS/trunk/src/distribution_client.cpp	(revision 660)
@@ -196,5 +196,5 @@
       nZoomEnd_.at((indexMap_[idx]+1))   = domList[domIndex]->global_zoom_jbegin + domList[domIndex]->global_zoom_nj-1;
 
-      dataBegin_.at(indexMap_[idx]+1) = (2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1;
+      dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); //(2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1;
       dataIndex_.at(indexMap_[idx]+1).resize(domList[domIndex]->data_j_index.numElements());
       dataIndex_.at(indexMap_[idx]+1) = domList[domIndex]->data_j_index;
@@ -212,5 +212,5 @@
       dataIndex_.at(indexMap_[idx]) = domList[domIndex]->data_i_index;
 
-      dataNIndex_.at(idx) = domList[domIndex]->data_n_index.getValue();
+      dataNIndex_.at(idx) = domList[domIndex]->data_i_index.numElements();
       dataDims_.at(idx) = domList[domIndex]->data_dim.getValue();
 
@@ -617,11 +617,18 @@
                                         const int& dataDim, const int& ni, int& j)
 {
+//  int tempI = dataIIndex + dataIBegin,
+//      tempJ = (1 == dataDim) ? -1
+//                             : (dataJIndex + dataJBegin);
+//  int i = (dataDim == 1) ? (tempI - 1) % ni
+//                     : (tempI - 1) ;
+//  j = (dataDim == 1) ? (tempI - 1) / ni
+//                     : (tempJ - 1) ;
+
   int tempI = dataIIndex + dataIBegin,
-      tempJ = (1 == dataDim) ? -1
-                             : (dataJIndex + dataJBegin);
-  int i = (dataDim == 1) ? (tempI - 1) % ni
-                     : (tempI - 1) ;
-  j = (dataDim == 1) ? (tempI - 1) / ni
-                     : (tempJ - 1) ;
+      tempJ = (dataJIndex + dataJBegin);
+  int i = (dataDim == 1) ? (tempI) % ni
+                         : (tempI) ;
+  j = (dataDim == 1) ? (tempI) / ni
+                     : (tempJ) ;
 
   return i;
Index: /XIOS/trunk/src/node/domain.cpp
===================================================================
--- /XIOS/trunk/src/node/domain.cpp	(revision 659)
+++ /XIOS/trunk/src/node/domain.cpp	(revision 660)
@@ -135,9 +135,4 @@
          if (!area.isEmpty())
            area.transposeSelf(1, 0);
-
-//         ni=1 ;
-//         ibegin=0 ;
-//         iend=0 ;
-
       }
       else if ((ni_glo.isEmpty() || ni_glo.getValue() <= 0 ) ||
@@ -332,11 +327,12 @@
       else if (data_dim.isEmpty())
       {
-         ERROR("CDomain::checkAttributes(void)",
-               << "Data dimension undefined !") ;
+        data_dim.setValue(1);
+//         ERROR("CDomain::checkAttributes(void)",
+//               << "Data dimension undefined !") ;
       }
 
       if (data_ibegin.isEmpty())
          data_ibegin.setValue(0) ;
-      if (data_jbegin.isEmpty() && (data_dim.getValue() == 2))
+      if (data_jbegin.isEmpty())
          data_jbegin.setValue(0) ;
 
@@ -353,42 +349,42 @@
       }
 
-      if (data_dim.getValue() == 2)
-      {
-         if (!data_nj.isEmpty() && (data_nj.getValue() <= 0) )
+      if (!data_nj.isEmpty() && (data_nj.getValue() <= 0) )
+      {
+         ERROR("CDomain::checkAttributes(void)",
+               << "Data dimension is negative (data_nj).") ;
+      }
+
+      if (data_nj.isEmpty())
+         data_nj.setValue((data_dim.getValue() == 1)
+                   ? (ni.getValue() * nj.getValue())
+                   : nj.getValue());
+
+   }
+
+   //----------------------------------------------------------------
+
+   void CDomain::checkCompression(void)
+   {
+      if (!data_i_index.isEmpty())
+      {
+//         int ssize = data_i_index.numElements();
+//         if (!data_n_index.isEmpty() &&
+//            (data_n_index.getValue() != ssize))
+//         {
+//            ERROR("CDomain::checkAttributes(void)",
+//                  <<"Dimension data_i_index incompatible with data_n_index.") ;
+//         }
+//         else if (data_n_index.isEmpty())
+//            data_n_index.setValue(ssize) ;
+          if (!data_j_index.isEmpty() &&
+             (data_j_index.numElements() != data_i_index.numElements()))
+          {
+             ERROR("CDomain::checkAttributes(void)",
+                   <<"Dimension data_j_index incompatible with data_i_index.") ;
+          }
+
+         if (2 == data_dim.getValue())
          {
-            ERROR("CDomain::checkAttributes(void)",
-                  << "Data dimension is negative (data_nj).") ;
-         }
-         else if (data_nj.isEmpty())
-            data_nj.setValue(nj.getValue()) ;
-      }
-
-   }
-
-   //----------------------------------------------------------------
-
-   void CDomain::checkCompression(void)
-   {
-      if (!data_i_index.isEmpty())
-      {
-         int ssize = data_i_index.numElements();
-         if (!data_n_index.isEmpty() &&
-            (data_n_index.getValue() != ssize))
-         {
-            ERROR("CDomain::checkAttributes(void)",
-                  <<"Dimension data_i_index incompatible with data_n_index.") ;
-         }
-         else if (data_n_index.isEmpty())
-            data_n_index.setValue(ssize) ;
-
-         if (data_dim.getValue() == 2)
-         {
-            if (!data_j_index.isEmpty() &&
-               (data_j_index.numElements() != data_i_index.numElements()))
-            {
-               ERROR("CDomain::checkAttributes(void)",
-                     <<"Dimension data_j_index incompatible with data_i_index.") ;
-            }
-            else if (data_j_index.isEmpty())
+            if (data_j_index.isEmpty())
             {
                ERROR("CDomain::checkAttributes(void)",
@@ -396,20 +392,34 @@
             }
          }
+         else // (1 == data_dim.getValue())
+         {
+            if (data_j_index.isEmpty())
+            {
+              const int dni = data_ni.getValue();
+              data_j_index.resize(dni);
+              for (int j = 0; j < dni; ++j) data_j_index(j) = 0;
+            }
+
+         }
       }
       else
       {
-         if (!data_n_index.isEmpty() ||
-            ((data_dim.getValue() == 2) && (!data_j_index.isEmpty())))
+//         if (!data_n_index.isEmpty() ||
+//            ((data_dim.getValue() == 2) && (!data_j_index.isEmpty())))
+//            ERROR("CDomain::checkAttributes(void)", << "data_i_index undefined") ;
+         if ((data_dim.getValue() == 2) && (!data_j_index.isEmpty()))
             ERROR("CDomain::checkAttributes(void)", << "data_i_index undefined") ;
-      }
-
-      if (data_n_index.isEmpty())
-      { // -> bloc re-vÃ©rifiÃ© OK
-         if (data_dim.getValue() == 1)
+
+         if (1 == data_dim.getValue())
          {
             const int dni = data_ni.getValue();
             data_i_index.resize(dni) ;
+            data_j_index.resize(dni) ;
             data_n_index.setValue(dni);
-            for (int i = 0; i < dni; i++) data_i_index(i) = i+1 ;
+            for (int i = 0; i < dni; ++i)
+            {
+              data_i_index(i) = i;
+              data_j_index(i) = 0;
+            }
          }
          else   // (data_dim == 2)
@@ -421,14 +431,42 @@
             data_n_index.setValue(dni);
 
-            for(int count = 0, j = 0; j  < data_nj.getValue(); j++)
+            for(int count = 0, j = 0; j  < data_nj.getValue(); ++j)
             {
-               for(int i = 0; i < data_ni.getValue(); i++, count++)
+               for(int i = 0; i < data_ni.getValue(); ++i, ++count)
                {
-                  data_i_index(count) = i+1 ;
-                  data_j_index(count) = j+1 ;
+                  data_i_index(count) = i;
+                  data_j_index(count) = j;
                }
             }
          }
       }
+
+//      if (data_n_index.isEmpty())
+//      { // -> bloc re-vÃ©rifiÃ© OK
+//         if (data_dim.getValue() == 1)
+//         {
+//            const int dni = data_ni.getValue();
+//            data_i_index.resize(dni) ;
+//            data_n_index.setValue(dni);
+//            for (int i = 0; i < dni; i++) data_i_index(i) = i+1 ;
+//         }
+//         else   // (data_dim == 2)
+//         {
+//            const int dni = data_ni.getValue() * data_nj.getValue();
+//            data_i_index.resize(dni) ;
+//            data_j_index.resize(dni) ;
+//
+//            data_n_index.setValue(dni);
+//
+//            for(int count = 0, j = 0; j  < data_nj.getValue(); j++)
+//            {
+//               for(int i = 0; i < data_ni.getValue(); i++, count++)
+//               {
+//                  data_i_index(count) = i+1 ;
+//                  data_j_index(count) = j+1 ;
+//               }
+//            }
+//         }
+//      }
    }
 
Index: /XIOS/trunk/src/node/grid.cpp
===================================================================
--- /XIOS/trunk/src/node/grid.cpp	(revision 659)
+++ /XIOS/trunk/src/node/grid.cpp	(revision 660)
@@ -15,4 +15,6 @@
 #include "server_distribution_description.hpp"
 #include "client_server_mapping_distributed.hpp"
+#include "distribution_client.hpp"
+#include "grid_transformation.hpp"
 
 namespace xios {
Index: /XIOS/trunk/src/node/grid.hpp
===================================================================
--- /XIOS/trunk/src/node/grid.hpp	(revision 659)
+++ /XIOS/trunk/src/node/grid.hpp	(revision 660)
@@ -11,10 +11,8 @@
 #include "array_new.hpp"
 #include "attribute_array.hpp"
-#include "distribution_client.hpp"
 #include "distribution_server.hpp"
 #include "client_server_mapping.hpp"
 #include "utils.hpp"
 #include "transformation_enum.hpp"
-#include "grid_transformation.hpp"
 
 namespace xios {
Index: /XIOS/trunk/src/test/test_remap.f90
===================================================================
--- /XIOS/trunk/src/test/test_remap.f90	(revision 660)
+++ /XIOS/trunk/src/test/test_remap.f90	(revision 660)
@@ -0,0 +1,146 @@
+PROGRAM test_remap
+
+  USE xios
+  USE mod_wait
+  USE netcdf
+
+  IMPLICIT NONE
+  INCLUDE "mpif.h"
+  INTEGER :: rank
+  INTEGER :: size
+  INTEGER :: ierr
+
+  CHARACTER(len=*),PARAMETER :: id="client"
+  INTEGER :: comm
+  TYPE(xios_duration) :: dtime
+  TYPE(xios_context) :: ctx_hdl
+
+  DOUBLE PRECISION,ALLOCATABLE :: src_lon(:), dst_lon(:)
+  DOUBLE PRECISION,ALLOCATABLE :: src_lat(:), dst_lat(:)
+  DOUBLE PRECISION,ALLOCATABLE :: src_boundslon(:,:), dst_boundslon(:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: src_boundslat(:,:), dst_boundslat(:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: src_field(:)
+  INTEGER :: src_ni_glo, dst_ni_glo;
+  INTEGER :: src_nvertex, dst_nvertex;
+  INTEGER :: src_ibegin, dst_ibegin;
+  INTEGER :: src_ni, dst_ni;
+  CHARACTER(LEN=*),PARAMETER :: src_file="h14.nc"
+  CHARACTER(LEN=*),PARAMETER :: dst_file="r180x90.nc"
+  INTEGER :: ncid
+  INTEGER :: dimids(2)
+  INTEGER :: div,remain
+  INTEGER :: varid
+  INTEGER :: ts
+  INTEGER :: i
+
+  CALL MPI_INIT(ierr)
+  CALL init_wait
+
+!!! XIOS Initialization (get the local communicator)
+
+  CALL xios_initialize(id,return_comm=comm)
+  CALL MPI_COMM_RANK(comm,rank,ierr)
+  CALL MPI_COMM_SIZE(comm,size,ierr)
+
+  ierr=NF90_OPEN(src_file, NF90_NOWRITE, ncid)
+  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid)
+  ierr=NF90_INQUIRE_VARIABLE(ncid, varid,dimids=dimids)
+  ierr=NF90_INQUIRE_DIMENSION(ncid, dimids(1), len=src_nvertex)
+  ierr=NF90_INQUIRE_DIMENSION(ncid, dimids(2), len=src_ni_glo)
+
+  div    = src_ni_glo/size
+  remain = MOD( src_ni_glo, size )
+  IF (rank < remain) THEN
+    src_ni=div+1 ;
+    src_ibegin=rank*(div+1) ;
+  ELSE
+    src_ni=div ;
+    src_ibegin= remain * (div+1) + (rank-remain) * div ;
+  ENDIF
+
+  ALLOCATE(src_lon(src_ni))
+  ALLOCATE(src_lat(src_ni))
+  ALLOCATE(src_boundslon(src_nvertex,src_ni))
+  ALLOCATE(src_boundslat(src_nvertex,src_ni))
+  ALLOCATE(src_field(src_ni))
+
+  ierr=NF90_INQ_VARID(ncid,"lon",varid)
+  ierr=NF90_GET_VAR(ncid,varid, src_lon, start=(/src_ibegin+1/),count=(/src_ni/))
+  ierr=NF90_INQ_VARID(ncid,"lat",varid)
+  ierr=NF90_GET_VAR(ncid,varid, src_lat, start=(/src_ibegin+1/),count=(/src_ni/))
+  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid)
+  ierr=NF90_GET_VAR(ncid,varid,src_boundslon, start=(/1,src_ibegin+1/),count=(/src_nvertex,src_ni/))
+  ierr=NF90_INQ_VARID(ncid,"bounds_lat",varid)
+  ierr=NF90_GET_VAR(ncid,varid, src_boundslat, start=(/1,src_ibegin+1/),count=(/src_nvertex,src_ni/))
+  ierr=NF90_INQ_VARID(ncid,"val",varid)
+  ierr=NF90_GET_VAR(ncid,varid, src_field, start=(/src_ibegin+1/),count=(/src_ni/))
+
+
+  ierr=NF90_OPEN(dst_file, NF90_NOWRITE, ncid)
+  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid)
+  ierr=NF90_INQUIRE_VARIABLE(ncid, varid,dimids=dimids)
+  ierr=NF90_INQUIRE_DIMENSION(ncid, dimids(1), len=dst_nvertex)
+  ierr=NF90_INQUIRE_DIMENSION(ncid, dimids(2), len=dst_ni_glo)
+
+  div    = dst_ni_glo/size
+  remain = MOD( dst_ni_glo, size )
+  IF (rank < remain) THEN
+    dst_ni=div+1 ;
+    dst_ibegin=rank*(div+1) ;
+  ELSE
+    dst_ni=div ;
+    dst_ibegin= remain * (div+1) + (rank-remain) * div ;
+  ENDIF
+
+  ALLOCATE(dst_lon(dst_ni))
+  ALLOCATE(dst_lat(dst_ni))
+  ALLOCATE(dst_boundslon(dst_nvertex,dst_ni))
+  ALLOCATE(dst_boundslat(dst_nvertex,dst_ni))
+
+  ierr=NF90_INQ_VARID(ncid,"lon",varid)
+  ierr=NF90_GET_VAR(ncid,varid, dst_lon, start=(/dst_ibegin+1/),count=(/dst_ni/))
+  ierr=NF90_INQ_VARID(ncid,"lat",varid)
+  ierr=NF90_GET_VAR(ncid,varid, dst_lat, start=(/dst_ibegin+1/),count=(/dst_ni/))
+  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid)
+  ierr=NF90_GET_VAR(ncid,varid,dst_boundslon, start=(/1,dst_ibegin+1/),count=(/dst_nvertex,dst_ni/))
+  ierr=NF90_INQ_VARID(ncid,"bounds_lat",varid)
+  ierr=NF90_GET_VAR(ncid,varid, dst_boundslat, start=(/1,dst_ibegin+1/),count=(/dst_nvertex,dst_ni/))
+
+
+  CALL xios_context_initialize("test",comm)
+  CALL xios_get_handle("test",ctx_hdl)
+  CALL xios_set_current_context(ctx_hdl)
+
+  CALL xios_set_domain_attr("src_domain",ni_glo=src_ni_glo, ibegin=src_ibegin, ni=src_ni, type="unstructured")
+  CALL xios_set_domain_attr("src_domain",lonvalue=src_lon,latvalue=src_lat, bounds_lon=src_boundslon, bounds_lat=src_boundslat, nvertex=src_nvertex)
+  CALL xios_set_domain_attr("dst_domain",ni_glo=dst_ni_glo, ibegin=dst_ibegin, ni=dst_ni, type="unstructured")
+  CALL xios_set_domain_attr("dst_domain",lonvalue=dst_lon,latvalue=dst_lat, bounds_lon=dst_boundslon, bounds_lat=dst_boundslat, nvertex=dst_nvertex)
+
+  dtime%second = 3600
+  CALL xios_set_timestep(dtime)
+
+  CALL xios_close_context_definition()
+
+  DO ts=1,1
+    CALL xios_update_calendar(ts)
+    CALL xios_send_field("src_field",src_field)
+    CALL wait_us(5000) ;
+  ENDDO
+
+  CALL xios_context_finalize()
+
+  DEALLOCATE(src_lon, src_lat, src_boundslon,src_boundslat, src_field)
+  DEALLOCATE(dst_lon, dst_lat, dst_boundslon,dst_boundslat)
+
+  CALL MPI_COMM_FREE(comm, ierr)
+
+  CALL xios_finalize()
+
+  CALL MPI_FINALIZE(ierr)
+
+END PROGRAM test_remap
+
+
+
+
+
Index: /XIOS/trunk/src/test/test_unstruct_complete.f90
===================================================================
--- /XIOS/trunk/src/test/test_unstruct_complete.f90	(revision 659)
+++ /XIOS/trunk/src/test/test_unstruct_complete.f90	(revision 660)
@@ -190,5 +190,5 @@
     IF (mask(ind)) THEN
       data_n_index=data_n_index+1
-      data_i_index(data_n_index)=ind
+      data_i_index(data_n_index)=ind-1
       field_A_compressed(data_n_index,:)=field_A_srf(ind,:)
     ENDIF
@@ -200,5 +200,4 @@
 
   CALL xios_set_axis_attr("axis_srf",size=llm ,value=lval) ;
-!  CALL xios_set_domain_attr("domain_srf",ni_glo=ncell_glo, ni=ncell, ibegin=1, i_index=RESHAPE(i_index,(/ncell,1/) ))
   CALL xios_set_domain_attr("domain_srf", ni_glo=ncell_glo, ni=ncell, ibegin=1, i_index=i_index)
   CALL xios_set_domain_attr("domain_srf", type='unstructured', data_dim=1, data_ni=data_n_index, &
@@ -206,5 +205,5 @@
   CALL xios_set_domain_attr("domain_srf", lonvalue=lon, latvalue=lat)
   CALL xios_set_domain_attr("domain_srf", nvertex=4, bounds_lon=bounds_lon, bounds_lat=bounds_lat)
-!  CALL xios_set_domain_attr("domain_srf", mask=RESHAPE(mask,(/ncell,1/) ))
+
 
 
Index: /XIOS/trunk/src/transformation/domain_algorithm_interpolate_from_file.cpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_interpolate_from_file.cpp	(revision 659)
+++ /XIOS/trunk/src/transformation/domain_algorithm_interpolate_from_file.cpp	(revision 660)
@@ -13,4 +13,5 @@
 #include "distribution_client.hpp"
 #include "client_server_mapping_distributed.hpp"
+#include "netcdf.hpp"
 
 namespace xios {
@@ -34,7 +35,7 @@
   std::string filename = interpDomain_->file.getValue();
   std::map<int,std::vector<std::pair<int,double> > > interpMapValue;
-//  readInterpolationInfo(filename, interpMapValue);
-
-  randomizeInterpolationInfo(interpMapValue);
+  readInterpolationInfo(filename, interpMapValue);
+
+  //randomizeInterpolationInfo(interpMapValue);
   boost::unordered_map<size_t,int> globalIndexOfDomainDest;
   int ni = domainDest_->ni.getValue();
@@ -232,6 +233,52 @@
                                                                 std::map<int,std::vector<std::pair<int,double> > >& interpMapValue)
 {
-
-}
-
-}
+  int ncid ;
+  int weightDimId ;
+  size_t nbWeightGlo ;
+
+  CContext* context = CContext::getCurrent();
+  CContextClient* client=context->client;
+  int clientRank = client->clientRank;
+  int clientSize = client->clientSize;
+  
+  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) ;
+        
+  for(size_t ind=0; ind<nbWeight;++ind)
+    interpMapValue[dstIndex[ind]].push_back(make_pair(srcIndex[ind],weight[ind]));
+}
+
+}
Index: /XIOS/trunk/src/transformation/grid_transformation.cpp
===================================================================
--- /XIOS/trunk/src/transformation/grid_transformation.cpp	(revision 659)
+++ /XIOS/trunk/src/transformation/grid_transformation.cpp	(revision 660)
@@ -17,4 +17,5 @@
 #include "transformation_mapping.hpp"
 #include "axis_algorithm_transformation.hpp"
+#include "distribution_client.hpp"
 
 namespace xios {
