Index: XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute_private.conf
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute_private.conf	(revision 1409)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute_private.conf	(revision 1410)
@@ -10,9 +10,9 @@
 DECLARE_ATTRIBUTE_PRIVATE(double,  bounds_lat_end)
 
-// Array contain whole value (non distributed) of longitude and latitude read from a file
+//  Array contain whole value (non distributed) of longitude and latitude read from a file
 DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_rectilinear_read_from_file)
 DECLARE_ARRAY_PRIVATE(double, 1, latvalue_rectilinear_read_from_file)
 
-// Array contain whole value (non distributed) of longitude and latitude of curvilinear read from a file
+// Array containing longitude and latitude of LOCAL curvilinear domain to be read from a file
 DECLARE_ARRAY_PRIVATE(double, 2, lonvalue_curvilinear_read_from_file)
 DECLARE_ARRAY_PRIVATE(double, 2, latvalue_curvilinear_read_from_file)
@@ -20,5 +20,5 @@
 DECLARE_ARRAY_PRIVATE(double, 3, bounds_latvalue_curvilinear_read_from_file)
 
-// Array contain whole value (non distributed) of longitude and latitude of unstructured read from a file
+// Array containing longitude and latitude of LOCAL unstructured domain to be read from a file
 DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_unstructured_read_from_file)
 DECLARE_ARRAY_PRIVATE(double, 1, latvalue_unstructured_read_from_file)
Index: XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp	(revision 1409)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp	(revision 1410)
@@ -264,5 +264,5 @@
     if ((CDomain::type_attr::rectilinear == domain->type))
     {
-      // Ok, try to read some f.. attributes such as longitude and latitude
+      // Ok, try to read some attributes such as longitude and latitude
       bool hasLat = SuperClassWriter::hasVariable(itMapNj->first);
       if (hasLat)
@@ -283,14 +283,60 @@
     else if ((CDomain::type_attr::curvilinear == domain->type))
     {
-      int ni = domain->ni;
-      int nj = domain->nj;
+      int ni, nj;
       std::vector<StdSize> nBeginLatLon(2), nSizeLatLon(2);
-      nBeginLatLon[0] = 0; nBeginLatLon[1] = 0;
-      nSizeLatLon[0]  = domain->nj_glo.getValue(); nSizeLatLon[1] = domain->ni_glo.getValue();
+
+      if (domain->ni.isEmpty())
+      {
+        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)",
+          << " Value of attribute ni should be defined for domain " << domain->getDomainOutputName()
+          << " in file " << this->filename << "."
+          << " The value can be provided by a user or generated automatically by XIOS."
+          << " Functionality generate_rectilinear_domain can also be used for curvilinear domains."
+          << std::endl);
+      }
+
+      if (domain->nj.isEmpty())
+      {
+        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)",
+          << " Value of attribute nj should be defined for domain " << domain->getDomainOutputName()
+          << " in file " << this->filename << "."
+          << " The value can be provided by a user or generated automatically by XIOS."
+          << " Functionality generate_rectilinear_domain can also be used for curvilinear domains."
+          << std::endl);
+      }
+
+      if (domain->ibegin.isEmpty())
+      {
+        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)",
+          << " Value of attribute ibegin should be defined for domain " << domain->getDomainOutputName()
+          << " in file " << this->filename << "."
+          << " The value can be provided by a user or generated automatically by XIOS."
+          << " Functionality generate_rectilinear_domain can also be used for curvilinear domains."
+          << std::endl);
+      }
+
+      if (domain->jbegin.isEmpty())
+      {
+        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)",
+          << " Value of attribute jbegin should be defined for domain " << domain->getDomainOutputName()
+          << " in file " << this->filename << "."
+          << " The value can be provided by a user or generated automatically by XIOS."
+          << " Functionality generate_rectilinear_domain can also be used for curvilinear domains."
+          << std::endl);
+      }
+
+      ni = domain->ni;
+      nj = domain->nj;
+      nBeginLatLon[0] = domain->jbegin; nBeginLatLon[1] = domain->ibegin;
+      nSizeLatLon[0]  = nj; nSizeLatLon[1] = ni;
+//      ni = domain->ni_glo;
+//      nj = domain->nj_glo;
+//      nBeginLatLon[0] = 0; nBeginLatLon[1] = 0;
+//      nSizeLatLon[0]  = domain->nj_glo.getValue(); nSizeLatLon[1] = domain->ni_glo.getValue();
 
       StdString latName = this->getLatCoordName(fieldId);
       if (SuperClassWriter::hasVariable(latName))
       {
-        domain->latvalue_curvilinear_read_from_file.resize(domain->ni_glo,domain->nj_glo);
+        domain->latvalue_curvilinear_read_from_file.resize(ni,nj);
         readFieldVariableValue(domain->latvalue_curvilinear_read_from_file, latName, nBeginLatLon, nSizeLatLon);
       }
