Index: /XIOS2/trunk/src/io/nc4_data_output.cpp
===================================================================
--- /XIOS2/trunk/src/io/nc4_data_output.cpp	(revision 2439)
+++ /XIOS2/trunk/src/io/nc4_data_output.cpp	(revision 2440)
@@ -142,5 +142,7 @@
          }
 
-         StdString dimVertId = StdString("nvertex").append(appendDomid);
+         StdString dimVertId ;
+         if (domain->type==CDomain::type_attr::rectilinear)  dimVertId=StdString("domain_nbounds").append(appendDomid);
+         else dimVertId=StdString("nvertex").append(appendDomid);
 
          string lonid,latid,bounds_lonid,bounds_latid ;
@@ -181,11 +183,13 @@
            if (domain->hasBounds)
            {         
-             int nvertex = domain->nvertex, idx;
-             writtenBndsLat.resize(nvertex, nbWritten);
-             writtenBndsLon.resize(nvertex, nbWritten);
+             int idx;
+             int nvertexValue = (domain->type==CDomain::type_attr::rectilinear || type==CDomain::type_attr::curvilinear) ? 4 : domain->nvertex ;
+
+             writtenBndsLat.resize(nvertexValue, nbWritten);
+             writtenBndsLon.resize(nvertexValue, nbWritten);
              CArray<double,2>& boundslat = domain->bounds_latvalue;
              CArray<double,2>& boundslon = domain->bounds_lonvalue;   
              for (idx = 0; idx < nbWritten; ++idx)
-               for (int nv = 0; nv < nvertex; ++nv)
+               for (int nv = 0; nv < nvertexValue; ++nv)
                {
                  if (indexToWrite(idx) < 0)
@@ -244,5 +248,10 @@
 
                  if (domain->hasBounds)
-                   SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 {  
+                   
+                   if (domain->type==CDomain::type_attr::rectilinear) SuperClassWriter::addDimension(dimVertId,2);
+                   else if (domain->type==CDomain::type_attr::curvilinear) SuperClassWriter::addDimension(dimVertId,4);
+                   else SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 }
 
                  int commRank ;
@@ -290,17 +299,28 @@
                      SuperClassWriter::addAttribute("bounds", bounds_latid, &latid);
 
-                     dim0.clear();
-                     dim0.push_back(dimYid);
-                     dim0.push_back(dimXid);
-                     dim0.push_back(dimVertId);
-                     SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel);
-                     SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel);
+                     if (domain->type==CDomain::type_attr::curvilinear)
+                     {
+                       dim0.clear();
+                       dim0.push_back(dimYid);
+                       dim0.push_back(dimXid);
+                       dim0.push_back(dimVertId);
+                       SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel);
+                       SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel);
+                     }
+                     else if(domain->type==CDomain::type_attr::rectilinear)
+                     {
+                       dim0.clear();
+                       dim0.push_back(dimXid);
+                       dim0.push_back(dimVertId);
+                       SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel);
+                       dim0.clear();
+                       dim0.push_back(dimYid);
+                       dim0.push_back(dimVertId);
+                       SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel);
+                     }
+
                    }
                  }
-
-                 dim0.clear();
-                 dim0.push_back(dimYid);
-                 dim0.push_back(dimXid);
-
+                
 
   // supress mask               if (server->intraCommSize > 1)
@@ -334,4 +354,9 @@
                        SuperClassWriter::writeData(writtenLat, latid, isCollective, 0);
                        SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0);
+                       if (domain->hasBounds)
+                       {
+                          SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0);
+                          SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0);
+                       }
                        break;
                      case CDomain::type_attr::rectilinear :
@@ -340,11 +365,12 @@
                        CArray<double,1> lon = writtenLon(Range(0,domain->ni-1)) ;
                        SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0);
+                       if (domain->hasBounds)
+                       {
+                          CArray<double,2> BoundsLon = writtenBndsLon(Range(0,1),Range(0,domain->ni-1));
+                          CArray<double,2> BoundsLat = writtenBndsLat(Range(1,2),Range(fromStart,toEnd,domain->ni));
+                          SuperClassWriter::writeData(BoundsLon.copy(), bounds_lonid, isCollective, 0);
+                          SuperClassWriter::writeData(BoundsLat.copy(), bounds_latid, isCollective, 0);
+                       }
                        break;
