Index: XIOS3/trunk/src/io/nc4_data_input.cpp
===================================================================
--- XIOS3/trunk/src/io/nc4_data_input.cpp	(revision 2481)
+++ XIOS3/trunk/src/io/nc4_data_input.cpp	(revision 2507)
@@ -81,9 +81,9 @@
             if ((domain->type) != CDomain::type_attr::unstructured)
             {
-              start.push_back(domain->jbegin);
-              count.push_back(domain->nj);
+              start.push_back(domain->jbeginValue_);
+              count.push_back(domain->njValue_);
             }
-            start.push_back(domain->ibegin);
-            count.push_back(domain->ni);
+            start.push_back(domain->ibeginValue_);
+            count.push_back(domain->niValue_);
             --idxDomain;
           }
@@ -131,5 +131,5 @@
     // Verify the compatibility of dimension of declared grid and real grid in file
     int realGridDim = 1;
-    bool isUnstructuredGrid = ((gridDim < 2) ? false :  SuperClassWriter::isUnstructured(fieldId));
+    bool isUnstructuredGrid = ((gridDim < 2 || domainP.size()==0) ? false :  SuperClassWriter::isUnstructured(fieldId));
     std::map<StdString, StdSize> dimSizeMap = SuperClassWriter::getDimensions(&fieldId);
     std::list<StdString> dimList = SuperClassWriter::getDimensionsList(&fieldId);
Index: XIOS3/trunk/src/io/nc4_data_output.cpp
===================================================================
--- XIOS3/trunk/src/io/nc4_data_output.cpp	(revision 2481)
+++ XIOS3/trunk/src/io/nc4_data_output.cpp	(revision 2507)
@@ -202,6 +202,6 @@
                  else bounds_latid = "bounds_"+latName+appendDomid;
 
-                 SuperClassWriter::addDimension(dimXid, domain->ni);
-                 SuperClassWriter::addDimension(dimYid, domain->nj);
+                 SuperClassWriter::addDimension(dimXid, domain->niValue_);
+                 SuperClassWriter::addDimension(dimYid, domain->njValue_);
 
                  if (domain->hasBounds)
@@ -210,16 +210,16 @@
                  if (context->intraCommSize_ > 1)
                  {
-                   this->writeLocalAttributes(domain->ibegin,
-                                              domain->ni,
-                                              domain->jbegin,
-                                              domain->nj,
+                   this->writeLocalAttributes(domain->ibeginValue_,
+                                              domain->niValue_,
+                                              domain->jbeginValue_,
+                                              domain->njValue_,
                                               appendDomid);
 
                    if (singleDomain)
                     this->writeLocalAttributes_IOIPSL(dimXid, dimYid,
-                                                      domain->ibegin,
-                                                      domain->ni,
-                                                      domain->jbegin,
-                                                      domain->nj,
+                                                      domain->ibeginValue_,
+                                                      domain->niValue_,
+                                                      domain->jbeginValue_,
+                                                      domain->njValue_,
                                                       domain->ni_glo,domain->nj_glo,
                                                       context->intraCommRank_,context->intraCommSize_);
@@ -373,7 +373,7 @@
                      std::vector<StdSize> start(2) ;
                      std::vector<StdSize> count(2) ;
-                     start[1]=domain->ibegin;
-                     start[0]=domain->jbegin;
-                     count[1]=domain->ni ; count[0]=domain->nj ;
+                     start[1]=domain->ibeginValue_;
+                     start[0]=domain->jbeginValue_;
+                     count[1]=domain->niValue_ ; count[0]=domain->njValue_ ;
 
                      if (domain->hasLonLat)
@@ -391,14 +391,14 @@
                        std::vector<StdSize> count(1) ;
                        
-                       start[0]=domain->jbegin;
-                       count[0]=domain->nj;
+                       start[0]=domain->jbeginValue_;
+                       count[0]=domain->njValue_;
                        CArray<double,1> lat;
-                       lat.resize( domain->nj.getValue() );
-                       for (int j=0;j<domain->nj.getValue();j++) lat(j) = domain->latvalue(j*domain->ni.getValue());
+                       lat.resize( domain->njValue_);
+                       for (int j=0;j<domain->njValue_;j++) lat(j) = domain->latvalue(j*domain->niValue_);
                        SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count);
 
-                       start[0]=domain->ibegin;
-                       count[0]=domain->ni;
-                       CArray<double,1> lon = domain->lonvalue(Range(0,domain->ni-1));
+                       start[0]=domain->ibeginValue_;
+                       count[0]=domain->niValue_;
+                       CArray<double,1> lon = domain->lonvalue(Range(0,domain->niValue_-1));
                        SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count);
                      }
@@ -419,9 +419,9 @@
                    {
                      start[2] = 0;
-                     start[1] = domain->ibegin;
-                     start[0] = domain->jbegin;
+                     start[1] = domain->ibeginValue_;
+                     start[0] = domain->jbeginValue_;
                      count[2] = domain->nvertex;
-                     count[1] = domain->ni;
-                     count[0] = domain->nj;
+                     count[1] = domain->niValue_;
+                     count[0] = domain->njValue_;
                    }
                  
