Index: /XIOS/trunk/inputs/REMAP/iodef.xml
===================================================================
--- /XIOS/trunk/inputs/REMAP/iodef.xml	(revision 1013)
+++ /XIOS/trunk/inputs/REMAP/iodef.xml	(revision 1014)
@@ -109,9 +109,9 @@
     <domain_group id="domain_dst">
      <domain id="dst_domain">
-       <interpolate_domain file="weight.nc" />
+       <interpolate_domain write_weight="true" />
      </domain>
      <domain id="dst_domain_regular_pole" ni_glo="90" nj_glo="45" type="rectilinear">
        <generate_rectilinear_domain id="domain_regular_pole"/>
-       <interpolate_domain/>       
+       <interpolate_domain write_weight="false"/>       
        <zoom_domain ibegin="0" ni="45" jbegin="0" nj="45" />
      </domain>
Index: /XIOS/trunk/src/config/interpolate_domain_attribute.conf
===================================================================
--- /XIOS/trunk/src/config/interpolate_domain_attribute.conf	(revision 1013)
+++ /XIOS/trunk/src/config/interpolate_domain_attribute.conf	(revision 1014)
@@ -1,4 +1,3 @@
 /* GLOBAL */
-DECLARE_ATTRIBUTE(StdString, file)
 DECLARE_ATTRIBUTE(int, order)
 DECLARE_ATTRIBUTE(bool, renormalize)
Index: /XIOS/trunk/src/interface/c_attr/icinterpolate_domain_attr.cpp
===================================================================
--- /XIOS/trunk/src/interface/c_attr/icinterpolate_domain_attr.cpp	(revision 1013)
+++ /XIOS/trunk/src/interface/c_attr/icinterpolate_domain_attr.cpp	(revision 1014)
@@ -17,30 +17,4 @@
 {
   typedef xios::CInterpolateDomain* interpolate_domain_Ptr;
-
-  void cxios_set_interpolate_domain_file(interpolate_domain_Ptr interpolate_domain_hdl, const char * file, int file_size)
-  {
-    std::string file_str;
-    if (!cstr2string(file, file_size, file_str)) return;
-    CTimer::get("XIOS").resume();
-    interpolate_domain_hdl->file.setValue(file_str);
-    CTimer::get("XIOS").suspend();
-  }
-
-  void cxios_get_interpolate_domain_file(interpolate_domain_Ptr interpolate_domain_hdl, char * file, int file_size)
-  {
-    CTimer::get("XIOS").resume();
-    if (!string_copy(interpolate_domain_hdl->file.getInheritedValue(), file, file_size))
-      ERROR("void cxios_get_interpolate_domain_file(interpolate_domain_Ptr interpolate_domain_hdl, char * file, int file_size)", << "Input string is too short");
-    CTimer::get("XIOS").suspend();
-  }
-
-  bool cxios_is_defined_interpolate_domain_file(interpolate_domain_Ptr interpolate_domain_hdl)
-  {
-     CTimer::get("XIOS").resume();
-     bool isDefined = interpolate_domain_hdl->file.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-     return isDefined;
-  }
-
 
   void cxios_set_interpolate_domain_mode(interpolate_domain_Ptr interpolate_domain_hdl, const char * mode, int mode_size)
Index: /XIOS/trunk/src/node/interpolate_domain.cpp
===================================================================
--- /XIOS/trunk/src/node/interpolate_domain.cpp	(revision 1013)
+++ /XIOS/trunk/src/node/interpolate_domain.cpp	(revision 1014)
@@ -55,5 +55,5 @@
     {
       case mode_attr::read:
-        if (this->file.isEmpty())
+        if (this->weight_filename.isEmpty())
         {
           if (!this->write_weight)
@@ -64,5 +64,5 @@
         else
         {
-          weightFile = this->file;
+          weightFile = this->weight_filename;
           ifstream f(weightFile.c_str());
           if (!f.good())
@@ -75,7 +75,7 @@
         break;
       case mode_attr::read_or_compute:
-        if (!this->file.isEmpty() && !this->write_weight)
+        if (!this->weight_filename.isEmpty() && !this->write_weight)
         {
-          weightFile = this->file;
+          weightFile = this->weight_filename;
           ifstream f(weightFile.c_str());
           if (!f.good())
Index: /XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 1013)
+++ /XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 1014)
@@ -681,5 +681,5 @@
                                                                 const StdSize size)
 {
-  CONetCDF4::addDimension(name, size);  
+  return CONetCDF4::addDimension(name, size);  
 }
 
@@ -687,5 +687,10 @@
                                                                const std::vector<StdString>& dim)
 {
-  CONetCDF4::addVariable(name, type, dim);
+  return CONetCDF4::addVariable(name, type, dim);
+}
+
+void CDomainAlgorithmInterpolate::WriteNetCdf::endDefinition()
+{
+  CONetCDF4::definition_end();
 }
 
@@ -751,10 +756,17 @@
   MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, client->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, client->intraComm);
-
-  // netCdfWriter = CONetCDF4(filename, false, false, true, client->intraComm, false);
+  
+  WriteNetCdf netCdfWriter(filename, client->intraComm);  
 
   // Define some dimensions
@@ -770,8 +782,14 @@
   netCdfWriter.addVariableWrite("weight", NC_DOUBLE, dims);
 
+  // End of definition
+  netCdfWriter.endDefinition();
+
   // // Write variables
-  netCdfWriter.writeDataIndex(src_idx, "src_idx", true, 0, &start, &count);
-  netCdfWriter.writeDataIndex(dst_idx, "dst_idx", true, 0, &start, &count);
-  netCdfWriter.writeDataIndex(weights, "weight", true, 0, &start, &count);
+  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();
Index: /XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp
===================================================================
--- /XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp	(revision 1013)
+++ /XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp	(revision 1014)
@@ -59,4 +59,5 @@
     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,