@@ -298,5 +344,5 @@
       if (SuperClassWriter::hasVariable(lonName))
       {
-        domain->lonvalue_curvilinear_read_from_file.resize(domain->ni_glo,domain->nj_glo);
+        domain->lonvalue_curvilinear_read_from_file.resize(ni,nj);
         readFieldVariableValue(domain->lonvalue_curvilinear_read_from_file, lonName, nBeginLatLon, nSizeLatLon);
       }
@@ -320,11 +366,14 @@
 
       std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3);
-      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue();
-      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->ni_glo.getValue();
+      nBeginBndsLatLon[0] = domain->jbegin; nSizeBndsLatLon[0] = domain->nj.getValue();
+      nBeginBndsLatLon[1] = domain->ibegin; nSizeBndsLatLon[1] = domain->ni.getValue();
       nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex;
+//      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue();
+//      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->ni_glo.getValue();
+//      nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex;
 
       if (SuperClassWriter::hasVariable(boundsLatName))
       {
-        domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni_glo,domain->nj_glo);
+        domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex,ni,nj);
         readFieldVariableValue(domain->bounds_latvalue_curvilinear_read_from_file, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon);
 
@@ -332,5 +381,5 @@
       if (SuperClassWriter::hasVariable(boundsLonName)) 
       {
-        domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni_glo,domain->nj_glo);
+        domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex,ni,nj);
         readFieldVariableValue(domain->bounds_lonvalue_curvilinear_read_from_file, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon);
       }      
@@ -338,12 +387,33 @@
     else if ((CDomain::type_attr::unstructured == domain->type))// || (this->isUnstructured(fieldId)))
     {
+      if (domain->ni.isEmpty())
+      {
+        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)",
+          << " Value of attribute ni should be defined for domain " << domain->getDomainOutputName()
+          << " in file " << this->filename << "."
+          << std::endl);
+      }
+
+      if (domain->ibegin.isEmpty())
+      {
+        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)",
+          << " Value of attribute ibegin should be defined for domain " << domain->getDomainOutputName()
+          << " in file " << this->filename << "."
+          << std::endl);
+      }
+
+      int ni;
       std::vector<StdSize> nBeginLatLon(1,0), nSizeLatLon(1,0);
-      nSizeLatLon[0]  = domain->ni_glo.getValue();
-      CArray<double,1> globalLonLat(domain->ni_glo.getValue());
+
+      ni = domain->ni;
+      nBeginLatLon[0] = domain->ibegin;
+//      ni = domain->ni_glo;
+//      nBeginLatLon[0] = 0;
+      nSizeLatLon[0] = ni;
 
       StdString latName = this->getLatCoordName(fieldId);
       if (SuperClassWriter::hasVariable(latName))
       {
-        domain->latvalue_unstructured_read_from_file.resize(domain->ni_glo);
+        domain->latvalue_unstructured_read_from_file.resize(ni);
         readFieldVariableValue(domain->latvalue_unstructured_read_from_file, latName, nBeginLatLon, nSizeLatLon);  
       }
@@ -352,6 +422,5 @@
       if (SuperClassWriter::hasVariable(lonName)) //(0 != lonName.compare(""))
       {
-        // readFieldVariableValue(globalLonLat, lonName, nBeginLatLon, nSizeLatLon);
-        domain->lonvalue_unstructured_read_from_file.resize(domain->ni_glo);
+        domain->lonvalue_unstructured_read_from_file.resize(ni);
         readFieldVariableValue(domain->lonvalue_unstructured_read_from_file, lonName, nBeginLatLon, nSizeLatLon);
       }
@@ -375,8 +444,11 @@
 
       std::vector<StdSize> nBeginBndsLatLon(2), nSizeBndsLatLon(2);
