Index: /XIOS/trunk/src/client.cpp
===================================================================
--- /XIOS/trunk/src/client.cpp	(revision 696)
+++ /XIOS/trunk/src/client.cpp	(revision 697)
@@ -220,4 +220,7 @@
       int rank ;
       int msg=0 ;
+
+      MPI_Comm_rank(intraComm,&rank) ;
+ 
       if (!CXios::isServer)
       {
@@ -242,4 +245,5 @@
         else MPI_Finalize() ;
       }
+      
       info(20) << "Client side context is finalized"<<endl ;
       report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ;
Index: /XIOS/trunk/src/context_client.cpp
===================================================================
--- /XIOS/trunk/src/context_client.cpp	(revision 696)
+++ /XIOS/trunk/src/context_client.cpp	(revision 697)
@@ -6,5 +6,4 @@
 #include "buffer_client.hpp"
 #include "type.hpp"
-#include "message.hpp"
 #include "event_client.hpp"
 #include "context.hpp"
@@ -71,6 +70,8 @@
 
       timeLine = 0;
+
     }
 
+     
     /*!
     In case of attached mode, the current context must be reset to context for client
@@ -287,12 +288,15 @@
   }
 
+ 
+
    /*!
    Finalize context client and do some reports
    */
+    
    void CContextClient::finalize(void)
    {
      map<int,CClientBuffer*>::iterator itBuff;
      bool stop = true;
-
+      
      CEventClient event(CContext::GetType(), CContext::EVENT_ID_CONTEXT_FINALIZE);
      if (isServerLeader())
@@ -327,4 +331,5 @@
 
      releaseBuffers();
+     
    }
 }
Index: /XIOS/trunk/src/context_client.hpp
===================================================================
--- /XIOS/trunk/src/context_client.hpp	(revision 696)
+++ /XIOS/trunk/src/context_client.hpp	(revision 697)
@@ -4,7 +4,10 @@
 #include "xios_spl.hpp"
 #include "buffer_out.hpp"
+#include "buffer_in.hpp"
 #include "buffer_client.hpp"
 #include "event_client.hpp"
+#include "event_server.hpp"
 #include "mpi.hpp"
+#include "registry.hpp"
 
 namespace xios
@@ -46,5 +49,4 @@
       void setBufferSize(const std::map<int,StdSize>& mapSize);
       void sendBufferSizeEvent();
-
     public:
       CContext* context; //!< Context for client
Index: /XIOS/trunk/src/context_server.hpp
===================================================================
--- /XIOS/trunk/src/context_server.hpp	(revision 696)
+++ /XIOS/trunk/src/context_server.hpp	(revision 697)
@@ -39,5 +39,5 @@
     size_t currentTimeLine ;
     CContext* context ;
-
+      
     bool finished ;
     bool pendingEvent ;
Index: /XIOS/trunk/src/cxios.cpp
===================================================================
--- /XIOS/trunk/src/cxios.cpp	(revision 696)
+++ /XIOS/trunk/src/cxios.cpp	(revision 697)
@@ -10,4 +10,5 @@
 #include <new>
 #include "memtrack.hpp"
+#include "registry.hpp"
 
 namespace xios
@@ -27,4 +28,5 @@
   bool CXios::printLogs2Files;
   bool CXios::isOptPerformance = true;
+  CRegistry* CXios::globalRegistry = 0;
 
   //! Parse configuration file and create some objects from it
@@ -75,4 +77,5 @@
 
     CClient::initialize(codeId,localComm,returnComm) ;
+    if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ;
 
     if (usingServer) isServer=false;
@@ -95,4 +98,10 @@
      CClient::finalize() ;
      CClient::closeInfoStream();
+     if (CClient::getRank()==0)
+     {
+       info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ;
+       globalRegistry->toFile("xios_registry.bin") ;
+       delete globalRegistry ;
+     }
 
 #ifdef XIOS_MEMTRACK
@@ -121,5 +130,6 @@
     // Initialize all aspects MPI
     CServer::initialize();
-
+    if (CServer::getRank()==0) globalRegistry = new CRegistry(CServer::intraComm) ;
+    
     if (printLogs2Files)
     {
@@ -137,4 +147,10 @@
 
     // Finalize
+     if (CServer::getRank()==0)
+     {
+       info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ;
+       globalRegistry->toFile("xios_registry.bin") ;
+       delete globalRegistry ;
+     }
     CServer::finalize();
     CServer::closeInfoStream();
Index: /XIOS/trunk/src/cxios.hpp
===================================================================
--- /XIOS/trunk/src/cxios.hpp	(revision 696)
+++ /XIOS/trunk/src/cxios.hpp	(revision 697)
@@ -4,4 +4,5 @@
 #include "xios_spl.hpp"
 #include "mpi.hpp"
+#include "registry.hpp"
 
 namespace xios
@@ -42,4 +43,5 @@
      static double defaultBufferServerFactorSize ; //!< Default factor value
      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible)
+     static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers
 
     public:
Index: /XIOS/trunk/src/node/context.cpp
===================================================================
--- /XIOS/trunk/src/node/context.cpp	(revision 696)
+++ /XIOS/trunk/src/node/context.cpp	(revision 697)
@@ -14,4 +14,5 @@
 #include "type.hpp"
 #include "xios_spl.hpp"
