Index: XMLIO_V2/dev/dev_rv/src/xmlio/config/domain_attribute.conf
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/config/domain_attribute.conf	(revision 183)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/config/domain_attribute.conf	(revision 184)
@@ -40,4 +40,10 @@
 
 /* LOCAL */
+DECLARE_ATTRIBUTE(int             , zoom_ni_loc)
+DECLARE_ATTRIBUTE(int             , zoom_nj_loc)
+DECLARE_ATTRIBUTE(int             , zoom_ibegin_loc)
+DECLARE_ATTRIBUTE(int             , zoom_jbegin_loc)
+
+/* LOCAL */
 DECLARE_ATTRIBUTE(int             , data_n_index)
 DECLARE_ATTRIBUTE(ARRAY(int, 1)   , data_i_index)
Index: XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90	(revision 183)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90	(revision 184)
@@ -24,7 +24,8 @@
       TYPE(XDate)                       :: init_date_nemo  = XDate(1985, 03, 15, 17, 35, 00)
       TYPE(XHandle)                     :: nemo_style_ctxt = NULLHANDLE
-      TYPE(XHandle)                     :: temp_mod   = NULLHANDLE, &
-                                           temp_mod_  = NULLHANDLE, &
-                                           temp_mod__ = NULLHANDLE
+      TYPE(XHandle)                     :: temp_mod    = NULLHANDLE, &
+                                           temp_mod_   = NULLHANDLE, &
+                                           temp_mod__  = NULLHANDLE, &
+                                           temp_mod___ = NULLHANDLE
 
 
@@ -130,4 +131,19 @@
                                 long_name_     = "le champ 4", &
                                 grid_ref_   = "simple_grille")
+                                
+      CALL xml_tree_add(parent_hdl  = temp_mod,        &
+                        parent_type = GFIELD,          &
+                        child_hdl   = temp_mod__,      &
+                        child_type  = EFIELD,          &
+                        child_id    = "champ_3D_k8_average_zoom")
+
+      CALL set_field_attributes(field_hdl      = temp_mod__,   &
+                                ftype          = EFIELD,       &
+                                prec_          = 8,            &
+                                operation_     = "average",    &
+                                name_          = "champ5",     &
+                                standard_name_ = "lechamp5",   &
+                                long_name_     = "le champ 5", &
+                                grid_ref_   = "simple_grille_zoom")
 
       CALL xml_tree_add(parent_hdl  = temp_mod_,       &
@@ -158,4 +174,5 @@
 
       ! ---------> axis_definition
+      
       CALL handle_create(temp_mod, GAXIS,  "axis_definition")
       CALL xml_tree_add(parent_hdl  = temp_mod,   &
@@ -190,10 +207,10 @@
                         child_type  = GDOMAIN,    &
                         child_id    = "all_domain")
-
-      CALL xml_tree_add(parent_hdl  = temp_mod_,  &
-                        parent_type = GDOMAIN,    &
-                        child_hdl   = temp_mod,   &
-                        child_type  = EDOMAIN,    &
-                        child_id    = "simple_domaine0")
+                        
+      CALL xml_tree_add(parent_hdl  = temp_mod_,   &
+                        parent_type = GDOMAIN,     &
+                        child_hdl   = temp_mod___, &
+                        child_type  = GDOMAIN,     &
+                        child_id    = "simple_domaine_grp")
 
       IF (rankGrp .EQ. 0) THEN
@@ -211,11 +228,8 @@
          data_ni     = 50
          data_ibegin = 1
-      END IF
-
-      CALL set_domain_attributes(domain_hdl     = temp_mod,       &
-                                 ftype          = EDOMAIN,        &
-                                 name_          = "domaine0",     &
-                                 standard_name_ = "ledomaine0",   &
-                                 long_name_     = "le domaine 0", &
+      END IF 
+
+      CALL set_domain_attributes(domain_hdl     = temp_mod___,    &
+                                 ftype          = GDOMAIN,        &
                                  lonvalue_      = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), &
                                  latvalue_      = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), &
@@ -228,5 +242,33 @@
                                  jend_          = jend,           &
                                  data_ni_       = data_ni,        &
-                                 data_ibegin_   = data_ibegin)
+                                 data_ibegin_   = data_ibegin)                       
+
+      CALL xml_tree_add(parent_hdl  = temp_mod___,&
+                        parent_type = GDOMAIN,    &
+                        child_hdl   = temp_mod,   &
+                        child_type  = EDOMAIN,    &
+                        child_id    = "simple_domaine0")
+
+      CALL set_domain_attributes(domain_hdl     = temp_mod,       &
+                                 ftype          = EDOMAIN,        &
+                                 name_          = "domaine0",     &
+                                 standard_name_ = "ledomaine0",   &
+                                 long_name_     = "le domaine 0")
+                                 
+      CALL xml_tree_add(parent_hdl  = temp_mod___,&
+                        parent_type = GDOMAIN,    &
+                        child_hdl   = temp_mod,   &
+                        child_type  = EDOMAIN,    &
+                        child_id    = "simple_domaine0_zoom")
+                        
+      CALL set_domain_attributes(domain_hdl     = temp_mod,           &
+                                 ftype          = EDOMAIN,            &
+                                 name_          = "domaine0zoom",     &
+                                 standard_name_ = "ledomaine0zoom",   &
+                                 long_name_     = "le domaine 0 zoom",&
+                                 zoom_ibegin_   = 21,                 &
+                                 zoom_jbegin_   = 5 ,                 &
+                                 zoom_ni_       = 60,                 &
+                                 zoom_nj_       = 15)
 
       CALL xml_tree_add(parent_hdl  = temp_mod_,  &
@@ -251,5 +293,5 @@
                                  ftype          = EDOMAIN,        &
                                  name_          = "domaine1",     &
-                                 standard_name_ = "ledomaine0",   &
+                                 standard_name_ = "ledomaine1",   &
                                  long_name_     = "le domaine 1", &
                                  lonvalue_      = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), &