-                   }
-
-                   if (domain->hasBounds)
-                   {
-                     SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0);
-                     SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0);
                    }
                  }
@@ -365,5 +391,10 @@
 
                  if (domain->hasBounds)
-                   SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 {  
+                   
+                   if (domain->type==CDomain::type_attr::rectilinear) SuperClassWriter::addDimension(dimVertId,2);
+                   else if (domain->type==CDomain::type_attr::curvilinear) SuperClassWriter::addDimension(dimVertId,4);
+                   else SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 }
 
                  if (domain->hasLonLat)
@@ -403,11 +434,30 @@
                      SuperClassWriter::addAttribute("bounds", bounds_latid, &latid);
 
-                     dim0.clear();
-                     dim0.push_back(dimYid);
-                     dim0.push_back(dimXid);
-                     dim0.push_back(dimVertId);
-                     SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel);
-                     SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel);
+                     if (domain->type==CDomain::type_attr::curvilinear)
+                     {
+                       dim0.clear();
+                       dim0.push_back(dimYid);
+                       dim0.push_back(dimXid);
+                       dim0.push_back(dimVertId);
+                       SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel);
+                       SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel);
+                     }
+                     else if(domain->type==CDomain::type_attr::rectilinear)
+                     {
+                       dim0.clear();
+                       dim0.push_back(dimXid);
+                       dim0.push_back(dimVertId);
+                       SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel);
+                       dim0.clear();
+                       dim0.push_back(dimYid);
+                       dim0.push_back(dimVertId);
+                       SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel);
+                     }
+
                    }
+
+
+
+
                  }
 
@@ -448,8 +498,29 @@
                        SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count);
                      }
-                     break;
-                   }
-                   case CDomain::type_attr::rectilinear :
-                   {
+                     if (domain->hasBounds)
+                     {
+                       std::vector<StdSize> start(3);
+                       std::vector<StdSize> count(3);
+                      //  if (domain->isEmpty())
+                      //  {
+                      //   start[2] = start[1] = start[0] = 0;
+                      //   count[2] = count[1] = count[0] = 0;
+                      // }
+                      // else
+                       {
+                         start[2] = 0;
+                         start[1] = domain->ibegin;
+                         start[0] = domain->jbegin;
+                         count[2] = 4;
+                         count[1] = domain->ni;
+                         count[0] = domain->nj;
+                        }
+                        SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0, &start, &count);
+                        SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0, &start, &count);
+                      }
+                    break;
+                  }
+                  case CDomain::type_attr::rectilinear :
+                  {
                      if (domain->hasLonLat)
                      {
@@ -476,29 +547,35 @@
                        }
                      }
+                    
+                     if (domain->hasBounds)
+                     {
+                       std::vector<StdSize> start(2);
+                       std::vector<StdSize> count(2);
+                       if (domain->isEmpty())
+                       {
+                         start[1] = start[0] = 0;
+                         count[1] = count[0] = 0;
+                         SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0,&start,&count);
+                         SuperClassWriter::writeData(writtenBndsLon, bounds_latid, isCollective, 0,&start,&count);
+                       }
+                       else
+                       {
+                         start[1]=0 ;
+                         count[1]=2 ;
+                         start[0]=domain->jbegin;
+                         count[0]=domain->nj;
+                         CArray<double,2> BoundsLat = writtenBndsLat(Range(1,2),Range(fromStart,toEnd,domain->ni));
+                         SuperClassWriter::writeData(CArray<double,2>(BoundsLat.copy()), bounds_latid, isCollective, 0,&start,&count);
+                         
+                         start[1]=0 ;
+                         count[1]=2 ;
+                         start[0]=domain->ibegin;
+                         count[0]=domain->ni;
+                         CArray<double,2> BoundsLon = writtenBndsLon(Range(0,1),Range(0,domain->ni-1));
+                         SuperClassWriter::writeData(CArray<double,2>(BoundsLon.copy()), bounds_lonid, isCollective, 0,&start,&count);
+                       }
+                     }
                      break;
                    }
