Index: /XIOS/trunk/src/client_client_dht_template.hpp
===================================================================
--- /XIOS/trunk/src/client_client_dht_template.hpp	(revision 834)
+++ /XIOS/trunk/src/client_client_dht_template.hpp	(revision 835)
@@ -39,6 +39,5 @@
   public:
     CClientClientDHTTemplate(const Index2InfoTypeMap& indexInfoInitMap,
-                             const MPI_Comm& clientIntraComm,
-                             int hierarLvl = 2);
+                             const MPI_Comm& clientIntraComm);
 
     void computeIndexInfoMapping(const CArray<size_t,1>& indices);
Index: /XIOS/trunk/src/client_client_dht_template_impl.hpp
===================================================================
--- /XIOS/trunk/src/client_client_dht_template_impl.hpp	(revision 834)
+++ /XIOS/trunk/src/client_client_dht_template_impl.hpp	(revision 835)
@@ -23,6 +23,5 @@
 template<typename T, typename H>
 CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const boost::unordered_map<size_t,T>& indexInfoMap,
-                                                        const MPI_Comm& clientIntraComm,
-                                                        int hierarLvl)
+                                                        const MPI_Comm& clientIntraComm)
   : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_()
 {
Index: /XIOS/trunk/src/client_server_mapping_distributed.cpp
===================================================================
--- /XIOS/trunk/src/client_server_mapping_distributed.cpp	(revision 834)
+++ /XIOS/trunk/src/client_server_mapping_distributed.cpp	(revision 835)
@@ -22,6 +22,5 @@
 {
   ccDHT_ = new CClientClientDHTInt(globalIndexOfServer,
-                                   clientIntraComm,
-                                   isDataDistributed);
+                                   clientIntraComm);
 }
 
@@ -39,5 +38,4 @@
   ccDHT_->computeIndexInfoMapping(globalIndexOnClient);
   const boost::unordered_map<size_t,int>& infoIndexMap = (ccDHT_->getInfoIndexMap());
-//  indexGlobalOnServer_ = (ccDHT_->getInfoIndexMap());
   boost::unordered_map<size_t,int>::const_iterator it = infoIndexMap.begin(), ite = infoIndexMap.end();
   for (; it != ite; ++it)
Index: /XIOS/trunk/src/client_server_mapping_distributed.hpp
===================================================================
--- /XIOS/trunk/src/client_server_mapping_distributed.hpp	(revision 834)
+++ /XIOS/trunk/src/client_server_mapping_distributed.hpp	(revision 835)
@@ -35,5 +35,6 @@
     /** Default constructor */
     CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer,
-                                    const MPI_Comm& clientIntraComm, bool isDataDistributed = true);
+                                    const MPI_Comm& clientIntraComm,
+                                    bool isDataDistributed = true);
 
     virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClientSendToServer);
Index: /XIOS/trunk/src/interface/c/icxml_tree.cpp
===================================================================
--- /XIOS/trunk/src/interface/c/icxml_tree.cpp	(revision 834)
+++ /XIOS/trunk/src/interface/c/icxml_tree.cpp	(revision 835)
@@ -310,4 +310,35 @@
    }
 
+   void cxios_xml_tree_add_axistogrid
+      (XGridPtr parent_, XAxisPtr * child_, const char * child_id, int child_id_size)
+   {
+      std::string child_id_str;
+      CTimer::get("XIOS").resume() ;
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->addAxis(child_id_str);
+      }
+      else
+      {
+         *child_ = parent_->addAxis();
+      }
+      CTimer::get("XIOS").suspend() ;
+   }
+
+   void cxios_xml_tree_add_domaintogrid
+      (XGridPtr parent_, XDomainPtr * child_, const char * child_id, int child_id_size)
+   {
+      std::string child_id_str;
+      CTimer::get("XIOS").resume() ;
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->addDomain(child_id_str);
+      }
+      else
+      {
+         *child_ = parent_->addDomain();
+      }
+      CTimer::get("XIOS").suspend() ;
+   }
 
    // ----------------------- Affichage de l'arborescence ----------------------