+
 
 namespace xios {
@@ -239,4 +240,12 @@
      hasClient=true;
      client = new CContextClient(this,intraComm, interComm, cxtServer);
+     registryIn=new CRegistry(intraComm);
+     registryIn->setPath(getId()) ;
+     if (client->clientRank==0) registryIn->fromFile("xios_registry.bin") ;
+     registryIn->bcastRegistry() ;
+
+     registryOut=new CRegistry(intraComm) ;
+     registryOut->setPath(getId()) ;
+
      MPI_Comm intraCommServer, interCommServer;
      if (cxtServer) // Attached mode
@@ -296,4 +305,12 @@
      hasServer=true;
      server = new CContextServer(this,intraComm,interComm);
+
+     registryIn=new CRegistry(intraComm);
+     registryIn->setPath(getId()) ;
+     if (server->intraCommRank==0) registryIn->fromFile("xios_registry.bin") ;
+     registryIn->bcastRegistry() ;
+     registryOut=new CRegistry(intraComm) ;
+     registryOut->setPath(getId()) ;
+ 
      MPI_Comm intraCommClient, interCommClient;
      if (cxtClient) // Attached mode
@@ -331,5 +348,5 @@
       {
         finalized = true;
-
+        if (hasClient) sendRegistry() ;
         client->finalize();
         while (!server->hasFinished())
@@ -341,6 +358,8 @@
         {
           closeAllFile();
+          registryOut->hierarchicalGatherRegistry() ;
+          if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ;
         }
-
+        
         for (std::list<MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it)
           MPI_Comm_free(&(*it));
@@ -576,5 +595,8 @@
              recvPostProcessing(event);
              return true;
-             break;
+            case EVENT_ID_SEND_REGISTRY:
+             recvRegistry(event);
+             return true;
+            break;
 
            default :
@@ -1018,3 +1040,43 @@
     return (context);
   }
+
+
+
+     //! Server side: Receive a message to do some post processing
+  void CContext::recvRegistry(CEventServer& event)
+  {
+    CBufferIn* buffer=event.subEvents.begin()->buffer;
+    string id;
+    *buffer>>id;
+    get(id)->recvRegistry(*buffer);
+  }
+
+  void CContext::recvRegistry(CBufferIn& buffer)
+  {
+    if (server->intraCommRank==0)
+    {
+      CRegistry registry(server->intraComm) ;
+      registry.fromBuffer(buffer) ;
+      registryOut->mergeRegistry(registry) ;
+    }
+  }
+
+  void CContext::sendRegistry(void)
+  {
+    registryOut->hierarchicalGatherRegistry() ;
+
+    CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY);
+    if (client->isServerLeader())
+    {
+       CMessage msg ;
+       msg<<this->getIdServer();
+       if (client->clientRank==0) msg<<*registryOut ;
+       const std::list<int>& ranks = client->getRanksServerLeader();
+       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
+         event.push(*itRank,1,msg);
+       client->sendEvent(event);
+     }
+     else client->sendEvent(event);
+  }
+
 } // namespace xios
Index: /XIOS/trunk/src/node/context.hpp
===================================================================
--- /XIOS/trunk/src/node/context.hpp	(revision 696)
+++ /XIOS/trunk/src/node/context.hpp	(revision 697)
@@ -12,5 +12,5 @@
 #include "data_output.hpp"
 #include "garbage_collector.hpp"
-
+#include "registry.hpp"
 #include "mpi.hpp"
 
@@ -51,5 +51,5 @@
            EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR,
            EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE,
-           EVENT_ID_POST_PROCESS
+           EVENT_ID_POST_PROCESS, EVENT_ID_SEND_REGISTRY
          };
 
@@ -132,5 +132,5 @@
          void sendRefGrid();
          void sendPostProcessing();
-
+         void sendRegistry(void) ; //!< after be gathered to the root process of the context, merged registry is sent to the root process of the servers
          const StdString& getIdServer();
 
@@ -145,4 +145,6 @@
          static void recvPostProcessing(CEventServer& event);
          void recvPostProcessing(CBufferIn& buffer);
+         static void recvRegistry(CEventServer& event) ;
+         void recvRegistry(CBufferIn& buffer) ; //!< registry is received by the root process of the servers
 
          // dispatch event
@@ -213,5 +215,7 @@
          // Concrete contex client
          CContextClient* client;
-
+         CRegistry* registryIn ;  //!< input registry which is read from file 
+         CRegistry* registryOut ; //!< output registry which will be wrote on file at the finalize
+         
       private:
          bool isPostProcessed;
Index: /XIOS/trunk/src/server.cpp
===================================================================
--- /XIOS/trunk/src/server.cpp	(revision 696)
+++ /XIOS/trunk/src/server.cpp	(revision 697)
@@ -27,5 +27,5 @@
     bool CServer::is_MPI_Initialized ;
     CEventScheduler* CServer::eventScheduler = 0;
-
+   
     void CServer::initialize(void)
     {
@@ -148,5 +148,5 @@
     {
       CTimer::get("XIOS").suspend() ;
-
+     
       delete eventScheduler ;
 
Index: /XIOS/trunk/src/server.hpp
===================================================================
--- /XIOS/trunk/src/server.hpp	(revision 696)
+++ /XIOS/trunk/src/server.hpp	(revision 697)
@@ -4,4 +4,5 @@
 #include "xios_spl.hpp"
 #include "context.hpp"
+#include "context_client.hpp"
 #include "mpi.hpp"
 #include "event_scheduler.hpp"
@@ -27,5 +28,5 @@
         static std::list<MPI_Comm> contextInterComms;
         static CEventScheduler* eventScheduler;
-
+        
         struct contextMessage
         {