-                 }
-
-                 if (domain->hasBounds)
-                 {
-                   std::vector<StdSize> start(3);
-                   std::vector<StdSize> count(3);
-                   if (domain->isEmpty())
-                   {
-                     start[2] = start[1] = start[0] = 0;
-                     count[2] = count[1] = count[0] = 0;
-                   }
-                   else
-                   {
-                     start[2] = 0;
-                     start[1] = domain->ibegin;
-                     start[0] = domain->jbegin;
-                     count[2] = domain->nvertex;
-                     count[1] = domain->ni;
-                     count[0] = domain->nj;
-                   }
-                 
-                   SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0, &start, &count);
-                   SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0, &start, &count);
                  }
 
Index: /XIOS2/trunk/src/node/domain.cpp
===================================================================
--- /XIOS2/trunk/src/node/domain.cpp	(revision 2439)
+++ /XIOS2/trunk/src/node/domain.cpp	(revision 2440)
@@ -187,5 +187,10 @@
        size_t sizeLonLatEvent = CArray<double,1>::size(idxCount);
        if (hasBounds)
-         sizeLonLatEvent += CArray<double,2>::size(nvertex * idxCount);
+       {
+         int nvertexValue ;
+         if (type==type_attr::rectilinear || type==type_attr::curvilinear) nvertexValue=4 ;
+         else nvertexValue=nvertex ;
+         sizeLonLatEvent += CArray<double,2>::size(nvertexValue * idxCount);
+       }
 
        size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeLonLatEvent);
@@ -1428,6 +1433,6 @@
            if (hasBounds)
            {
-             bounds_lonvalue.resize(nvertex, ni * nj);
-             bounds_latvalue.resize(nvertex, ni * nj);
+             bounds_lonvalue.resize(4, ni * nj);
+             bounds_latvalue.resize(4, ni * nj);
            }
 
@@ -1443,9 +1448,12 @@
                if (hasBounds)
                {
-                 for (int n = 0; n < nvertex; ++n)
-                 {
-                   bounds_lonvalue(n,k) = bounds_lon_1d(n,i);
-                   bounds_latvalue(n,k) = bounds_lat_1d(n,j);
-                 }
+                  bounds_lonvalue(0,k) = bounds_lon_1d(0,i);
+                  bounds_latvalue(0,k) = bounds_lat_1d(0,j);
+                  bounds_lonvalue(1,k) = bounds_lon_1d(1,i);
+                  bounds_latvalue(1,k) = bounds_lat_1d(0,j);
+                  bounds_lonvalue(2,k) = bounds_lon_1d(1,i);
+                  bounds_latvalue(2,k) = bounds_lat_1d(1,j);
+                  bounds_lonvalue(3,k) = bounds_lon_1d(0,i);
+                  bounds_latvalue(3,k) = bounds_lat_1d(1,j);
                }
              }
@@ -1545,6 +1553,6 @@
            if (hasBounds)
            {
-             bounds_lonvalue.resize(nvertex, ni * nj);
-             bounds_latvalue.resize(nvertex, ni * nj);
+             bounds_lonvalue.resize(4, ni * nj);
+             bounds_latvalue.resize(4, ni * nj);
            }
 
@@ -1560,9 +1568,12 @@
                if (hasBounds)
                {
-                 for (int n = 0; n < nvertex; ++n)
-                 {
-                   bounds_lonvalue(n,k) = bounds_lon_1d(n,i);
-                   bounds_latvalue(n,k) = bounds_lat_1d(n,j);
-                 }
+                  bounds_lonvalue(0,k) = bounds_lon_1d(0,i);
+                  bounds_latvalue(0,k) = bounds_lat_1d(0,j);
+                  bounds_lonvalue(1,k) = bounds_lon_1d(1,i);
+                  bounds_latvalue(1,k) = bounds_lat_1d(0,j);
+                  bounds_lonvalue(2,k) = bounds_lon_1d(1,i);
+                  bounds_latvalue(2,k) = bounds_lat_1d(1,j);
+                  bounds_lonvalue(3,k) = bounds_lon_1d(0,i);
+                  bounds_latvalue(3,k) = bounds_lat_1d(1,j);
                }
              }
