Index: XMLIO_V2/dev/dev_rv/src/xmlio/client.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/client.cpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/client.cpp	(revision 214)
@@ -19,4 +19,24 @@
    } 
    
+   ///--------------------------------------------------------------
+
+   boost::shared_ptr<CClient> CClient::Client;
+
+   ///--------------------------------------------------------------
+
+   boost::shared_ptr<CClient> CClient::CreateClient(MPIComm comm_client_server)
+   {
+      if (CClient::Client.get() != NULL)
+         CClient::Client = boost::shared_ptr<CClient>(new CClient(comm_client_server));
+      return (CClient::GetClient());
+   }
+
+   ///--------------------------------------------------------------
+
+   boost::shared_ptr<CClient> CClient::GetClient(void)
+   {
+      return (CClient::Client);
+   }
+
    ///--------------------------------------------------------------
    
@@ -71,13 +91,26 @@
       this->bpair.getCurrentBuffer().appendInt(timestep);
    }
+
+   //---------------------------------------------------------------
+
+   void CClient::setTimestep(const date::CDuration & duration)
+   {
+      StdString durationstr = duration.toString();
+      this->bpair.prepareRequest(1, 2, &durationstr,
+                                       CLinearBuffer::NULL_ARG,
+                                       CLinearBuffer::NULL_ARG,
+                                       CLinearBuffer::NULL_ARG);
+      this->bpair.getCurrentBuffer().appendString(durationstr);
+   }
    
    //---------------------------------------------------------------
    