@@ -277,4 +319,17 @@
                                domain_ref_  = "simple_domaine1", &
                                axis_ref_    = "simple_axe")
+                               
+      CALL xml_tree_add(parent_hdl  = temp_mod,   &
+                        parent_type = GGRID,      &
+                        child_hdl   = temp_mod_,  &
+                        child_type  = EGRID,      &
+                        child_id    = "simple_grille_zoom")
+
+      CALL set_grid_attributes(grid_hdl     = temp_mod_,         &
+                               ftype        = EGRID,             &
+                               name_        = "grille2",         &
+                               description_ = "la grille 2",     &
+                               domain_ref_  = "simple_domaine0_zoom", &
+                               axis_ref_    = "simple_axe")
 
       ! ---------> file_definition
@@ -299,4 +354,13 @@
                         child_hdl   = temp_mod__, &
                         child_type  = EFIELD)
+                        
+      CALL set_field_attributes(field_hdl      = temp_mod__,       &
+                                ftype          = EFIELD,           &
+                                field_ref_     = "champ_3D_k8_average_zoom")  
+
+      CALL xml_tree_add(parent_hdl  = temp_mod_,  &
+                        parent_type = EFILE,      &
+                        child_hdl   = temp_mod__, &
+                        child_type  = EFIELD)
 
       CALL set_field_attributes(field_hdl      = temp_mod__,       &
Index: XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp	(revision 183)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp	(revision 184)
@@ -41,4 +41,20 @@
    {
       return (this->relFiles);
+   }
+
+   //----------------------------------------------------------------
+   
+   bool CDomain::hasZoom(void) const
+   {
+      return ((this->zoom_ni.getValue() != this->ni_glo.getValue()) && 
+              (this->zoom_nj.getValue() != this->nj_glo.getValue()));
+   }
+   
+   //----------------------------------------------------------------
+   
+   bool CDomain::isEmpty(void) const
+   {
+      return ((this->zoom_ni_loc.getValue() == 0) || 
+              (this->zoom_nj_loc.getValue() == 0));
    }
 
@@ -196,5 +212,5 @@
       if (!zoom_ibegin.isEmpty())
       {
-         int zoom_iend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
+         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
          int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
          
@@ -203,5 +219,5 @@
          iend_mask   = min (iend.getValue(), zoom_iend);
          jend_mask   = min (jend.getValue(), zoom_jend);
-         
+                 
          ibegin_mask -= ibegin.getValue();
          jbegin_mask -= jbegin.getValue();
@@ -211,9 +227,11 @@
       
       //~ std::cout << "-------------------" << std::endl
-      //~           << "zoom : " << std::boolalpha << (!zoom_ibegin.isEmpty()) << std::endl
-      //~           << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl
-      //~           << "i : " << ibegin_mask << ", " << iend_mask << std::endl
-      //~           << "j : " << jbegin_mask << ", " << jend_mask << std::endl
-      //~           << "-------------------" << std::endl;
+                //~ << "zoom : " << std::boolalpha << this->hasZoom() << std::endl
+                //~ << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl
+                //~ << "it : " << ibegin.getValue() << ", " << iend.getValue() << std::endl
+                //~ << "jt : " << jbegin.getValue() << ", " << jend.getValue() << std::endl
+                //~ << "im : " << ibegin_mask << ", " << iend_mask << std::endl
+                //~ << "jm : " << jbegin_mask << ", " << jend_mask << std::endl
+                //~ << "-------------------" << std::endl;
 
       if (!mask.isEmpty())
@@ -250,5 +268,4 @@
             }
          }