@@ -1605,93 +1616,98 @@
    TRY
    {
+     int nvertexValue ; 
      bool hasBoundValues = (0 != bounds_lonvalue.numElements()) || (0 != bounds_latvalue.numElements());
-     if (!nvertex.isEmpty() && nvertex > 0 && !hasBoundValues)
-     {
-       if (!bounds_lon_1d.isEmpty() && !bounds_lon_2d.isEmpty())
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "Only one longitude boundary attribute can be used but both 'bounds_lon_1d' and 'bounds_lon_2d' are defined." << std::endl
-               << "Define only one longitude boundary attribute: 'bounds_lon_1d' or 'bounds_lon_2d'.");
-
-       if (!bounds_lat_1d.isEmpty() && !bounds_lat_2d.isEmpty())
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "Only one latitude boundary attribute can be used but both 'bounds_lat_1d' and 'bounds_lat_2d' are defined." << std::endl
-               << "Define only one latitude boundary attribute: 'bounds_lat_1d' or 'bounds_lat_2d'.");
-
-       if ((!bounds_lon_1d.isEmpty() && bounds_lat_1d.isEmpty()) || (bounds_lon_1d.isEmpty() && !bounds_lat_1d.isEmpty()))
-       {
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "Only 'bounds_lon_1d' or 'bounds_lat_1d' is defined." << std::endl
-               << "Please define either both attributes or none.");
-       }
-
-       if ((!bounds_lon_2d.isEmpty() && bounds_lat_2d.isEmpty()) || (bounds_lon_2d.isEmpty() && !bounds_lat_2d.isEmpty()))
-       {
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "Only 'bounds_lon_2d' or 'bounds_lat_2d' is defined." << std::endl
-               << "Please define either both attributes or none.");
-       }
-
-       if (!bounds_lon_1d.isEmpty() && nvertex.getValue() != bounds_lon_1d.extent(0))
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "'bounds_lon_1d' dimension is not compatible with 'nvertex'." << std::endl
-               << "'bounds_lon_1d' dimension is " << bounds_lon_1d.extent(0)
-               << " but nvertex is " << nvertex.getValue() << ".");
-
-       if (!bounds_lon_2d.isEmpty() && nvertex.getValue() != bounds_lon_2d.extent(0))
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "'bounds_lon_2d' dimension is not compatible with 'nvertex'." << std::endl
-               << "'bounds_lon_2d' dimension is " << bounds_lon_2d.extent(0)
-               << " but nvertex is " << nvertex.getValue() << ".");
-
-       if (!bounds_lon_1d.isEmpty() && lonvalue_1d.isEmpty())
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "Since 'bounds_lon_1d' is defined, 'lonvalue_1d' must be defined too." << std::endl);
-
-       if (!bounds_lon_2d.isEmpty() && lonvalue_2d.isEmpty())
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "Since 'bounds_lon_2d' is defined, 'lonvalue_2d' must be defined too." << std::endl);
-
-       if (!bounds_lat_1d.isEmpty() && nvertex.getValue() != bounds_lat_1d.extent(0))
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "'bounds_lat_1d' dimension is not compatible with 'nvertex'." << std::endl
-               << "'bounds_lat_1d' dimension is " << bounds_lat_1d.extent(0)
-               << " but nvertex is " << nvertex.getValue() << ".");
-
-       if (!bounds_lat_2d.isEmpty() && nvertex.getValue() != bounds_lat_2d.extent(0))
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "'bounds_lat_2d' dimension is not compatible with 'nvertex'." << std::endl
-               << "'bounds_lat_2d' dimension is " << bounds_lat_2d.extent(0)
-               << " but nvertex is " << nvertex.getValue() << ".");
-
-       if (!bounds_lat_1d.isEmpty() && latvalue_1d.isEmpty())
-         ERROR("CDomain::checkBounds(void)",
-               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
-               << "Since 'bounds_lat_1d' is defined, 'latvalue_1d' must be defined too." << std::endl);
-
-       if (!bounds_lat_2d.isEmpty() && latvalue_2d.isEmpty())
-         ERROR("CDomain::checkBounds(void)",
-               << "Since 'bounds_lat_2d' is defined, 'latvalue_2d' must be defined too." << std::endl);
-
-       // In case of reading UGRID bounds values are not required
-       hasBounds = (!bounds_lat_1d.isEmpty() || !bounds_lat_2d.isEmpty() );
-     }
-     else if (hasBoundValues)
-     {
-       hasBounds = true;       
-     }
-     else
-     {
-       hasBounds = false;
-     }
+     if (hasBoundValues) 
+     {
+       hasBounds=true ;
+       return ;
+      }
+
+     if (type_attr::rectilinear == type) nvertexValue=2 ;
+     else if (type_attr::curvilinear == type) nvertexValue=4 ;
+     else if (!nvertex.isEmpty() && nvertex>0) nvertexValue = nvertex ;
+     else 
+     {
+       hasBounds=false ;
+       return ;
+     }
+    
+      if (!bounds_lon_1d.isEmpty() && !bounds_lon_2d.isEmpty())
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "Only one longitude boundary attribute can be used but both 'bounds_lon_1d' and 'bounds_lon_2d' are defined." << std::endl
+              << "Define only one longitude boundary attribute: 'bounds_lon_1d' or 'bounds_lon_2d'.");
+
+      if (!bounds_lat_1d.isEmpty() && !bounds_lat_2d.isEmpty())
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "Only one latitude boundary attribute can be used but both 'bounds_lat_1d' and 'bounds_lat_2d' are defined." << std::endl
+              << "Define only one latitude boundary attribute: 'bounds_lat_1d' or 'bounds_lat_2d'.");
+
+      if ((!bounds_lon_1d.isEmpty() && bounds_lat_1d.isEmpty()) || (bounds_lon_1d.isEmpty() && !bounds_lat_1d.isEmpty()))
+      {
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "Only 'bounds_lon_1d' or 'bounds_lat_1d' is defined." << std::endl
+              << "Please define either both attributes or none.");
+      }
+
+      if ((!bounds_lon_2d.isEmpty() && bounds_lat_2d.isEmpty()) || (bounds_lon_2d.isEmpty() && !bounds_lat_2d.isEmpty()))
+      {
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "Only 'bounds_lon_2d' or 'bounds_lat_2d' is defined." << std::endl
+              << "Please define either both attributes or none.");
+      }
+
+      if (!bounds_lon_1d.isEmpty() && nvertexValue != bounds_lon_1d.extent(0))
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "'bounds_lon_1d' dimension is not compatible with 'nvertex'." << std::endl
+              << "'bounds_lon_1d' dimension is " << bounds_lon_1d.extent(0)
+              << " but nvertex is " << nvertexValue << ".");
+
+      if (!bounds_lon_2d.isEmpty() && nvertexValue != bounds_lon_2d.extent(0))
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "'bounds_lon_2d' dimension is not compatible with 'nvertex'." << std::endl
+              << "'bounds_lon_2d' dimension is " << bounds_lon_2d.extent(0)
+              << " but nvertex is " << nvertexValue << ".");
+
+      if (!bounds_lon_1d.isEmpty() && lonvalue_1d.isEmpty())
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "Since 'bounds_lon_1d' is defined, 'lonvalue_1d' must be defined too." << std::endl);
+
+      if (!bounds_lon_2d.isEmpty() && lonvalue_2d.isEmpty())
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "Since 'bounds_lon_2d' is defined, 'lonvalue_2d' must be defined too." << std::endl);
+
+      if (!bounds_lat_1d.isEmpty() && nvertexValue != bounds_lat_1d.extent(0))
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "'bounds_lat_1d' dimension is not compatible with 'nvertex'." << std::endl
+              << "'bounds_lat_1d' dimension is " << bounds_lat_1d.extent(0)
+              << " but nvertex is " << nvertexValue << ".");
+
+      if (!bounds_lat_2d.isEmpty() && nvertex.getValue() != bounds_lat_2d.extent(0))
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "'bounds_lat_2d' dimension is not compatible with 'nvertex'." << std::endl
+              << "'bounds_lat_2d' dimension is " << bounds_lat_2d.extent(0)
+              << " but nvertex is " << nvertexValue << ".");
+
+      if (!bounds_lat_1d.isEmpty() && latvalue_1d.isEmpty())
+        ERROR("CDomain::checkBounds(void)",
+              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "
+              << "Since 'bounds_lat_1d' is defined, 'latvalue_1d' must be defined too." << std::endl);
+
+      if (!bounds_lat_2d.isEmpty() && latvalue_2d.isEmpty())
+        ERROR("CDomain::checkBounds(void)",
+              << "Since 'bounds_lat_2d' is defined, 'latvalue_2d' must be defined too." << std::endl);
+
+      // In case of reading UGRID bounds values are not required
+      hasBounds = (!bounds_lat_1d.isEmpty() || !bounds_lat_2d.isEmpty() );
    }
    CATCH_DUMP_ATTR