-   void CClient::sendData(const StdString & fieldId, const ARRAY(float, 1) dataArray)
+   void CClient::sendData
+      (const StdString & fieldId, const StdString & fileId, const ARRAY(float, 1) dataArray)
    {
-      this->bpair.prepareRequest(2, 0, &fieldId, &dataArray,
-                                       CLinearBuffer::NULL_ARG,
+      this->bpair.prepareRequest(2, 0, &fieldId, &fileId, &dataArray,
                                        CLinearBuffer::NULL_ARG);
       this->bpair.getCurrentBuffer().appendString(fieldId);
+      this->bpair.getCurrentBuffer().appendString(fileId);
       this->bpair.getCurrentBuffer().appendFloatArray(dataArray);
    }
@@ -85,10 +118,11 @@
    //---------------------------------------------------------------
    
-   void CClient::sendData(const StdString & fieldId, const ARRAY(double, 1) dataArray)
+   void CClient::sendData
+      (const StdString & fieldId, const StdString & fileId, const ARRAY(double, 1) dataArray)
    {
-      this->bpair.prepareRequest(2, 1, &fieldId, &dataArray,
-                                       CLinearBuffer::NULL_ARG,
+      this->bpair.prepareRequest(2, 1, &fieldId, &fileId, &dataArray,
                                        CLinearBuffer::NULL_ARG);
       this->bpair.getCurrentBuffer().appendString(fieldId);
+      this->bpair.getCurrentBuffer().appendString(fileId);
       this->bpair.getCurrentBuffer().appendDoubleArray(dataArray);
    }
Index: XMLIO_V2/dev/dev_rv/src/xmlio/client.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/client.hpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/client.hpp	(revision 214)
@@ -7,4 +7,5 @@
 #include "buffer_pair.hpp"
 #include "array.hpp"
+#include "duration.hpp"
 
 namespace xmlioserver {
@@ -16,7 +17,7 @@
    {
       public :
-      
-         /// Constructeurs ///
-         CClient(MPIComm comm_client_server);
+
+         static boost::shared_ptr<CClient> CreateClient(MPIComm comm_client_server);
+         static boost::shared_ptr<CClient> GetClient(void);
                 
          /// Destructeur ///
@@ -34,14 +35,25 @@
       public : 
        
-         void setContext(const StdString & idContext); // manager 1, method 0
-         void updateCalendar(long int timestep);       // manager 1, method 1
+         void setContext(const StdString & idContext);      // manager 1, method 0
+         void updateCalendar(long int timestep);            // manager 1, method 1
+         void setTimestep(const date::CDuration & duration);// manager 1, method 2
          
-         void sendData(const StdString & fieldId, const ARRAY(float, 1)  dataArray); // manager 2, method 0
-         void sendData(const StdString & fieldId, const ARRAY(double, 1) dataArray); // manager 2, method 1
+         void sendData(const StdString & fieldId,
+                       const StdString & fileId,
+                       const ARRAY(float, 1)  dataArray); // manager 2, method 0
+         
+         void sendData(const StdString & fieldId,
+                       const StdString & fileId,
+                       const ARRAY(double, 1) dataArray); // manager 2, method 1
          
       private :
+
+         /// Constructeurs ///
+         CClient(MPIComm comm_client_server);
       
          /// PropriÃ©tÃ© privÃ©e ///
          CBufferPair bpair;
+
+         static boost::shared_ptr<CClient> Client;
       
    }; // class CClient   
Index: XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.cpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.cpp	(revision 214)
@@ -5,4 +5,5 @@
 #include "group_template_impl.hpp"
 #include "object_factory_impl.hpp"
+
 
 namespace xmlioserver
@@ -30,4 +31,55 @@
       {
          return (this->enabledFiles);
+      }
+      //----------------------------------------------------------------
+
+      void CDataTreatment::update_calendar(int step)
+      {
+         // Mise Ã  jour cÃŽtÃ© client
+         this->currentContext->getCalendar()->update(step);
+         if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
+         { // Mise Ã  jour cÃŽtÃ© serveur
+            boost::shared_ptr<comm::CClient> client = comm::CClient::GetClient();
+            client->updateCalendar(step);
+         }
+      }
+
+      void CDataTreatment::set_timestep(const date::CDuration & duration)
+      {
+         // Mise Ã  jour cÃŽtÃ© client
+         this->currentContext->getCalendar()->setTimeStep(duration);
+         if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
+         { // Mise Ã  jour cÃŽtÃ© serveur
+            boost::shared_ptr<comm::CClient> client = comm::CClient::GetClient();
+            client->setTimestep(duration);
+         }
+      }
+
+      //----------------------------------------------------------------
+      
+      void CDataTreatment::write_data
+                           (const StdString & fieldId,
+                            const StdString & fileId,
+                            const std::deque<ARRAY(double, 1)> & data)
+      {
+         const date::CDate & currDate =
+                this->currentContext->getCalendar()->getCurrentDate();
+         const std::vector<boost::shared_ptr<CField> > & refField=
+               CObjectFactory::GetObject<CField>(fieldId)->getAllReference();
+         std::vector<boost::shared_ptr<CField> >::const_iterator
+               it = refField.begin(), end = refField.end();
+
+         for (; it != end; it++)
+         {
+            boost::shared_ptr<CField> field = *it;
+            boost::shared_ptr<CFile>  file  = field->getRelFile();
+            if (file->getId().compare(fileId) == 0)
+            {
+               if (field->updateDataServer(currDate, data))
+                  file->getDataOutput()->writeFieldData(field);
+               return;
+            }
+         }
+
       }
 
Index: XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp	(revision 214)
@@ -7,4 +7,7 @@
 #include "mpi_manager.hpp"
 #include "data_output.hpp"
+#include "duration.hpp"
+#include "client.hpp"
+#include "xios_manager.hpp"
 
 namespace xmlioserver
@@ -29,5 +32,19 @@
             const std::vector<boost::shared_ptr<CFile> > & getEnabledFiles  (void) const;
 
-            /// Creation des sorties ///
+            /// Ecriture et mise Ã  jour du calendrier ///
+            void write_data(const StdString & fieldId,
+                            const StdString & fileId,
+                            const std::deque<ARRAY(double, 1)> & data);
+
+            template <StdSize N>
+               void write_data(const StdString & fieldId, const ARRAY(double, N) & data);
+
+            template <StdSize N>
+               void write_data(const StdString & fieldId, const ARRAY(float, N) & data);
+
+            void update_calendar(int step);
+            void set_timestep(const date::CDuration & duration);
+
+            /// CrÃ©ation des sorties ///
             template <class T> void createDataOutput(void);
 
@@ -72,4 +89,50 @@
       }
 
+      template <StdSize N>
+         void CDataTreatment::write_data
+            (const StdString & fieldId, const ARRAY(float, N) & data)
+      {
+         std::vector<boost::multi_array<double, N>::size_type shape() > shape;
+         const size_type *	shapearr = data->shape();
+
+         shape.assign(shapearr, shapearr + N);
+         ARRAY_CREATE(datad, double, N, shape);
+         datad->assign(data->begin(), data->end());
+
+         this->write_data(fieldId, datad);
+      }
+
+      template <StdSize N>
+         void CDataTreatment::write_data
+            (const StdString & fieldId, const ARRAY(double, N) & data)
+      {
+         const date::CDate & currDate =
+                this->currentContext->getCalendar()->getCurrentDate();
+         const std::vector<boost::shared_ptr<CField> > & refField=
+               CObjectFactory::GetObject<CField>(fieldId)->getAllReference();
+         std::vector<boost::shared_ptr<CField> >::const_iterator
+               it = refField.begin(), end = refField.end();
+
+         for (; it != end; it++)
+         {
+            boost::shared_ptr<CField> field = *it;
+            boost::shared_ptr<CFile>  file  = field->getRelFile();
+            if (field->updateData(currDate, data))
+            {
+               if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
+               { 
+                   boost::shared_ptr<comm::CClient> client = comm::CClient::GetClient();
+                   client.sendData(fieldId, file->getId(), field->getData());
+               }
+               else
+               {
+                  file->getDataOutput()->writeFieldData(field);
+               }
+            }
+            return;
+         }
+
+      }
+
    } // namespace data
 
Index: XMLIO_V2/dev/dev_rv/src/xmlio/node/field.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/node/field.hpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/node/field.hpp	(revision 214)
@@ -54,6 +54,6 @@
 
          /// Accesseurs ///
-         boost::shared_ptr<CField> getDirectFieldReference(void) const;
-         const boost::shared_ptr<CField> getBaseFieldReference(void) const;
+               boost::shared_ptr<CField> getDirectFieldReference(void) const;
+         const boost::shared_ptr<CField> getBaseFieldReference(void)   const;
          const std::vector<boost::shared_ptr<CField> > & getAllReference(void) const;
 
Index: XMLIO_V2/dev/dev_rv/src/xmlio/node/file.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/node/file.cpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/node/file.cpp	(revision 214)
@@ -33,4 +33,9 @@
 
    //----------------------------------------------------------------
+
+   boost::shared_ptr<io::CDataOutput> CFile::getDataOutput(void) const
+   {
+      return (data_out);
+   }
 
    boost::shared_ptr<CFieldGroup> CFile::getVirtualFieldGroup(void) const
Index: XMLIO_V2/dev/dev_rv/src/xmlio/node/file.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/node/file.hpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/node/file.hpp	(revision 214)
@@ -47,4 +47,5 @@
 
          /// Accesseurs ///
+         boost::shared_ptr<io::CDataOutput> getDataOutput(void) const;
          boost::shared_ptr<CFieldGroup> getVirtualFieldGroup(void) const;
          std::vector<boost::shared_ptr<CField> > getAllFields(void) const;
@@ -54,4 +55,6 @@
                              int default_level = 1,
                              bool default_enabled = true);