Index: /XIOS/trunk/src/interface/fortran/ixios_interfaces.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran/ixios_interfaces.F90	(revision 834)
+++ /XIOS/trunk/src/interface/fortran/ixios_interfaces.F90	(revision 835)
@@ -83,5 +83,5 @@
                       xios(add_axisgroup), xios(add_filegroup), xios(add_gridgroup), xios(add_fieldgroup), &
                       xios(add_domaingroup), xios(add_fieldgrouptofile), xios(add_variablegrouptofile),    &
-                      xios(add_variablegrouptofield)
+                      xios(add_variablegrouptofield), xios(add_axistogrid), xios(add_domaintogrid)
 
 PRIVATE
@@ -135,5 +135,6 @@
                    xios(add_fieldtofile), xios(add_variabletofile), xios(add_variabletofield), xios(add_axisgroup),  &
                    xios(add_filegroup), xios(add_gridgroup), xios(add_fieldgroup), xios(add_domaingroup),            &
-                   xios(add_fieldgrouptofile), xios(add_variablegrouptofile),xios(add_variablegrouptofield)
+                   xios(add_fieldgrouptofile), xios(add_variablegrouptofile),xios(add_variablegrouptofield),         &
+                   xios(add_axistogrid), xios(add_domaintogrid)
 END INTERFACE xios(add_child)
 
Index: /XIOS/trunk/src/interface/fortran/ixml_tree.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran/ixml_tree.F90	(revision 834)
+++ /XIOS/trunk/src/interface/fortran/ixml_tree.F90	(revision 835)
@@ -9,7 +9,7 @@
    USE IDOMAIN
    USE IVARIABLE
-     
+
    INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
-     
+
       SUBROUTINE cxios_xml_tree_add_field(parent_, child_, child_id, child_id_size) BIND(C)
          USE ISO_C_BINDING
@@ -19,5 +19,5 @@
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
       END SUBROUTINE cxios_xml_tree_add_field
-      
+
       SUBROUTINE cxios_xml_tree_add_grid(parent_, child_, child_id, child_id_size) BIND(C)
          USE ISO_C_BINDING
@@ -27,5 +27,5 @@
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
       END SUBROUTINE cxios_xml_tree_add_grid
-      
+
       SUBROUTINE cxios_xml_tree_add_file(parent_, child_, child_id, child_id_size) BIND(C)
          USE ISO_C_BINDING
@@ -35,5 +35,5 @@
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
       END SUBROUTINE cxios_xml_tree_add_file
-      
+
       SUBROUTINE cxios_xml_tree_add_axis(parent_, child_, child_id, child_id_size) BIND(C)
          USE ISO_C_BINDING
@@ -43,5 +43,5 @@
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
       END SUBROUTINE cxios_xml_tree_add_axis
-      
+
       SUBROUTINE cxios_xml_tree_add_domain(parent_, child_, child_id, child_id_size) BIND(C)
          USE ISO_C_BINDING
@@ -51,5 +51,5 @@
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
       END SUBROUTINE cxios_xml_tree_add_domain
-      
+
       SUBROUTINE cxios_xml_tree_add_fieldtofile(parent_, child_, child_id, child_id_size) BIND(C)
          USE ISO_C_BINDING
@@ -117,5 +117,5 @@
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
       END SUBROUTINE cxios_xml_tree_add_domaingroup
-      
+
       SUBROUTINE cxios_xml_tree_add_fieldgrouptofile(parent_, child_, child_id, child_id_size) BIND(C)
          USE ISO_C_BINDING
@@ -124,5 +124,5 @@
          CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: child_id
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
-      END SUBROUTINE cxios_xml_tree_add_fieldgrouptofile    
+      END SUBROUTINE cxios_xml_tree_add_fieldgrouptofile
 
       SUBROUTINE cxios_xml_tree_add_variablegrouptofile(parent_, child_, child_id, child_id_size) BIND(C)
@@ -132,5 +132,5 @@
          CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: child_id
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
-      END SUBROUTINE cxios_xml_tree_add_variablegrouptofile    
+      END SUBROUTINE cxios_xml_tree_add_variablegrouptofile
 
       SUBROUTINE cxios_xml_tree_add_variablegrouptofield(parent_, child_, child_id, child_id_size) BIND(C)