@@ -2451,6 +2467,9 @@
         if (hasBounds)
         {
-          list_boundslon.push_back(CArray<double,2>(nvertex, nbData));
-          list_boundslat.push_back(CArray<double,2>(nvertex, nbData));
+          int nvertexValue ;
+          if (type==type_attr::rectilinear || type==type_attr::curvilinear) nvertexValue=4 ;
+          else nvertexValue=nvertex ;
+          list_boundslon.push_back(CArray<double,2>(nvertexValue, nbData));
+          list_boundslat.push_back(CArray<double,2>(nvertexValue, nbData));
         }
 
@@ -2469,6 +2488,10 @@
             CArray<double,2>& boundslon = list_boundslon.back();
             CArray<double,2>& boundslat = list_boundslat.back();
-
-            for (nv = 0; nv < nvertex; ++nv)
+            
+            int nvertexValue ;
+            if (type==type_attr::rectilinear || type==type_attr::curvilinear) nvertexValue=4 ;
+            else nvertexValue=nvertex ;
+            
+            for (nv = 0; nv < nvertexValue; ++nv)
             {
               boundslon(nv, n) = bounds_lonvalue(nv, localInd);
@@ -2817,5 +2840,6 @@
       if (hasBounds)
       {
-        bounds_lonvalue.resize(nvertex,nbLonInd);
+        int nvertexValue = (type==type_attr::rectilinear || type==type_attr::curvilinear) ? 4 : nvertex ;
+        bounds_lonvalue.resize(nvertexValue,nbLonInd);
         bounds_lonvalue = 0.;
       }
@@ -2832,6 +2856,7 @@
            if (hasBounds)
            {          
-            for (int nv = 0; nv < nvertex; ++nv)
-              bounds_lonvalue(nv, lInd) = recvBoundsLonValue[i](nv, ind);
+              int nvertexValue = (type==type_attr::rectilinear || type==type_attr::curvilinear) ? 4 : nvertex ;
+              for (int nv = 0; nv < nvertexValue; ++nv)
+                bounds_lonvalue(nv, lInd) = recvBoundsLonValue[i](nv, ind);
            }                  
         }