+
+      public :
 
          /// Mutateurs ///
Index: XMLIO_V2/dev/dev_rv/src/xmlio/server.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/server.cpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/server.cpp	(revision 214)
@@ -1,3 +1,7 @@
 #include "server.hpp"
+
+#include "tree_manager.hpp"
+#include "duration.hpp"
+#include "data_treatment.hpp"
 
 namespace xmlioserver {
@@ -14,9 +18,29 @@
    
    ///--------------------------------------------------------------
+
+   boost::shared_ptr<CServer> CServer::Server;
+
+   ///--------------------------------------------------------------
    
    const CBufferList & CServer::getBufferList(void) const 
    {
       return (this->blist);
-   }   
+   }
+
+   ///--------------------------------------------------------------
+
+   boost::shared_ptr<CServer> CServer::CreateServer(MPIComm comm_client_server)
+   {
+      if (CServer::Server.get() != NULL)
+         CServer::Server = boost::shared_ptr<CServer>(new CServer(comm_client_server));
+      return (CServer::GetServer());
+   }
+
+   ///--------------------------------------------------------------
+
+   boost::shared_ptr<CServer> CServer::GetServer(void)
+   {
+      return (CServer::Server);
+   }
    
    //---------------------------------------------------------------
@@ -74,4 +98,7 @@
                   this->updateCalendar(lbuffer);
                   continue;
+               case (2) :
+                  this->setTimestep(lbuffer);
+                  continue;
                default  :
                   ERROR("CServer::run(void)", 
@@ -121,5 +148,31 @@
        comm::CMPIManager::Barrier();
    }   
-   
+
+   //--------------------------------------------------------------
+
+   void CServer::setTimestep(const std::vector<CLinearBuffer> & buffer)// manager 1, method 2
+   {
+      boost::shared_ptr<CContext> context =
+         CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment();
+
+      StdString durationstr;
+      for (StdSize i = 0; i < buffer.size(); i++)
+      {
+         StdString durationstr_ = buffer[i].getString(3);
+         if (durationstr.compare(durationstr_) != 0 && (i != 0))
+         {
+            ERROR("CServer::setTimestep(const std::vector<CLinearBuffer> & buffer)",
+                  << "[ durationstr 1 = " << durationstr   << ", "
+                  << "[ durationstr 2 = " << durationstr_  << "] "
+                  << " Modification de timestep dÃ©synchronisÃ© !");
+         }
+         else durationstr = durationstr_;
+
+      }
+      std::cout << "setTimestep called " << durationstr << std::endl;
+      dtreat->set_timestep(date::CDuration::FromString(durationstr));
+   }
+
    //--------------------------------------------------------------
              