-               
                
          mask.setValue(__arr);
@@ -436,4 +453,5 @@
    void CDomain::checkZoom(void)
    {
+      // RÃ©solution et vÃ©rification des donnÃ©es globales de zoom.
       if (!this->zoom_ni.isEmpty() || !this->zoom_nj.isEmpty() ||
           !this->zoom_ibegin.isEmpty() || !this->zoom_jbegin.isEmpty())
@@ -447,14 +465,66 @@
          else
          {
-            int zoom_iend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
+            int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
             int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
                 
             if (zoom_ibegin.getValue() < 1  || zoom_jbegin.getValue() < 1 ||
-                zoom_iend > iend.getValue() || zoom_jend > jend.getValue())
+                zoom_iend > ni_glo.getValue() || zoom_jend > nj_glo.getValue())
                ERROR("CDomain::checkZoom(void)",
                      << "Zoom mal dÃ©fini,"
                      << " vÃ©rifiez les valeurs zoom_ni, zoom_nj, zoom_ibegin, zoom_ibegin") ;
          }
-      }   
+      }
+      else
+      {
+         this->zoom_ni.setValue(this->ni_glo.getValue()); 
+         this->zoom_nj.setValue(this->nj_glo.getValue());
+         this->zoom_ibegin.setValue(1);
+         this->zoom_jbegin.setValue(1);
+      }
+      // RÃ©solution des donnÃ©es locales de zoom.
+      {
+         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
+         int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
+         
+         if ((zoom_ibegin.getValue() > iend.getValue()) || 
+             (zoom_iend < ibegin.getValue()))
+         {
+            zoom_ni_loc.setValue(0);
+            zoom_ibegin_loc.setValue(-1);
+         }
+         else
+         {
+            int zoom_ibegin_loc_ = (zoom_ibegin.getValue() > ibegin.getValue()) 
+                                 ? zoom_ibegin.getValue()
+                                 : ibegin.getValue();
+            int zoom_iend_loc_  = (zoom_iend < iend.getValue()) 
+                                 ? zoom_iend
+                                 : iend.getValue();
+            int zoom_ni_loc_ = zoom_iend_loc_ - zoom_ibegin_loc_ + 1;
+            
+            zoom_ni_loc.setValue(zoom_ni_loc_);
+            zoom_ibegin_loc.setValue(zoom_ibegin_loc_-ibegin.getValue()+1);
+         }
+         
+         if ((zoom_jbegin.getValue() > jend.getValue()) || 
+             (zoom_jend < jbegin.getValue()))
+         {
+            zoom_nj_loc.setValue(0);
+            zoom_jbegin_loc.setValue(-1);
+         }
+         else
+         {
+            int zoom_jbegin_loc_ = (zoom_jbegin.getValue() > jbegin.getValue()) 
+                                 ? zoom_jbegin.getValue()
+                                 : jbegin.getValue();
+            int zoom_jend_loc_  = (zoom_jend < jend.getValue()) 
+                                 ? zoom_jend
+                                 : jend.getValue();
+            int zoom_nj_loc_ = zoom_jend_loc_ - zoom_jbegin_loc_ + 1;
+            
+            zoom_nj_loc.setValue(zoom_nj_loc_);
+            zoom_jbegin_loc.setValue(zoom_jbegin_loc_-jbegin.getValue()+1);
+         }
+      }
    }
 