@@ -2905,5 +2930,7 @@
       if (hasBounds)
       {
-        bounds_latvalue.resize(nvertex,nbLatInd);
+        int nvertexValue = (type==type_attr::rectilinear || type==type_attr::curvilinear) ? 4 : nvertex ;
+        
+        bounds_latvalue.resize(nvertexValue,nbLatInd);
         bounds_latvalue = 0. ;
       }
@@ -2920,7 +2947,9 @@
            if (hasBounds)
            {
-            CArray<double,2>& boundslat = recvBoundsLatValue[i];
-            for (int nv = 0; nv < nvertex; ++nv)
-              bounds_latvalue(nv, lInd) = boundslat(nv, ind);
+             int nvertexValue = (type==type_attr::rectilinear || type==type_attr::curvilinear) ? 4 : nvertex ;
+
+             CArray<double,2>& boundslat = recvBoundsLatValue[i];
+             for (int nv = 0; nv < nvertexValue; ++nv)
+             bounds_latvalue(nv, lInd) = boundslat(nv, ind);
            }   
           ++nbLatInd;
Index: /XIOS2/trunk/src/test/generic_testcase.f90
===================================================================
--- /XIOS2/trunk/src/test/generic_testcase.f90	(revision 2439)
+++ /XIOS2/trunk/src/test/generic_testcase.f90	(revision 2440)
@@ -1415,4 +1415,5 @@
     INTEGER :: nbp,nbp_glo, offset
     DOUBLE PRECISION, ALLOCATABLE :: lon_glo(:), lat_glo(:), lon(:), lat(:)