@@ -140,5 +140,21 @@
          CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: child_id
          INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
-      END SUBROUTINE cxios_xml_tree_add_variablegrouptofield    
+      END SUBROUTINE cxios_xml_tree_add_variablegrouptofield
+
+      SUBROUTINE cxios_xml_tree_add_axistogrid(parent_, child_, child_id, child_id_size) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: parent_
+         INTEGER  (kind = C_INTPTR_T)               :: child_
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: child_id
+         INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
+      END SUBROUTINE cxios_xml_tree_add_axistogrid
+
+      SUBROUTINE cxios_xml_tree_add_domaintogrid(parent_, child_, child_id, child_id_size) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: parent_
+         INTEGER  (kind = C_INTPTR_T)               :: child_
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: child_id
+         INTEGER  (kind = C_INT)     , VALUE        :: child_id_size
+      END SUBROUTINE cxios_xml_tree_add_domaintogrid
 
       SUBROUTINE cxios_xml_tree_show(filename, filename_size) BIND(C)
@@ -159,8 +175,8 @@
          INTEGER  (kind = C_INT) , VALUE        :: xmlcontent_size
       END SUBROUTINE cxios_xml_parse_string
-     
+
    END INTERFACE
 
-   
+
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
 
@@ -178,5 +194,5 @@
 
    END SUBROUTINE xios(add_axis)
-   
+
    SUBROUTINE xios(add_file)(parent_hdl, child_hdl, child_id)
       TYPE(txios(filegroup))      , INTENT(IN) :: parent_hdl
@@ -191,5 +207,5 @@
 
    END SUBROUTINE xios(add_file)
-   
+
    SUBROUTINE xios(add_grid)(parent_hdl, child_hdl, child_id)
       TYPE(txios(gridgroup))     , INTENT(IN) :: parent_hdl
@@ -203,6 +219,6 @@
 
    END SUBROUTINE xios(add_grid)
-   
-   
+
+
    SUBROUTINE xios(add_field)(parent_hdl, child_hdl, child_id)
       TYPE(txios(fieldgroup))     , INTENT(IN) :: parent_hdl
@@ -217,6 +233,6 @@
 
    END SUBROUTINE xios(add_field)
-   
-   
+
+
    SUBROUTINE xios(add_domain)(parent_hdl, child_hdl, child_id)
       TYPE(txios(domaingroup))     , INTENT(IN) :: parent_hdl
@@ -231,5 +247,5 @@
 
    END SUBROUTINE xios(add_domain)
-   
+
    SUBROUTINE xios(add_fieldtofile)(parent_hdl, child_hdl, child_id)
       TYPE(txios(file))            , INTENT(IN) :: parent_hdl
@@ -309,5 +325,5 @@
          CALL cxios_xml_tree_add_gridgroup(parent_hdl%daddr, child_hdl%daddr, "NONE", -1)
       END IF
-      
+
    END SUBROUTINE xios(add_gridgroup)
 
@@ -374,5 +390,30 @@
       END IF
 
-   END SUBROUTINE xios(add_variablegrouptofield)  
-         
+   END SUBROUTINE xios(add_variablegrouptofield)
+
+   SUBROUTINE xios(add_axistogrid)(parent_hdl, child_hdl, child_id)
+      TYPE(txios(grid))             , INTENT(IN) :: parent_hdl
+      TYPE(txios(axis))             , INTENT(OUT):: child_hdl
+      CHARACTER(len = *), OPTIONAL  , INTENT(IN) :: child_id
+
+      IF (PRESENT(child_id)) THEN
+         CALL cxios_xml_tree_add_axistogrid(parent_hdl%daddr, child_hdl%daddr, child_id, len(child_id))
+      ELSE
+         CALL cxios_xml_tree_add_axistogrid(parent_hdl%daddr, child_hdl%daddr, "NONE", -1)
+      END IF
+
+   END SUBROUTINE xios(add_axistogrid)
+
+   SUBROUTINE xios(add_domaintogrid)(parent_hdl, child_hdl, child_id)
+      TYPE(txios(grid))             , INTENT(IN) :: parent_hdl
+      TYPE(txios(domain))           , INTENT(OUT):: child_hdl
+      CHARACTER(len = *), OPTIONAL  , INTENT(IN) :: child_id
+
+      IF (PRESENT(child_id)) THEN
+         CALL cxios_xml_tree_add_domaintogrid(parent_hdl%daddr, child_hdl%daddr, child_id, len(child_id))
+      ELSE
+         CALL cxios_xml_tree_add_domaintogrid(parent_hdl%daddr, child_hdl%daddr, "NONE", -1)
+      END IF
+
+   END SUBROUTINE xios(add_domaintogrid)
 END MODULE IXML_TREE