Index: XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp	(revision 183)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp	(revision 184)
@@ -83,4 +83,6 @@
          /// Test ///
          bool IsWritten(const StdString & filename) const;
+         bool hasZoom(void) const;
+         bool isEmpty(void) const;
          
       public :
Index: XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp	(revision 183)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp	(revision 184)
@@ -148,5 +148,5 @@
 
    void CGrid::computeIndex(void)
-   {    
+   {  
       const int ni   = domain->ni.getValue() ,
                 nj   = domain->nj.getValue() ,
@@ -293,8 +293,14 @@
    {
       SuperClass::toBinary(os);
-      this->storeIndex[0]->toBinary(os);
-      this->out_i_index[0]->toBinary(os);
-      this->out_j_index[0]->toBinary(os);
-      this->out_l_index[0]->toBinary(os);
+     
+      os.write (reinterpret_cast<const char*>(&this->isChecked), sizeof(bool)); 
+     
+      if (this->isChecked)
+      {
+         this->storeIndex [0]->toBinary(os);
+         this->out_i_index[0]->toBinary(os);
+         this->out_j_index[0]->toBinary(os);
+         this->out_l_index[0]->toBinary(os);
+      }
    }
 
@@ -303,20 +309,25 @@
    void CGrid::fromBinary(StdIStream & is)
    {
-      SuperClass::fromBinary(is);
-      
-      ARRAY_CREATE(storeIndex_ , int, 1, [1]);
-      ARRAY_CREATE(out_l_index_, int, 1, [1]);
-      ARRAY_CREATE(out_i_index_, int, 1, [1]);
-      ARRAY_CREATE(out_j_index_, int, 1, [1]);
-      
-      storeIndex_ ->fromBinary(is);
-      out_i_index_->fromBinary(is);
-      out_j_index_->fromBinary(is);
-      out_l_index_->fromBinary(is);
-      
-      this->storeIndex .push_back(storeIndex_);
-      this->out_i_index.push_back(out_i_index_);
-      this->out_j_index.push_back(out_j_index_);
-      this->out_l_index.push_back(out_l_index_);
+      bool hasIndex = false;
+      SuperClass::fromBinary(is);            
+      is.read (reinterpret_cast<char*>(&hasIndex), sizeof(bool)); 
+      
+      if (hasIndex)
+      {
+         ARRAY_CREATE(storeIndex_ , int, 1, [0]);
+         ARRAY_CREATE(out_l_index_, int, 1, [0]);
+         ARRAY_CREATE(out_i_index_, int, 1, [0]);
+         ARRAY_CREATE(out_j_index_, int, 1, [0]);
+         
+         storeIndex_ ->fromBinary(is);
+         out_i_index_->fromBinary(is);
+         out_j_index_->fromBinary(is);
+         out_l_index_->fromBinary(is);
+         
+         this->storeIndex .push_back(storeIndex_);
+         this->out_i_index.push_back(out_i_index_);
+         this->out_j_index.push_back(out_j_index_);
+         this->out_l_index.push_back(out_l_index_);
+      }
    }
    
@@ -336,9 +347,12 @@
       const int jbegin_srv = this->domain->jbegin.getValue();
       
+      const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue();
+      const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue();
+           
       StdSize dn = 0;      
       for (StdSize j = 1; j < this->out_i_index.size(); j++)
          dn += this->out_i_index[j]->size();
          
-      ARRAY_ASSIGN(storeIndex_srv, int, 1, [dn]);
+      ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]);
       ARRAY_ASSIGN(out_i_index_srv, int, 1, [dn]);
       ARRAY_ASSIGN(out_j_index_srv, int, 1, [dn]);
