Index: XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp
===================================================================
--- XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp	(revision 1338)
+++ XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp	(revision 1460)
@@ -188,6 +188,30 @@
       listDimSize.push_front(*itMap);
 */
-    for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it)
-      listDimSize.push_front(*dimSizeMap.find(*it));
+
+    if (!SuperClassWriter::isRectilinear(fieldId))
+    {
+      for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it)
+        listDimSize.push_front(*dimSizeMap.find(*it));
+    }
+    else
+    {
+       std::list<StdString> coords = SuperClassWriter::getCoordinatesIdList(fieldId);
+       std::list<StdString>::const_iterator itCoord = coords.begin();
+       for (; itCoord != coords.end(); itCoord++)
+       {
+         const StdString& coord = *itCoord;
+         if (SuperClassWriter::hasVariable(coord) && !SuperClassWriter::isTemporal(coord))
+         {
+           std::map<StdString, StdSize> dimsTmp = SuperClassWriter::getDimensions(&coord);
+           StdString dimNameTmp = dimsTmp.begin()->first;
+           StdSize dimSizeTmp = dimsTmp.begin()->second;
+           listDimSize.push_front(make_pair(coord, dimSizeTmp));
+           dimSizeMap.erase(dimNameTmp);
+           dimList.remove(dimNameTmp);
+         }
+       }
+       for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it)
+        listDimSize.push_front(*dimSizeMap.find(*it));
+    }
 
     // Now process domain and axis
@@ -268,5 +292,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)
@@ -287,14 +311,35 @@
     else if ((CDomain::type_attr::curvilinear == domain->type))
     {
-      int ni = domain->ni;
-      int nj = domain->nj;
+      // Make sure that if there is no local domain defined on a process, the process still reads just one value.
+      int ni, nj, ibegin, jbegin;
+      if (domain->ni == 0)
+      {
+        ni = 1;
+        ibegin = 0;
+      }
+      else
+      {
+        ni = domain->ni;
+        ibegin = domain->ibegin;
+      }
+      if (domain->nj == 0)
+      {
+        nj = 1;
+        jbegin = 0;
+      }
+      else
+      {
+        nj = domain->nj;
+        jbegin = domain->jbegin;
+      }
+
       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();
+      nBeginLatLon[0] = jbegin; nBeginLatLon[1] = ibegin;
+      nSizeLatLon[0]  = nj; nSizeLatLon[1] = ni;
 
       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);
       }
@@ -302,5 +347,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);
       }
@@ -309,5 +354,5 @@
       StdString boundsLonName = this->getBoundsId(lonName);
 
-      int nbVertex = this->getNbVertex(fieldId);
+      int nbVertex = 4; //this->getNbVertex(fieldId);
       if (!domain->nvertex.isEmpty() && (domain->nvertex != nbVertex))
       {
@@ -324,11 +369,11 @@
 
       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] = jbegin; nSizeBndsLatLon[0] = nj;
+      nBeginBndsLatLon[1] = ibegin; nSizeBndsLatLon[1] = ni;
       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);
 
@@ -336,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);
       }      
@@ -342,12 +387,25 @@
     else if ((CDomain::type_attr::unstructured == domain->type))// || (this->isUnstructured(fieldId)))
     {
+      // Make sure that if there is no local domain defined on a process, the process still reads just one value.
+      int ni, ibegin;
+      if (domain->ni == 0)
+      {
+        ni = 1;
+        ibegin = 0;
+      }
+      else
+      {
+        ni = domain->ni;
+        ibegin = domain->ibegin;
+      }
+
       std::vector<StdSize> nBeginLatLon(1,0), nSizeLatLon(1,0);
-      nSizeLatLon[0]  = domain->ni_glo.getValue();
-      CArray<double,1> globalLonLat(domain->ni_glo.getValue());
+      nBeginLatLon[0] = ibegin;
+      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);  
       }
@@ -356,6 +414,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);
       }
@@ -379,5 +436,5 @@
 
       std::vector<StdSize> nBeginBndsLatLon(2), nSizeBndsLatLon(2);
-      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni_glo.getValue();
+      nBeginBndsLatLon[0] = ibegin; nSizeBndsLatLon[0] = ni;
       nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex;
 
@@ -496,12 +553,16 @@
 
     { // Read axis value
-      std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second);
-      CArray<double,1> readAxisValue(itMapN->second);
-      readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true);
-      int begin = 0, n = itMapN->second;
-      if (!axis->begin.isEmpty()) begin = axis->begin.getValue();
-      if (!axis->n.isEmpty()) n = axis->n.getValue();
-      axis->value.resize(n);
-      for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i);
+      bool hasValue = SuperClassWriter::hasVariable(itMapN->first);
+      if (hasValue)
+      {
+        std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second);
+        CArray<double,1> readAxisValue(itMapN->second);
+        readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true);
+        int begin = 0, n = itMapN->second;
+        if (!axis->begin.isEmpty()) begin = axis->begin.getValue();
+        if (!axis->n.isEmpty()) n = axis->n.getValue();
+        axis->value.resize(n);
+        for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i);
+      }
     }
   }