@@ -435,8 +435,8 @@
                    std::vector<StdSize> count(2);
 
-                   start[1] = domain->ibegin;
-                   start[0] = domain->jbegin;
-                   count[1] = domain->ni;
-                   count[0] = domain->nj;
+                   start[1] = domain->ibeginValue_;
+                   start[0] = domain->jbeginValue_;
+                   count[1] = domain->niValue_;
+                   count[0] = domain->njValue_;
                    
                    SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count);
@@ -703,6 +703,6 @@
                else
                {
-                 startNodes[0] = domain->ibegin;
-                 countNodes[0] = domain->ni ;
+                 startNodes[0] = domain->ibeginValue_;
+                 countNodes[0] = domain->niValue_ ;
                }
 
@@ -726,12 +726,12 @@
                else
                {
-                 startEdges[0] = domain->ibegin;
-                 countEdges[0] = domain->ni;
+                 startEdges[0] = domain->ibeginValue_;
+                 countEdges[0] = domain->niValue_;
                  startNodes[0] = domain->mesh->node_start;
                  countNodes[0] = domain->mesh->node_count;
                  if (countNodes[0]==0) startNodes[0]=0 ; // for netcdf error
-                 startEdgeNodes[0] = domain->ibegin;
+                 startEdgeNodes[0] = domain->ibeginValue_;
                  startEdgeNodes[1] = 0;
-                 countEdgeNodes[0] = domain->ni;
+                 countEdgeNodes[0] = domain->niValue_;
                  countEdgeNodes[1] = 2;
                }
@@ -763,6 +763,6 @@
                else
                {
-                 startFaces[0] = domain->ibegin;
-                 countFaces[0] = domain->ni ;
+                 startFaces[0] = domain->ibeginValue_;
+                 countFaces[0] = domain->niValue_ ;
                  startNodes[0] = domain->mesh->node_start;
                  countNodes[0] = domain->mesh->node_count;
@@ -785,6 +785,6 @@
                  countEdgeFaces[1]= 2;
                  
-                 startFaceConctv[0] = domain->ibegin;
-                 countFaceConctv[0] = domain->ni;
+                 startFaceConctv[0] = domain->ibeginValue_;
+                 countFaceConctv[0] = domain->niValue_;
                  startFaceConctv[1] = 0;
                  countFaceConctv[1] = domain->nvertex;
@@ -998,9 +998,9 @@
                  else
                  {
-                   start[0]=domain->ibegin;
-                   count[0]=domain->ni;
-                   startBounds[0]=domain->ibegin;
+                   start[0]=domain->ibeginValue_;
+                   count[0]=domain->niValue_;
+                   startBounds[0]=domain->ibeginValue_;
                    startBounds[1]=0 ;
-                   countBounds[0]=domain->ni;
+                   countBounds[0]=domain->niValue_;
                    countBounds[1]=nvertex ;
                  }
@@ -1110,5 +1110,5 @@
           if (!axis->label.isEmpty() && !SuperClassWriter::dimExist(strId)) SuperClassWriter::addDimension(strId, stringArrayLen);
 
-          if (axis->hasValue || !axis->label.isEmpty())
+          if (axis->hasValue() || !axis->label.isEmpty())
           {
             if (!axis->label.isEmpty()) dims.push_back(strId);
@@ -1499,5 +1499,5 @@
               }
 
-              firstGlobalIndex = domain->ibegin + domain->jbegin * domain->ni_glo;
+              firstGlobalIndex = domain->ibeginValue_ + domain->jbeginValue_ * domain->ni_glo;
 
               domain->addRelFileCompressed(this->filename);
@@ -2323,10 +2323,10 @@
                         if ((domain->type) != CDomain::type_attr::unstructured)
                         {
-                          start.push_back(domain->jbegin);
-                          count.push_back(domain->nj);
+                          start.push_back(domain->jbeginValue_);
+                          count.push_back(domain->njValue_);
                         }
                         --idx;
-                        start.push_back(domain->ibegin);
-                        count.push_back(domain->ni);
+                        start.push_back(domain->ibeginValue_);
+                        count.push_back(domain->niValue_);
                         --idx;
                       }
@@ -2383,11 +2383,11 @@
                       if ((domain->type) != CDomain::type_attr::unstructured)
                       {
-                        start.push_back(domain->jbegin);
-                        count.push_back(domain->nj);
+                        start.push_back(domain->jbeginValue_);
+                        count.push_back(domain->njValue_);
                       }
                       --idx ;
 
-                        start.push_back(domain->ibegin);
-                        count.push_back(domain->ni);
+                        start.push_back(domain->ibeginValue_);
+                        count.push_back(domain->niValue_);
                       --idx ;
                       --idxDomain;