@@ -347,8 +361,8 @@
       for (StdSize i = 0, dn = 0; i < ibegin.size(); i++)
       {
-         ARRAY(int, 1) storeIndex_cl   =  this->storeIndex[i+1];
-         ARRAY(int, 1) out_i_index_cl  =  this->out_i_index[i+1];
-         ARRAY(int, 1) out_j_index_cl  =  this->out_j_index[i+1];
-         ARRAY(int, 1) out_l_index_cl  =  this->out_l_index[i+1];
+         ARRAY(int, 1) storeIndex_cl   =  this->storeIndex [i + 1];
+         ARRAY(int, 1) out_i_index_cl  =  this->out_i_index[i + 1];
+         ARRAY(int, 1) out_j_index_cl  =  this->out_j_index[i + 1];
+         ARRAY(int, 1) out_l_index_cl  =  this->out_l_index[i + 1];
          
          const int ibegin_cl = ibegin[i];
@@ -357,7 +371,9 @@
          for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++)
          {
-            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn;
-            (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + (ibegin_cl - 1) - (ibegin_srv - 1);
-            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + (jbegin_cl - 1) - (jbegin_srv - 1);
+            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn; // Faux mais inutile dans tous les cas.
+            (*out_i_index_srv)[n] = (*out_i_index_cl)[m] 
+                                  + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1);
+            (*out_j_index_srv)[n] = (*out_j_index_cl)[m]
+                                  + (jbegin_cl - 1) - (jbegin_srv - 1) - (jbegin_zoom_srv - 1);
             (*out_l_index_srv)[n] = (*out_l_index_cl)[m];
          }
@@ -367,13 +383,13 @@
       }
       
-      //~ StdOFStream ofs(this->getId().c_str());
-      //~ for (StdSize h = 0; h < storeIndex_srv->size(); h++)
-      //~ {
-      //~   ofs << "(" << (*storeIndex_srv)[h]  << ";"
-      //~       << (*out_i_index_srv)[h] << ","
-      //~       << (*out_j_index_srv)[h] << ","
-      //~       << (*out_l_index_srv)[h] << ")" << std::endl;
-      //~ }
-      //~ ofs.close();
+      StdOFStream ofs(this->getId().c_str());
+      for (StdSize h = 0; h < storeIndex_srv->size(); h++)
+      {
+        ofs << "(" << (*storeIndex_srv)[h]  << ";"
+            << (*out_i_index_srv)[h] << ","
+            << (*out_j_index_srv)[h] << ","
+            << (*out_l_index_srv)[h] << ")" << std::endl;
+      }
+      ofs.close();
       
    }
@@ -385,5 +401,5 @@
                            ARRAY(double, 1)  storedServer) const
    {
-      if (this->storeIndex.size()-1 != storedClient.size())
+      if ((this->storeIndex.size() -1 ) != storedClient.size())
          ERROR("CGrid::inputFieldServer(...)",
                 << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", "