-      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni_glo.getValue();
-      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex;
-
-      if (SuperClassWriter::hasVariable(boundsLatName)) 
+
+      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni.getValue();
+      nBeginBndsLatLon[1] = domain->ibegin.getValue(); nSizeBndsLatLon[1] = nbVertex;
+//      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni_glo.getValue();
+//      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex;
+
+        if (SuperClassWriter::hasVariable(boundsLatName))
       {
         domain->bounds_latvalue_unstructured_read_from_file.resize(nSizeBndsLatLon[1], nSizeBndsLatLon[0]);
Index: XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp	(revision 1409)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp	(revision 1410)
@@ -256,5 +256,5 @@
 
    /*!
-     Redistribute RECTILINEAR domain with a number of local domains.
+     Redistribute RECTILINEAR or CURVILINEAR domain with a number of local domains.
    All attributes ni,nj,ibegin,jbegin (if defined) will be rewritten
    The optional attributes lonvalue, latvalue will be added. Because this function only serves (for now)
@@ -531,4 +531,5 @@
    void CDomain::fillInCurvilinearLonLat()
    {
+
      if (!lonvalue_curvilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty())
      {
@@ -536,5 +537,6 @@
        for (int jdx = 0; jdx < nj; ++jdx)
         for (int idx = 0; idx < ni; ++idx)
-         lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin);
+            lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx, jdx);
+//            lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin);
 
        lonvalue_curvilinear_read_from_file.free();
@@ -546,5 +548,6 @@
        for (int jdx = 0; jdx < nj; ++jdx)
         for (int idx = 0; idx < ni; ++idx)
-         latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin);
+            latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx, jdx);
+//            latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin);
 
        latvalue_curvilinear_read_from_file.free();
@@ -557,5 +560,6 @@
         for (int idx = 0; idx < ni; ++idx)
           for (int ndx = 0; ndx < nvertex; ++ndx)
-         bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin);
+              bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx, jdx);
+//              bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin);
 
        bounds_lonvalue_curvilinear_read_from_file.free();
@@ -568,5 +572,6 @@
         for (int idx = 0; idx < ni; ++idx)
           for (int ndx = 0; ndx < nvertex; ++ndx)
-            bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin);
+              bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx, jdx);
+//              bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin);
 
        bounds_latvalue_curvilinear_read_from_file.free();
@@ -584,5 +589,5 @@
      {
        i_index.resize(ni);
-       for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx;
+//       for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx;
      }
 
@@ -591,5 +596,6 @@
         lonvalue_1d.resize(ni);
         for (int idx = 0; idx < ni; ++idx)
-          lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(i_index(idx));
+//          lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(i_index(idx));
+          lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(idx);
 
         // We dont need these values anymore, so just delete them
@@ -601,5 +607,6 @@
         latvalue_1d.resize(ni);
         for (int idx = 0; idx < ni; ++idx)
-          latvalue_1d(idx) =  latvalue_unstructured_read_from_file(i_index(idx));
+//          latvalue_1d(idx) =  latvalue_unstructured_read_from_file(i_index(idx));
+          latvalue_1d(idx) =  latvalue_unstructured_read_from_file(idx);
 
         // We dont need these values anymore, so just delete them
@@ -613,5 +620,6 @@
         for (int idx = 0; idx < ni; ++idx)
           for (int jdx = 0; jdx < nbVertex; ++jdx)
-            bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, i_index(idx));
+//            bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, i_index(idx));
+            bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, idx);
 
         // We dont need these values anymore, so just delete them
@@ -625,5 +633,6 @@
         for (int idx = 0; idx < ni; ++idx)
           for (int jdx = 0; jdx < nbVertex; ++jdx)
-            bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, i_index(idx));
+//            bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, i_index(idx));
+            bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, idx);
 
         // We dont need these values anymore, so just delete them
Index: XIOS/dev/XIOS_DEV_CMIP6/src/transformation/domain_algorithm_generate_rectilinear.hpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/transformation/domain_algorithm_generate_rectilinear.hpp	(revision 1409)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/transformation/domain_algorithm_generate_rectilinear.hpp	(revision 1410)
@@ -20,6 +20,6 @@
 /*!
   \class CDomainAlgorithmGenerateRectilinear
-  Generate a rectilinear domain and fill in necessary its attributes automatically
-  A new rectilinear domain will also be distributed automatically among the processes.
+  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.
 */