+    DOUBLE PRECISION, ALLOCATABLE :: bounds_lon_glo(:,:), bounds_lat_glo(:,:), bounds_lon(:,:), bounds_lat(:,:)
     LOGICAL,ALLOCATABLE :: mask(:)
     LOGICAL,ALLOCATABLE :: dom_mask(:)
@@ -1444,19 +1445,49 @@
     
     ALLOCATE(lon(0:ni-1), lat(0:nj-1), mask(0:ni*nj-1), dom_mask(0:ni*nj-1))
+    ALLOCATE(bounds_lon(2,0:ni-1), bounds_lat(2,0:nj-1))
     mask(:)=.FALSE.
     mask(offset:offset+nbp-1)=.TRUE.
     
     ALLOCATE(lon_glo(0:ni_glo-1), lat_glo(0:nj_glo-1))
-    
+    ALLOCATE(bounds_lon_glo(2,0:ni_glo-1), bounds_lat_glo(2,0:nj_glo-1))
+
     DO i=0,ni_glo-1
       lon_glo(i)=-180+(i+0.5)*(360./ni_glo)
     ENDDO
 
+    DO i=0,ni_glo-1
+      IF (i==0) THEN
+        bounds_lon_glo(1,0) = (lon_glo(ni_glo-1)-360 + lon_glo(i))/2
+      ELSE
+        bounds_lon_glo(1,i)=(lon_glo(i-1) + lon_glo(i))/2
+      ENDIF
+      IF (i==ni_glo-1) THEN
+        bounds_lon_glo(2,ni_glo-1) = (lon_glo(ni_glo-1) + lon_glo(0)+360)/2
+      ELSE
+        bounds_lon_glo(2,i)=(lon_glo(i+1) + lon_glo(i))/2
+      ENDIF
+    ENDDO
+
     DO j=0,nj_glo-1
       lat_glo(j)=-90+(j+0.5)*(180./nj_glo)
     ENDDO
-     
+  
+    DO j=0,nj_glo-1
+      IF (j==0) THEN
+        bounds_lat_glo(1,0) = -90
+      ELSE
+        bounds_lat_glo(1,j)=(lat_glo(j-1) + lat_glo(j))/2
+      ENDIF
+      IF (j==nj_glo-1) THEN
+        bounds_lat_glo(2,nj_glo-1) = 90
+      ELSE
+        bounds_lat_glo(2,j)=(lat_glo(j+1) + lat_glo(j))/2
+      ENDIF
+    ENDDO
+
     lon(:)=lon_glo(:)
     lat(:)=lat_glo(jbegin:jbegin+nj-1)
+    bounds_lon(:,:)=bounds_lon_glo(:,:)
+    bounds_lat(:,:)=bounds_lat_glo(:,jbegin:jbegin+nj-1)
 
     ALLOCATE(return_lon(0:ni*nj-1))
@@ -1509,4 +1540,5 @@
                                 jbegin=jbegin, nj=nj)
       CALL xios_set_domain_attr(TRIM(domain_id), data_dim=2, lonvalue_1d=lon, latvalue_1d=lat, mask_1d=return_mask)
+      CALL xios_set_domain_attr(TRIM(domain_id), bounds_lon_1d=bounds_lon, bounds_lat_1d=bounds_lat)
     ENDIF
     