@@ -141,4 +194,5 @@
       }
       std::cout << "setContext called " << contextId << std::endl;
+      CTreeManager::SetCurrentContextId(contextId);
    }
    
@@ -147,4 +201,8 @@
    void CServer::updateCalendar(const std::vector<CLinearBuffer> & buffer) // manager 1, method 1
    {
+      boost::shared_ptr<CContext> context =
+         CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment();
+
       int timestep = -1;
       for (StdSize i = 0; i < buffer.size(); i++)
@@ -161,4 +219,5 @@
       }
       std::cout << "updateCalendar called " << timestep <<std::endl;
+      dtreat->update_calendar(timestep);
    }
    
@@ -167,8 +226,14 @@
    void CServer::writeData(const std::vector<CLinearBuffer> & buffer, int prec)  // manager 2, method 0 - 1
    {
-      StdString fieldId;
+      boost::shared_ptr<CContext> context =
+         CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment();
+
+      StdString fieldId, fileId;
       for (StdSize i = 0; i < buffer.size(); i++)
       {
          StdString fieldId_ = buffer[i].getString(3);
+         StdString fileId_ = buffer[i].getString(4);
+
          if (fieldId.compare(fieldId_) != 0 && (i != 0))
          {           
@@ -178,5 +243,14 @@
                   << " Ecriture des donnÃ©es dÃ©synchronisÃ©e !");
          }
-         else fieldId = fieldId_;         
+         else fieldId = fieldId_;
+
+         if (fileId.compare(fileId_) != 0 && (i != 0))
+         {
+            ERROR("CServer::writeData(const std::vector<CLinearBuffer> & buffer, int prec)",
+                  << "[fileId 1 = " << fileId   << ", "
+                  << " fileId 2 = " << fileId_  << "] "
+                  << " Ecriture des donnÃ©es dÃ©synchronisÃ©e !");
+         }
+         else fileId = fileId_;
       }
       
@@ -185,7 +259,7 @@
          std::deque<ARRAY(float, 1)> dataArray(buffer.size());
          for (StdSize i = 0; i < buffer.size(); i++)
-            dataArray[i] = buffer[i].getFloatArray(4);
-
+            dataArray[i] = buffer[i].getFloatArray(5);
          std::cout << "writeData called (float) " << fieldId << ", " << dataArray[0] << std::endl;
+         // Jamais atteint car les donnÃ©es sont transfÃ©rÃ©es en tant que double
          return;
       }      
@@ -194,7 +268,7 @@
          std::deque<ARRAY(double, 1)> dataArray(buffer.size());
          for (StdSize i = 0; i < buffer.size(); i++)
-            dataArray[i] = buffer[i].getDoubleArray(4);
-
+            dataArray[i] = buffer[i].getDoubleArray(5);
          std::cout << "writeData called (double) " << fieldId << ", " << dataArray[0]  << std::endl;
+         dtreat->write_data(fieldId, fileId, dataArray);
          return;
       }      
Index: XMLIO_V2/dev/dev_rv/src/xmlio/server.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/xmlio/server.hpp	(revision 213)
+++ XMLIO_V2/dev/dev_rv/src/xmlio/server.hpp	(revision 214)
@@ -16,8 +16,8 @@
    {
       public :
-      
-         /// Constructeurs ///
-         CServer(MPIComm comm_client_server);
-                
+
+         static boost::shared_ptr<CServer> CreateServer(MPIComm comm_client_server);
+         static boost::shared_ptr<CServer> GetServer(void);
+
          /// Destructeur ///
          ~CServer(void);
@@ -36,13 +36,19 @@
          void finalize(void);   // manager 0, method 1
              
-         void setContext(const std::vector<CLinearBuffer> & buffer);     // manager 1, method 0
+         void setContext    (const std::vector<CLinearBuffer> & buffer); // manager 1, method 0
          void updateCalendar(const std::vector<CLinearBuffer> & buffer); // manager 1, method 1
+         void setTimestep   (const std::vector<CLinearBuffer> & buffer); // manager 1, method 2
          
          void writeData(const std::vector<CLinearBuffer> & buffer, int prec); // manager 2, method 0 - 1
       
       private :
+
+         /// Constructeurs ///
+         CServer(MPIComm comm_client_server);
       
          /// PropriÃ©tÃ© privÃ©e ///
          CBufferList blist;
+
+         static boost::shared_ptr<CServer> Server;
       
    }; // class CServer  