Index: /XIOS/trunk/src/node/grid.cpp
===================================================================
--- /XIOS/trunk/src/node/grid.cpp	(revision 834)
+++ /XIOS/trunk/src/node/grid.cpp	(revision 835)
@@ -32,5 +32,5 @@
       , transformations_(0), isTransformed_(false)
       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false)
-      , gridSrc_(), hasTransform_(false)
+      , gridSrc_(), hasTransform_(false), order_()
    {
      setVirtualDomainGroup();
@@ -47,5 +47,5 @@
       , transformations_(0), isTransformed_(false)
       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false)
-      , gridSrc_(), hasTransform_(false)
+      , gridSrc_(), hasTransform_(false), order_()
    {
      setVirtualDomainGroup();
@@ -1145,4 +1145,7 @@
    CDomain* CGrid::addDomain(const std::string& id)
    {
+     order_.push_back(true);
+     axis_domain_order.resize(order_.size());
+     for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx];
      return vDomainGroup_->createChild(id);
    }
@@ -1150,4 +1153,7 @@
    CAxis* CGrid::addAxis(const std::string& id)
    {
+     order_.push_back(false);
+     axis_domain_order.resize(order_.size());
+     for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx];
      return vAxisGroup_->createChild(id);
    }
@@ -1539,7 +1545,4 @@
     SuperClass::parse(node);
 
-    // List order of axis and domain in a grid, if there is a domain, it will take value 1 (true), axis 0 (false)
-    std::vector<bool> order;
-
     if (node.goToChildElement())
     {
@@ -1549,9 +1552,9 @@
       {
         if (node.getElementName() == domainName) {
-          order.push_back(true);
+          order_.push_back(true);
           this->getVirtualDomainGroup()->parseChild(node);
         }
         if (node.getElementName() == axisName) {
-          order.push_back(false);
+          order_.push_back(false);
           this->getVirtualAxisGroup()->parseChild(node);
         }
@@ -1560,11 +1563,11 @@
     }
 
-    if (!order.empty())
-    {
-      int sizeOrd = order.size();
+    if (!order_.empty())
+    {
+      int sizeOrd = order_.size();
       axis_domain_order.resize(sizeOrd);
       for (int i = 0; i < sizeOrd; ++i)
       {
-        axis_domain_order(i) = order[i];
+        axis_domain_order(i) = order_[i];
       }
     }
Index: /XIOS/trunk/src/node/grid.hpp
===================================================================
--- /XIOS/trunk/src/node/grid.hpp	(revision 834)
+++ /XIOS/trunk/src/node/grid.hpp	(revision 835)
@@ -148,4 +148,6 @@
          void solveDomainAxisBaseRef();
 
+         CDomain* addDomain(const std::string& id=StdString());
+         CAxis* addAxis(const std::string& id=StdString());
          void sendAddDomain(const std::string& id="");
          void sendAddAxis(const std::string& id="");
@@ -236,7 +238,4 @@
         void setDomainList(const std::vector<CDomain*> domains = std::vector<CDomain*>());
 
-        CDomain* addDomain(const std::string& id);
-        CAxis* addAxis(const std::string& id);
-
         CAxisGroup* getVirtualAxisGroup() const;
         CDomainGroup* getVirtualDomainGroup() const;
@@ -275,4 +274,6 @@
         std::map<CGrid*, std::pair<bool,StdString> > gridSrc_;
         bool hasTransform_;
+            // List order of axis and domain in a grid, if there is a domain, it will take value 1 (true), axis 0 (false)
+        std::vector<bool> order_;
    }; // class CGrid
 
