Index: XMLIO_V2/dev/common/src/xmlio/calendar.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/calendar.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/calendar.cpp	(revision 266)
@@ -53,5 +53,8 @@
 
       CDate & CCalendar::update(int step)
-      { return (this->getCurrentDate() = this->getCurrentDate() + step * this->timestep); }
+      { 
+         std::cout << "step : " << step << std::endl;
+         return (this->getCurrentDate() = this->getInitDate() + step * this->timestep);
+      }
 
       //-----------------------------------------------------------------
Index: XMLIO_V2/dev/common/src/xmlio/calendar_util.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/calendar_util.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/calendar_util.cpp	(revision 266)
@@ -37,6 +37,10 @@
       {
          CDuration dur(ddr);
-         dur.year = -dur.year;  dur.month  = -dur.month ; dur.day    = -dur.day;
-         dur.hour = -dur.hour;  dur.minute = -dur.minute; dur.second = -dur.second;
+         dur.year   = -dur.year;
+         dur.month  = -dur.month;
+         dur.day    = -dur.day;
+         dur.hour   = -dur.hour;
+         dur.minute = -dur.minute;
+         dur.second = -dur.second;
          return (dur);
       }
@@ -68,5 +72,5 @@
 
          // Ajustement des mois en fonction des jours.
-         int signVal = drr.day/fabs(drr.day);
+         int signVal = (drr.day != 0) ? drr.day/fabs(drr.day) : 0;
          CDate dtt(dt); dtt.addMonth (signVal);
 
@@ -77,13 +81,13 @@
          if (day <  0) { drr.month --; day += c.getMonthLength(dtt); }
          if (day >= c.getMonthLength(dtt)) { drr.month ++; day -= c.getMonthLength(dtt); } // << ProblÃšme ici
-         if (day == 0) day = c.getMonthLength(dtt);
-
+         if (day == 0){ day = c.getMonthLength(dtt); drr.month --; }
+         
          drr.resolve(dt.getRelCalendar());
 
          // Ajustement des annÃ©es en fonction des mois.
          month += dt.getMonth() + drr.month;
-         if (month <  0) { year --; month += c.getYearLength(); }
-         if (month >= c.getYearLength()) { year ++; month -= c.getYearLength(); }
-         if (month == 0) month = c.getYearLength();
+         if (month <  0) { drr.year --; month += c.getYearLength(); }
+         if (month >  c.getYearLength()) { drr.year ++; month -= c.getYearLength(); }
+         if (month == 0){ month = c.getYearLength(); drr.year--; }
 
          year += dt.getYear() + drr.year;
@@ -118,7 +122,41 @@
       {
          // TODO :: VÃ©rifier que les deux dates (dt0 et dt1) ont une rÃ©fÃ©rence vers le mÃªme calendrier.
-         if (dt0.getYear()   < dt1.getYear())   return true; if (dt0.getMonth()  < dt1.getMonth())  return true;
-         if (dt0.getDay()    < dt1.getDay())    return true; if (dt0.getHour()   < dt1.getHour())   return true;
-         if (dt0.getMinute() < dt1.getMinute()) return true; if (dt0.getSecond() < dt1.getSecond()) return true;
+         if   (dt0.getYear()  < dt1.getYear())
+         { 
+            return true;
+         }
+         else if (dt0.getYear() == dt1.getYear())
+         { 
+            if   (dt0.getMonth()  < dt1.getMonth())
+            {
+               return true;
+            }
+            else if (dt0.getMonth() == dt1.getMonth())
+            {
+               if   (dt0.getDay()  < dt1.getDay())
+               {
+                   return true;
+               }
+               else if (dt0.getDay() == dt1.getDay())
+               {
+                  if    (dt0.getHour()  < dt1.getHour())
+                  {
+                     return true;
+                  }
+                  else if (dt0.getHour() == dt1.getHour())
+                  { 
+                     if   (dt0.getMinute()  < dt1.getMinute())
+                     {
+                        return true;
+                     }
+                     else if (dt0.getMinute() == dt1.getMinute())
+                     {
+                        if (dt0.getSecond() < dt1.getSecond())
+                           return true;
+                     }
+                  }
+               }
+            }
+         }
          return false;
       }
Index: XMLIO_V2/dev/common/src/xmlio/config/field_attribute.conf
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/config/field_attribute.conf	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/config/field_attribute.conf	(revision 266)
@@ -7,4 +7,5 @@
 
 DECLARE_ATTRIBUTE(StdString, freq_op)
+DECLARE_ATTRIBUTE(StdString, freq_offset)
 DECLARE_ATTRIBUTE(int,       level)
 DECLARE_ATTRIBUTE(int,       prec)
Index: XMLIO_V2/dev/common/src/xmlio/config/file_attribute.conf
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/config/file_attribute.conf	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/config/file_attribute.conf	(revision 266)
@@ -2,6 +2,7 @@
 DECLARE_ATTRIBUTE(StdString, description)
 
+DECLARE_ATTRIBUTE(StdString, name_suffix)
+
 DECLARE_ATTRIBUTE(StdString, output_freq)
-
 DECLARE_ATTRIBUTE(int,       output_level)
 
Index: XMLIO_V2/dev/common/src/xmlio/config/functor_type.conf
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/config/functor_type.conf	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/config/functor_type.conf	(revision 266)
@@ -8,6 +8,15 @@
 
 #ifdef __XMLIO_COnce__
-   DECLARE_FUNCTOR(Once , once)
+   DECLARE_FUNCTOR(Once, once)
 #endif //__XMLIO_COnce__
 
+#ifdef __XMLIO_CMaximum__
+   DECLARE_FUNCTOR(Maximum , maximum)
+#endif //__XMLIO_CMaximum__
+
+#ifdef __XMLIO_CMinimum__
+   DECLARE_FUNCTOR(Minimum , minimum)
+#endif //__XMLIO_CMinimum__
+
+
 #undef DECLARE_FUNCTOR
Index: XMLIO_V2/dev/common/src/xmlio/data_treatment.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/data_treatment.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/data_treatment.cpp	(revision 266)
@@ -38,4 +38,5 @@
          // Mise Ã  jour cÃŽtÃ© client
          this->currentContext->getCalendar()->update(step);
+//         std::cout <<  "current date : " << this->currentContext->getCalendar()->getCurrentDate() << std::endl;
          if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
          { // Mise Ã  jour cÃŽtÃ© serveur
@@ -49,4 +50,5 @@
          // Mise Ã  jour cÃŽtÃ© client
          this->currentContext->getCalendar()->setTimeStep(duration);
+         std::cout << "timestep :" << duration << std::endl;
          if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
          { // Mise Ã  jour cÃŽtÃ© serveur
Index: XMLIO_V2/dev/common/src/xmlio/data_treatment.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/data_treatment.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/data_treatment.hpp	(revision 266)
@@ -81,7 +81,15 @@
             boost::shared_ptr<CFile> file = *it;
             StdString filename = (!file->name.isEmpty())
-                               ? file->name.getValue() : file->getId();
+                               ?   file->name.getValue() : file->getId();
             StdOStringStream oss;
-            oss << "wk/data/" << filename << "_node" << comm::CMPIManager::GetCommRank() << ".nc";
+            if (!CObjectFactory::GetObject<CContext>
+                (CObjectFactory::GetCurrentContextId())->output_dir.isEmpty())
+            	oss << CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId())->output_dir.getValue();
+            oss << filename;
+            if (!file->name_suffix.isEmpty())
+                oss << file->name_suffix.getValue();
+            if (comm::CMPIManager::GetCommSize() > 1)
+	        oss << "_node" << comm::CMPIManager::GetCommRank();
+	    oss << ".nc";
             boost::shared_ptr<io::CDataOutput> dout(new T(oss.str(), false));
             file->initializeDataOutput(dout);
@@ -93,11 +101,12 @@
             (const StdString & fieldId, const ARRAY(float, N) & data)
       {
-		 typedef typename boost::multi_array<double, N>::size_type sizetp;
+         typedef typename boost::multi_array<double, N>::size_type sizetp;
          std::vector<sizetp> shape;
          const sizetp *	shapearr = data->shape();
 
          shape.assign(shapearr, shapearr + N);
-         ARRAY_CREATE(datad, double, N, [shape]);
-         datad->assign(data->begin(), data->end());
+         ARRAY(double, N) datad(new CArray<double, N>(shape));
+         for (StdSize i = 0; i < datad->num_elements(); i++)
+          datad->data()[i] = data->data()[i];
 
          this->write_data(fieldId, datad);
@@ -110,14 +119,17 @@
          const date::CDate & currDate =
                 this->currentContext->getCalendar()->getCurrentDate();
+         const date::CDuration & timestep = 
+               this->currentContext->getCalendar()->getTimeStep();
          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();
-
+//	 std::cout << "nb :" << refField.size() << std::endl;
          for (; it != end; it++)
          {
             boost::shared_ptr<CField> field = *it;
             boost::shared_ptr<CFile>  file  = field->getRelFile();
-            if (field->updateData(currDate, data))
+//            std::cout << ">> " << fieldId << ", " << file->getId() << std::endl;
+            if (field->updateData(currDate, timestep, data))
             {
                if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
@@ -131,5 +143,4 @@
                }
             }
-            return;
          }
 
Index: XMLIO_V2/dev/common/src/xmlio/duration.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/duration.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/duration.cpp	(revision 266)
@@ -50,12 +50,22 @@
          while (!in.eof())
          {
-               in >> v >> c;
+               if (!(in >> v >> c)) 
+               {
+                 //DEBUG("----> Pb StdIStream & operator>>(StdIStream & in , CDuration & duration)") ;
+                 //if (in.eof())  DEBUG("----> Fin de fichier StdIStream & operator>>(StdIStream & in , CDuration & duration)") ;
+               }
+               if (in.eof())  
+               {
+                 //DEBUG("----> Fin de fichier StdIStream & operator>>(StdIStream & in , CDuration & duration)") ;
+                 break ;
+               }
                switch (c)
                {
-                  case 'y': duration.year   = v; continue;
-                  case 'd': duration.day    = v; continue;
-                  case 'h': duration.hour   = v; continue;
-                  case 's': duration.second = v; continue;
+                  case 'y': duration.year   = v; break;
+                  case 'd': duration.day    = v; break;
+                  case 'h': duration.hour   = v; break;
+                  case 's': duration.second = v; break;
                   case 'm':
+                  {
                      in >> c;
                      if     (c == 'i') duration.minute = v;
@@ -64,12 +74,13 @@
                      {
                         StdString valc("m"); valc.append(1, c);
-                        DEBUG("La chaine \"" << valc << "\" ne permet pas de dÃ©finir une unitÃ© de durÃ©e.");
-                        continue;
+                        //DEBUG("La chaine \"" << valc << "\" ne permet pas de dÃ©finir une unitÃ© de durÃ©e.");
+                        break;
                      }
-                     continue;
+                     break;
+                  }
                   default:
                      StdString valc; valc.append(1, c);
-                     DEBUG("La chaine \"" << valc << "\" ne permet pas de dÃ©finir une unitÃ© de durÃ©e.");
-                     continue;
+                     //DEBUG("La chaine \"" << valc << "\" ne permet pas de dÃ©finir une unitÃ© de durÃ©e.");
+                     break;
                }
             }
Index: XMLIO_V2/dev/common/src/xmlio/fake_client/fake_lmdz.f90
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/fake_client/fake_lmdz.f90	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/fake_client/fake_lmdz.f90	(revision 266)
@@ -6,5 +6,5 @@
 
    ! Modules de la bibliothÃšque xmlioserver
-   USE IXMLIOSERVER
+   USE XIOS
    USE ISO_C_BINDING
 
Index: XMLIO_V2/dev/common/src/xmlio/fake_client/fake_nemo.f90
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/fake_client/fake_nemo.f90	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/fake_client/fake_nemo.f90	(revision 266)
@@ -6,5 +6,5 @@
 
    ! Modules de la bibliothÃšque xmlioserver
-   USE IXMLIOSERVER
+   USE XIOS
    USE ISO_C_BINDING
 
Index: XMLIO_V2/dev/common/src/xmlio/fake_client/fake_orchidee.f90
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/fake_client/fake_orchidee.f90	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/fake_client/fake_orchidee.f90	(revision 266)
@@ -6,5 +6,5 @@
 
    ! Modules de la bibliothÃšque xmlioserver
-   USE IXMLIOSERVER
+   USE XIOS
    USE ISO_C_BINDING
 
Index: XMLIO_V2/dev/common/src/xmlio/fortran/ixmlioserver.f03.in
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/fortran/ixmlioserver.f03.in	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/fortran/ixmlioserver.f03.in	(revision 266)
@@ -6,5 +6,5 @@
 #include "macro.inc"
 
-MODULE IXMLIOSERVER
+MODULE XIOS
    USE, INTRINSIC :: ISO_C_BINDING
 
@@ -110,5 +110,5 @@
 
       SUBROUTINE xios_write_data(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C)
-         import C_INT, C_CHAR, C_PTR, C_FLOAT, C_DOUBLE, C_BOOL
+         import C_INT, C_CHAR, C_PTR, C_DOUBLE, C_BOOL
          CHARACTER(kind = C_CHAR), DIMENSION(*) :: fieldid
          INTEGER  (kind = C_INT),  VALUE        :: fieldid_size
@@ -116,4 +116,17 @@
          INTEGER  (kind = C_INT), VALUE         :: data_Xsize, data_Ysize, data_Zsize
       END SUBROUTINE xios_write_data
+      
+      SUBROUTINE xios_write_data_f(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C)
+         import C_INT, C_CHAR, C_PTR, C_FLOAT, C_BOOL
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fieldid
+         INTEGER  (kind = C_INT),  VALUE        :: fieldid_size
+         REAL(kind = C_FLOAT), DIMENSION(*)     :: data_k4
+         INTEGER  (kind = C_INT), VALUE         :: data_Xsize, data_Ysize, data_Zsize
+      END SUBROUTINE xios_write_data_f
+
+      SUBROUTINE  xios_init_ioserver(comm_client) BIND(C)
+	 import C_INT
+         INTEGER  (kind = C_INT) :: comm_client
+      END SUBROUTINE xios_init_ioserver
 
 #define DECLARE_ATTRIBUTE(type, name) \
@@ -149,4 +162,9 @@
 
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
+
+   SUBROUTINE  init_ioserver(comm_client)
+      INTEGER, INTENT(INOUT) :: comm_client
+      CALL xios_init_ioserver(comm_client)
+   END SUBROUTINE init_ioserver
 
    SUBROUTINE handle_create(ret, dtype, idt)
@@ -165,8 +183,4 @@
    SUBROUTINE update_calendar(step)
       INTEGER, INTENT(IN):: step
-      IF (step < 1) THEN
-         PRINT *, "L'argument 'step' ne peut Ãªtre nÃ©gatif ou nul"
-         STOP
-      END IF
       CALL xios_update_calendar(step)
    END SUBROUTINE update_calendar
@@ -255,12 +269,13 @@
    SUBROUTINE dtreatment_end(context_hdl)
       TYPE(XHandle), INTENT(IN), VALUE :: context_hdl
-      CALL context_set_current(context_hdl)
+      !CALL context_set_current(context_hdl)
       CALL xios_dtreatment_end()
    END SUBROUTINE dtreatment_end
 
-   SUBROUTINE write_data (fieldid,                         &
-                          data1d_k8, data2d_k8, data3d_k8)
+   SUBROUTINE write_data (fieldid, data1d_k4, data2d_k4, data3d_k4, data1d_k8, data2d_k8, data3d_k8)
       CHARACTER(len = *), INTENT(IN)                     :: fieldid
       REAL(kind = 8), DIMENSION(*), OPTIONAL, INTENT(IN) :: data1d_k8(:), data2d_k8(:,:), data3d_k8(:,:,:)
+      REAL(kind = 4), DIMENSION(*), OPTIONAL, INTENT(IN) :: data1d_k4(:), data2d_k4(:,:), data3d_k4(:,:,:)
+      
       IF((.NOT. PRESENT(data1d_k8)) .AND. &
          (.NOT. PRESENT(data2d_k8)) .AND. &
@@ -269,14 +284,22 @@
          STOP
       END IF
+      
       IF (PRESENT (data1d_k8)) THEN
-         CALL xios_write_data(fieldid, len(fieldid), data1d_k8, &
-                              size(data1d_k8, 1), -1, -1)
+         CALL xios_write_data(fieldid, len(fieldid), data1d_k8, size(data1d_k8, 1), -1, -1)
       ELSE IF (PRESENT (data2d_k8)) THEN
-         CALL xios_write_data(fieldid, len(fieldid), data2d_k8, &
-                              size(data2d_k8, 1), size(data2d_k8, 2), -1)
+         CALL xios_write_data(fieldid, len(fieldid), data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2), -1)
       ELSE IF (PRESENT (data3d_k8)) THEN
-         CALL xios_write_data(fieldid, len(fieldid), data3d_k8, &
-                              size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3))
-      END IF
+         CALL xios_write_data(fieldid, len(fieldid), data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3))
+      END IF
+      
+      IF (PRESENT (data1d_k4)) THEN
+         CALL xios_write_data_f(fieldid, len(fieldid), data1d_k4, size(data1d_k4, 1), -1, -1)
+      ELSE IF (PRESENT (data2d_k4)) THEN
+         CALL xios_write_data_f(fieldid, len(fieldid), data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2), -1)
+      ELSE IF (PRESENT (data3d_k4)) THEN
+         CALL xios_write_data_f(fieldid, len(fieldid), data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3))
+      END IF
+      
+      
    END SUBROUTINE
 
@@ -389,3 +412,3 @@
    END SUBROUTINE set_file_attributes
 
-END MODULE IXMLIOSERVER
+END MODULE XIOS
Index: XMLIO_V2/dev/common/src/xmlio/functor.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/functor.cpp	(revision 266)
@@ -8,5 +8,5 @@
 
       CFunctor::CFunctor(const StdString & id, ARRAY(double, 1) doutput)
-         : SuperClass(id), doutput(doutput)
+         : SuperClass(id), doutput(doutput), nbcall(0)
       { /* Ne rien faire de plus */  }
 
@@ -39,4 +39,5 @@
       ARRAY(double, 1) CFunctor::operator ()(const ARRAY(double, 1) dinput)
       {
+         this->nbcall++;
          if (dinput->size() != this->doutput->size())
             ERROR("CFunctor::operator ()(dinput)",
@@ -48,4 +49,9 @@
       }
 
+      void CFunctor::final(void) 
+      {
+         this->nbcall = 0;
+      } 
+
       //---------------------------------------------------------------
 
Index: XMLIO_V2/dev/common/src/xmlio/functor.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/functor.hpp	(revision 266)
@@ -28,4 +28,7 @@
             virtual ~CFunctor(void);
 
+            //Traitement ///
+            virtual void final(void);
+
          protected :
 
@@ -48,4 +51,7 @@
             DoubleArray doutput;
             
+         protected :
+            /// PropriÃ©tÃ©s protÃ©gÃ©es ///   
+            int nbcall;            
       }; // class CFunctor
    } // namespace func
Index: XMLIO_V2/dev/common/src/xmlio/functor/average.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/average.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/functor/average.cpp	(revision 266)
@@ -16,12 +16,22 @@
       //---------------------------------------------------------------
 
-      void CAverage::apply(const DoubleArray         UNUSED(dinput),
-                                 DoubleArray         UNUSED(doutput))
+      void CAverage::apply(const DoubleArray _dinput,
+                                 DoubleArray _doutput)
       {
-         ERROR("CAverage::apply(...)", << "Not implemented yet !");
+         const double * it1  = _dinput->data(),
+                      * end1 = _dinput->data() + _dinput->num_elements(); 
+               double * it   = _doutput->data();
+         if (this->nbcall == 1)
+              for (; it1 != end1; it1++, it++) *it  = *it1;
+         else for (; it1 != end1; it1++, it++) *it += *it1;               
       }
-
-      //---------------------------------------------------------------
-
+      
+      void CAverage::final(void)
+      {
+          double * it1  = this->getDataOutput()->data(),
+                 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements();
+          for (; it1 != end1; it1++) *it1 /= this->nbcall;
+          this->nbcall = 0;                                                   
+      }
    } // namespace func
 } // namespace xmlioserver
Index: XMLIO_V2/dev/common/src/xmlio/functor/average.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/average.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/functor/average.hpp	(revision 266)
@@ -27,5 +27,6 @@
             /// Traitement ///
             virtual void apply(const DoubleArray dinput, DoubleArray doutput);
-
+            virtual void final(void) ;
+            
             /// Destructeur ///
             virtual ~CAverage(void);
Index: XMLIO_V2/dev/common/src/xmlio/functor/functor_type.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/functor_type.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/functor/functor_type.hpp	(revision 266)
@@ -5,4 +5,6 @@
 #include "instant.hpp"
 #include "once.hpp"
+#include "maximum.hpp"
+#include "minimum.hpp"
 
 #endif //__XMLIO_functor_type__
Index: XMLIO_V2/dev/common/src/xmlio/functor/instant.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/instant.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/functor/instant.cpp	(revision 266)
@@ -16,8 +16,11 @@
       //---------------------------------------------------------------
 
-      void CInstant::apply(const DoubleArray         UNUSED(dinput),
-                                 DoubleArray         UNUSED(doutput))
+      void CInstant::apply(const DoubleArray _dinput,
+                                 DoubleArray _doutput)
       {
-         ERROR("CInstant::apply(...)", << "Not implemented yet !");
+       	 const double * it1  = _dinput->data(),
+       	              * end1 = _dinput->data() + _dinput->num_elements();
+       	 double * it   = _doutput->data();
+       	 for (; it1 != end1; it1++, it++) *it  = *it1;
       }
 
Index: XMLIO_V2/dev/common/src/xmlio/functor/maximum.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/maximum.cpp	(revision 266)
+++ XMLIO_V2/dev/common/src/xmlio/functor/maximum.cpp	(revision 266)
@@ -0,0 +1,34 @@
+#include "maximum.hpp"
+#include <algorithm>
+
+
+namespace xmlioserver
+{
+   namespace func
+   {
+      /// ////////////////////// DÃ©finitions ////////////////////// ///
+
+      CMaximum::CMaximum(DoubleArray doutput)
+         : SuperClass(StdString("maximum"), doutput)
+      { /* Ne rien faire de plus */ }
+
+      CMaximum::~CMaximum(void)
+      { /* Ne rien faire de plus */ }
+
+      //---------------------------------------------------------------
+
+      void CMaximum::apply(const DoubleArray _dinput,
+                                 DoubleArray _doutput)
+      {
+       	 const double * it1  = _dinput->data(),
+       	              * end1 = _dinput->data() + _dinput->num_elements();
+       	       double * it   = _doutput->data();
+         if (this->nbcall == 1)
+              for (; it1 != end1; it1++, it++) *it = *it1;
+         else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it);  
+      }
+
+      //---------------------------------------------------------------
+
+   } // namespace func
+} // namespace xmlioserver
Index: XMLIO_V2/dev/common/src/xmlio/functor/maximum.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/maximum.hpp	(revision 266)
+++ XMLIO_V2/dev/common/src/xmlio/functor/maximum.hpp	(revision 266)
@@ -0,0 +1,38 @@
+#ifndef __XMLIO_CMaximum__
+#define __XMLIO_CMaximum__
+
+/// xmlioserver headers ///
+#include "functor.hpp"
+
+namespace xmlioserver
+{
+   namespace func
+   {
+      /// ////////////////////// DÃ©clarations ////////////////////// ///
+      class CMaximum : public CFunctor
+      {
+         /// DÃ©finition de type ///
+         typedef CFunctor SuperClass;
+         typedef ARRAY(double, 1) DoubleArray;
+
+         public :
+
+            /// Constructeurs ///
+            //CMaximum(void);                             // Not implemented.
+            //CMaximum(const CFunData & data);
+            CMaximum(DoubleArray doutput);
+            //CMaximum(const CMaximum & Maximum);         // Not implemented.
+            //CMaximum(const CMaximum * const Maximum);   // Not implemented.
+
+            /// Traitement ///
+            virtual void apply(const DoubleArray dinput, DoubleArray doutput);
+
+            /// Destructeur ///
+            virtual ~CMaximum(void);
+
+      }; // class CMaximum
+
+   } // namespace func
+} // namespace xmlioserver
+
+#endif //__XMLIO_CMaximum__
Index: XMLIO_V2/dev/common/src/xmlio/functor/minimum.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/minimum.cpp	(revision 266)
+++ XMLIO_V2/dev/common/src/xmlio/functor/minimum.cpp	(revision 266)
@@ -0,0 +1,32 @@
+#include "minimum.hpp"
+
+namespace xmlioserver
+{
+   namespace func
+   {
+      /// ////////////////////// DÃ©finitions ////////////////////// ///
+
+      CMinimum::CMinimum(DoubleArray doutput)
+         : SuperClass(StdString("minimum"), doutput)
+      { /* Ne rien faire de plus */ }
+
+      CMinimum::~CMinimum(void)
+      { /* Ne rien faire de plus */ }
+
+      //---------------------------------------------------------------
+
+      void CMinimum::apply(const DoubleArray _dinput,
+                                 DoubleArray _doutput)
+      {
+         const double * it1  = _dinput->data(),
+                      * end1 = _dinput->data() + _dinput->num_elements();
+         double * it   = _doutput->data();
+         if (this->nbcall == 1)
+              for (; it1 != end1; it1++, it++) *it = *it1;
+         else for (; it1 != end1; it1++, it++) *it = std::min(*it1, *it);
+      }
+
+      //---------------------------------------------------------------
+
+   } // namespace func
+} // namespace xmlioserver
Index: XMLIO_V2/dev/common/src/xmlio/functor/minimum.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/minimum.hpp	(revision 266)
+++ XMLIO_V2/dev/common/src/xmlio/functor/minimum.hpp	(revision 266)
@@ -0,0 +1,38 @@
+#ifndef __XMLIO_CMinimum__
+#define __XMLIO_CMinimum__
+
+/// xmlioserver headers ///
+#include "functor.hpp"
+
+namespace xmlioserver
+{
+   namespace func
+   {
+      /// ////////////////////// DÃ©clarations ////////////////////// ///
+      class CMinimum : public CFunctor
+      {
+         /// DÃ©finition de type ///
+         typedef CFunctor SuperClass;
+         typedef ARRAY(double, 1) DoubleArray;
+
+         public :
+
+            /// Constructeurs ///
+            //CMinimum(void);                             // Not implemented.
+            //CMinimum(const CFunData & data);
+            CMinimum(DoubleArray doutput);
+            //CMinimum(const CMinimum & Minimum);         // Not implemented.
+            //CMinimum(const CMinimum * const Minimum);   // Not implemented.
+
+            /// Traitement ///
+            virtual void apply(const DoubleArray dinput, DoubleArray doutput);
+
+            /// Destructeur ///
+            virtual ~CMinimum(void);
+
+      }; // class CMinimum
+
+   } // namespace func
+} // namespace xmlioserver
+
+#endif //__XMLIO_CMinimum__
Index: XMLIO_V2/dev/common/src/xmlio/functor/once.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/functor/once.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/functor/once.cpp	(revision 266)
@@ -16,8 +16,11 @@
       //---------------------------------------------------------------
 
-      void COnce::apply(const DoubleArray         UNUSED(dinput),
-                              DoubleArray         UNUSED(doutput))
+      void COnce::apply(const DoubleArray _dinput,
+                              DoubleArray _doutput)
       {
-         ERROR("COnce::apply(...)", << "Not implemented yet !");
+       	 const double * it1  = _dinput->data(),
+       	              * end1 = _dinput->data() + _dinput->num_elements();
+       	       double * it   = _doutput->data();
+        for (; it1 != end1; it1++, it++) *it  = *it1;
       }
 
Index: XMLIO_V2/dev/common/src/xmlio/iface/interface.cpp.in
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/iface/interface.cpp.in	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/iface/interface.cpp.in	(revision 266)
@@ -97,20 +97,40 @@
 void xios_handle_create (XPtr * const _ret, XDType _dtype, const XString _id, XSize _id_len)
 {
-   MAKE_STRING(__id, _id, _id_len);
-   switch(_dtype)
-   {
-      case (ECONTEXT):
-         // Si le context n'existe pas, on retourne un handle vide/nul.
-         *_ret = (!CObjectFactory::HasObject<CContext>(__id))
-               ? 0 : CObjectFactory::GetObject<CContext>(__id).get();
-         return ;
-      CASE_ELEM(AXIS   , Axis)
-      CASE_ELEM(DOMAIN , Domain)
-      CASE_ELEM(FIELD  , Field)
-      CASE_ELEM(FILE   , File)
-      CASE_ELEM(GRID   , Grid)
-      default :
-         *_ret = 0;
-         return;
+   try
+   {
+      MAKE_STRING(__id, _id, _id_len);
+      switch(_dtype)
+      {
+         case (ECONTEXT):
+        {
+             *_ret = 0;
+            // Si le context n'existe pas, on retourne un handle vide/nul.
+            //*_ret = (!CObjectFactory::HasObject<CContext>(__id))
+            //      ? 0 : CObjectFactory::GetObject<CContext>(__id).get();
+            std::vector<boost::shared_ptr<CContext> > def_vector = 
+		CContext::GetContextGroup()->getChildList();
+           for (StdSize i = 0; i < def_vector.size(); i++)
+	   {
+              //std::cout << "_ " << def_vector[i]->getId() << std::endl;  
+              if (def_vector[i]->getId().compare(__id) == 0)
+                 *_ret = def_vector[i].get();
+           }
+           //std::cout << __id << "=" << *_ret << std::endl;	
+            return ;
+         }
+         CASE_ELEM(AXIS   , Axis)
+         CASE_ELEM(DOMAIN , Domain)
+         CASE_ELEM(FIELD  , Field)
+         CASE_ELEM(FILE   , File)
+         CASE_ELEM(GRID   , Grid)
+         default :
+            *_ret = 0;
+            return;
+      }
+   }
+   catch (CException & exc)
+   {
+      std::cerr << exc.getMessage() << std::endl;
+      exit (EXIT_FAILURE);
    }
 }
@@ -127,5 +147,5 @@
       CTreeManager::ParseFile(__filename);
       //~ StdOStringStream oss;
-      //~ oss << StdString("data/def/def_client_pre.")
+      //~ oss << StdString("def_client_pre.")
       //~     << CMPIManager::GetCommRank(CMPIManager::GetCommWorld());
       //~ CTreeManager::PrintTreeToFile(oss.str());
@@ -147,5 +167,5 @@
       CTreeManager::ParseString(__xmlcontent);
       //~ StdOStringStream oss;
-      //~ oss << StdString("data/def/def_client_pre.")
+      //~ oss << StdString("def_client_pre.")
       //~     << CMPIManager::GetCommRank(CMPIManager::GetCommWorld());
       //~ CTreeManager::PrintTreeToFile(oss.str());
@@ -162,6 +182,14 @@
 void xios_context_set_current (XPtr const _ctx, bool _wswap)
 {
-   boost::shared_ptr<CContext> context = CObjectFactory::GetObject<CContext> ((CContext*)_ctx);
-   CTreeManager::SetCurrentContextId(context->getId());
+   try
+   {
+      //boost::shared_ptr<CContext> context = CObjectFactory::GetObject<CContext> ((CContext*)_ctx);
+       CTreeManager::SetCurrentContextId(((CContext*)_ctx)->getId());
+   }
+   catch (CException & exc)
+   {
+      std::cerr << exc.getMessage() << std::endl;
+      exit (EXIT_FAILURE);
+   }
 }
 
@@ -284,9 +312,35 @@
 {
    MAKE_STRING(__filename, _filename, _filename_len);
-   if (_filename_len != -1)
-      CTreeManager::PrintTreeToFile(__filename);
-   else
-      CTreeManager::PrintTreeToStream(std::clog);
-}
+   try
+   {
+      if (_filename_len != -1)
+         CTreeManager::PrintTreeToFile(__filename);
+      else
+         CTreeManager::PrintTreeToStream(std::clog);
+   }
+   catch (CException & exc)
+   {
+      std::cerr << exc.getMessage() << std::endl;
+      exit (EXIT_FAILURE);
+   }
+}
+
+//-------------------------------------------------------------------
+
+void xios_init_ioserver(MPIComm * comm_client)
+{
+   try
+   {
+      MPIComm comm_client_server, comm_server;
+      CMPIManager::Initialise(NULL, NULL);
+      CMPIManager::DispatchClient(false, *comm_client, comm_client_server, comm_server);
+   }
+   catch (CException & exc)
+   {
+      std::cerr << exc.getMessage() << std::endl;
+      exit (EXIT_FAILURE);
+   }
+}
+
 
 //-------------------------------------------------------------------
@@ -301,13 +355,13 @@
              CObjectFactory::GetObject<CContext>(__context);
       StdOStringStream oss;
-      //~ oss << StdString("data/def/def_client_next.")
-      //~     << CMPIManager::GetCommRank(CMPIManager::GetCommWorld());
-      //~ CTreeManager::PrintTreeToFile(oss.str());
-      //~ oss.str("");
+      oss << StdString("def_client_next.")
+          << CMPIManager::GetCommRank(CMPIManager::GetCommWorld());
+      CTreeManager::PrintTreeToFile(oss.str());
+      oss.str("");
 
       boost::shared_ptr<CDataTreatment> dt(new CDataTreatment (context));
       context->setDataTreatment(dt);
 
-      oss << StdString("data/def/def_client_end.")
+      oss << StdString("def_client_end.")
           << CMPIManager::GetCommRank(CMPIManager::GetCommWorld());
       CTreeManager::PrintTreeToFile(oss.str());
@@ -350,5 +404,13 @@
 void xios_dtreatment_end(void)
 {
-
+   try
+   {
+  	   CMPIManager::Finalize();
+   }
+   catch (CException & exc)
+   {
+      std::cerr << exc.getMessage() << std::endl;
+      exit (EXIT_FAILURE);
+   }
 }
 
@@ -358,6 +420,79 @@
                      XSize data_Xsize, XSize data_Ysize, XSize data_Zsize)
 {
-
-}
+   MAKE_STRING(__field_id, _field_id, _field_id_len);
+   try
+   {
+      boost::shared_ptr<CContext> context =
+      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment();
+      if (data_Ysize==-1 && data_Zsize==-1)
+      {
+         ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize]));
+         std::copy(data_k8, data_k8+data->num_elements(), data->data());
+         dtreat->write_data(__field_id, data);
+         return;
+      }
+      else if (data_Zsize==-1)
+      {
+         ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize]));
+         std::copy(data_k8, data_k8+data->num_elements(), data->data());
+         dtreat->write_data(__field_id, data);
+         return;
+      }
+      else
+      {
+         ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize]));
+         std::copy(data_k8, data_k8+data->num_elements(), data->data());
+         dtreat->write_data(__field_id, data);
+         return;
+      }
+   }
+   catch (CException & exc)
+   {
+      std::cerr << exc.getMessage() << std::endl;
+      exit (EXIT_FAILURE);
+   }
+}
+
+//-------------------------------------------------------------------
+
+void xios_write_data_f(const XString _field_id, XSize _field_id_len, float * data_k4,
+                       XSize data_Xsize, XSize data_Ysize, XSize data_Zsize)
+{
+   MAKE_STRING(__field_id, _field_id, _field_id_len);
+   try
+   {
+      boost::shared_ptr<CContext> context =
+      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment();
+      if (data_Ysize==-1 && data_Zsize==-1)
+      {
+         ARRAY(float, 1) data(new CArray<float, 1>(boost::extents [data_Xsize]));
+         std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
+         dtreat->write_data(__field_id, data);
+         return;
+      }
+      else if (data_Zsize==-1)
+      {
+         ARRAY(float, 2) data(new CArray<float, 2>(boost::extents [data_Xsize][data_Ysize]));
+         std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
+         dtreat->write_data(__field_id, data);
+         return;
+      }
+      else
+      {
+         ARRAY(float, 3) data(new CArray<float, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize]));
+         std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
+         dtreat->write_data(__field_id, data);
+         return;
+      }
+   }
+   catch (CException & exc)
+   {
+      std::cerr << exc.getMessage() << std::endl;
+      exit (EXIT_FAILURE);
+   }
+}
+
 
 //-------------------------------------------------------------------
@@ -367,4 +502,8 @@
    try
    {
+      boost::shared_ptr<CContext> context =
+      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment();
+      dtreat->update_calendar(step);
    }
    catch (CException & exc)
@@ -382,4 +521,9 @@
    try
    {
+      date::CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second};
+      boost::shared_ptr<CContext> context =
+      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment();
+      dtreat->set_timestep(dur);
    }
    catch (CException & exc)
Index: XMLIO_V2/dev/common/src/xmlio/main_server.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/main_server.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/main_server.cpp	(revision 266)
@@ -25,5 +25,5 @@
       //CXIOSManager::AddClient("lmdz"    , 4, 2, &lmdz_fake_entry);
       CMPIManager::DispatchClient(true, comm_client, comm_client_server,  comm_server);
-      CMPIManager::RunServer("Nemo", comm_client_server, comm_server);
+      CXIOSManager::RunServer("Nemo", comm_client_server, comm_server);
       //CXIOSManager::RunClientServer (comm::CMPIManager::GetCommWorld ());
       CXIOSManager::Finalize ();
Index: XMLIO_V2/dev/common/src/xmlio/node/domain.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/node/domain.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/node/domain.cpp	(revision 266)
@@ -381,7 +381,10 @@
             data_n_index.setValue(dni);
             
-            for(int count = 0, i = 0; i  < data_ni.getValue(); i++)
+            //for(int count = 0, i = 0; i  < data_ni.getValue(); i++)
+            //for(int j = 0; j < data_nj.getValue(); j++, count++)
+            
+            for(int count = 0, j = 0; j  < data_nj.getValue(); j++)
             {
-               for(int j = 0; j < data_nj.getValue(); j++, count++)
+               for(int i = 0; i < data_ni.getValue(); i++, count++)
                {
                   (*__arri)[count] = i+1 ;
@@ -399,5 +402,58 @@
    //----------------------------------------------------------------
    
-   void CDomain::completeLonLat(void)
+   void CDomain::completeLonLatClient(void)
+   {
+      ARRAY_CREATE(lonvalue_temp, double, 1, [0]);
+      ARRAY_CREATE(latvalue_temp, double, 1, [0]);
+      
+      const int zoom_ibegin_client  = zoom_ibegin_loc.getValue(),
+                zoom_jbegin_client  = zoom_jbegin_loc.getValue(),
+                zoom_ni_client      = zoom_ni_loc.getValue(),
+                zoom_nj_client      = zoom_nj_loc.getValue();
+                
+      ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(),
+                       latvalue_ = this->latvalue.getValue();
+                
+      if (this->data_dim.getValue() == 2)
+      {
+         StdSize dm = zoom_ni_client * zoom_nj_client;
+
+         lonvalue_temp->resize(boost::extents[dm]);
+         latvalue_temp->resize(boost::extents[dm]);
+         
+         for (int i = 0; i < zoom_ni_client; i++)
+         {
+            for (int j = 0; j < zoom_nj_client; j++)
+            {
+               (*lonvalue_temp)[i + j * zoom_ni_client] = (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];              
+               (*latvalue_temp)[i + j * zoom_ni_client] = (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];
+            }
+         }
+         this->lonvalue.setValue(lonvalue_temp);
+         this->latvalue.setValue(latvalue_temp);
+      }
+      else
+      {
+         lonvalue_temp->resize(boost::extents[zoom_ni_client]);
+         latvalue_temp->resize(boost::extents[zoom_nj_client]);
+         
+         for (int i = zoom_ibegin_client - 1; i < (zoom_ni_client - zoom_ibegin_client + 1); i++)
+         {
+            (*lonvalue_temp)[i] = (*lonvalue_)[i]; 
+         }
+         
+         for (int j = zoom_ibegin_client - 1; j < (zoom_nj_client - zoom_jbegin_client + 1); j++)
+         {
+            (*latvalue_temp)[j] = (*latvalue_)[j];
+         }
+         
+         this->lonvalue.setValue(lonvalue_temp);
+         this->latvalue.setValue(latvalue_temp);
+      }  
+   }
+ 
+   //----------------------------------------------------------------
+      
+   void CDomain::completeLonLatServer(void)
    {
       ARRAY_CREATE(lonvalue_temp, double, 1, [0]);
@@ -441,6 +497,6 @@
                for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_serv + 1); j++)
                {
-                  (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l];              
-                  (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++];
+                  (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l];      // erreur        
+                  (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++];    // erreur
                }
             }
@@ -572,9 +628,22 @@
          this->checkDomainData();
          this->checkCompression();
+         
+         this->ibegin_sub.push_back(this->ibegin.getValue());
+         this->jbegin_sub.push_back(this->jbegin.getValue());
+         this->iend_sub.push_back(this->iend.getValue());
+         this->jend_sub.push_back(this->jend.getValue()); 
+      
+         this->latvalue_sub.push_back(this->latvalue.getValue());
+         this->lonvalue_sub.push_back(this->lonvalue.getValue());  
+         
+         if (!this->isEmpty())
+         {
+            this->completeLonLatClient();
+         }
       }
       else
       { // CÃŽtÃ© serveur uniquement
          if (!this->isEmpty())
-            this->completeLonLat();
+            this->completeLonLatServer();
       }
       this->completeMask();
Index: XMLIO_V2/dev/common/src/xmlio/node/domain.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/node/domain.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/node/domain.hpp	(revision 266)
@@ -90,5 +90,6 @@
          /// Mutateur ///
          void addRelFile(const StdString & filename);
-         void completeLonLat(void);
+         void completeLonLatServer(void);
+         void completeLonLatClient(void);
          
          /// Destructeur ///
Index: XMLIO_V2/dev/common/src/xmlio/node/field.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/node/field.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/node/field.cpp	(revision 266)
@@ -19,7 +19,8 @@
       , grid(), file()
       , freq_operation(), freq_write()
+      , nstep(0)
       , last_Write(), last_operation()
       , foperation()
-      , data()
+      , data(new CArray<double, 1>(boost::extents[0]))
    { /* Ne rien faire de plus */ }
 
@@ -29,7 +30,8 @@
       , grid(), file()
       , freq_operation(), freq_write()
+      , nstep(0)
       , last_Write(), last_operation()
       , foperation()
-      , data()
+      , data(new CArray<double, 1>(boost::extents[0]))
    { /* Ne rien faire de plus */ }
 
@@ -88,4 +90,14 @@
    { 
       return (this->file);
+   }
+   
+   StdSize CField::getNStep(void) const
+   {
+      return (this->nstep);
+   }
+   
+   void CField::incrementNStep(void)
+   {
+      this->nstep++;
    }
 
@@ -236,4 +248,14 @@
       else
       {
+         CDuration freq_offset_ = NoneDu;
+         if (!freq_offset.isEmpty())
+         {
+            freq_offset_ = CDuration::FromString(freq_offset.getValue());
+         }
+         else
+         {
+            freq_offset.setValue(NoneDu.toString());
+         }   
+                  
          this->freq_operation = CDuration::FromString(freq_op.getValue());
          this->freq_write     = CDuration::FromString(this->file->output_freq.getValue());
@@ -242,4 +264,6 @@
          this->last_operation = boost::shared_ptr<xmlioserver::date::CDate>
                         (new date::CDate(_context->getCalendar()->getInitDate()));
+         const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep(); 
+         *this->last_operation  = *this->last_operation - toffset;  
          
 #define DECLARE_FUNCTOR(MType, mtype)              \
Index: XMLIO_V2/dev/common/src/xmlio/node/field.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/node/field.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/node/field.hpp	(revision 266)
@@ -64,4 +64,6 @@
       public :
 
+         StdSize getNStep(void) const;
+
          const date::CDuration & getFreqOperation(void) const;
          const date::CDuration & getFreqWrite(void) const;
@@ -78,8 +80,9 @@
          /// Mutateur ///
          void setRelFile(const boost::shared_ptr<CFile> _file);
+         void incrementNStep(void);
 
          template <StdSize N>
             inline bool updateData
-               (const date::CDate & currDate, const ARRAY(double, N) data);
+               (const date::CDate & currDate, const date::CDuration & timestep, const ARRAY(double, N) data);
 
          bool updateDataServer
@@ -118,4 +121,5 @@
          date::CDuration freq_operation, freq_write;
 
+         StdSize nstep;
          boost::shared_ptr<date::CDate>    last_Write, last_operation;
          boost::shared_ptr<func::CFunctor> foperation;
@@ -146,20 +150,44 @@
 
    template <StdSize N>
-      bool CField::updateData(const date::CDate & currDate, const ARRAY(double, N) data)
-   {
-      if ((*last_operation + freq_operation) >= currDate)
+      bool CField::updateData(const date::CDate & currDate, const date::CDuration & timestep, const ARRAY(double, N) _data)
+   {        
+      const date::CDate opeDate      = *last_operation + freq_operation;
+      const date::CDate writeDate    = *last_Write     + freq_write;       
+
+//      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
+//      std::cout << "Champ : "     << this->getBaseFieldId() << std::endl;
+//      std::cout << "CurrDate : "  << currDate  << std::endl;
+//      std::cout << "opeDate : "   << opeDate   << " = " << *last_operation << " + " << freq_operation << std::endl;
+//      std::cout	<< "writeDate : " << writeDate << " = " << *last_Write     << " + " << freq_write     << std::endl;
+//      std::cout << "(opeDate <= currDate)   = " << std::boolalpha << (opeDate <= currDate)   << std::endl;
+//      std::cout	<< "(writeDate <= currDate) = " << std::boolalpha << (writeDate <= currDate) << std::endl;   
+   
+       //std::cout << ">> " << currDate <<  " : Envoi de donnÃ©es " << this->getBaseFieldId() << std::endl;
+      if (opeDate <= currDate)
       {
-         ARRAY_CREATE(input, double, 1, [0]);
-         input->resize(boost::extents[data->size()]);
-         this->grid->inputField(data, input);
+         //std::cout << "> " << currDate << ": Operation du champs" << this->getBaseFieldId() << std::endl;
+         
+         if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements())
+         {
+            this->data->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]);
+         }
+            
+         ARRAY_CREATE(input, double, 1, [this->data->num_elements()]);
+         this->grid->inputField(_data, input);          
          (*this->foperation)(input);
+         
          *last_operation = currDate;
+//         std::cout << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl; 
       }
       
-      if ((*last_Write + freq_write) >= currDate)
+      if (writeDate < (currDate + freq_operation))
       {
-         *last_Write = currDate;
-         return (true);
+         this->foperation->final();
+         this->incrementNStep();
+         *last_Write = writeDate;
+//         std::cout << "(*last_Write = currDate) : " << *last_Write << " = " << currDate	<< std::endl;
+         return (true);        
       }
+//      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
       return (false);
    };
Index: XMLIO_V2/dev/common/src/xmlio/node/file.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/node/file.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/node/file.cpp	(revision 266)
@@ -106,5 +106,5 @@
    {
       this->setVirtualFieldGroup
-         (CObjectFactory::CreateObject<CFieldGroup>(newVFieldGroupId));
+         (CObjectFactory::CreateObject<CFieldGroup>(/*newVFieldGroupId*/));
    }
 
Index: XMLIO_V2/dev/common/src/xmlio/node/grid.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/node/grid.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/node/grid.cpp	(revision 266)
@@ -1,2 +1,3 @@
+
 #include "grid.hpp"
 
@@ -100,9 +101,9 @@
    //---------------------------------------------------------------
 
-   std::vector<StdSize> CGrid::getShape(void) const
+   std::vector<StdSize> CGrid::getLocalShape(void) const
    {
       std::vector<StdSize> retvalue;
-      retvalue.push_back(this->domain->ni.getValue());
-      retvalue.push_back(this->domain->nj.getValue());
+      retvalue.push_back(domain->zoom_ni_loc.getValue());
+      retvalue.push_back(domain->zoom_nj_loc.getValue());
       if (this->withAxis)
          retvalue.push_back(this->axis->size.getValue());
@@ -111,8 +112,30 @@
    //---------------------------------------------------------------
    
-   StdSize CGrid::getSize(void) const
+   StdSize CGrid::getLocalSize(void) const
    {
       StdSize retvalue = 1;
-      std::vector<StdSize> shape_ = this->getShape();
+      std::vector<StdSize> shape_ = this->getLocalShape();
+      for (StdSize s = 0; s < shape_.size(); s++)
+         retvalue *= shape_[s];
+      return (retvalue);
+   }
+   
+   //---------------------------------------------------------------
+
+   std::vector<StdSize> CGrid::getGlobalShape(void) const
+   {
+      std::vector<StdSize> retvalue;
+      retvalue.push_back(domain->ni.getValue());
+      retvalue.push_back(domain->nj.getValue());
+      if (this->withAxis)
+         retvalue.push_back(this->axis->size.getValue());
+      return (retvalue);
+   }
+   //---------------------------------------------------------------
+   
+   StdSize CGrid::getGlobalSize(void) const
+   {
+      StdSize retvalue = 1;
+      std::vector<StdSize> shape_ = this->getGlobalShape();
       for (StdSize s = 0; s < shape_.size(); s++)
          retvalue *= shape_[s];
@@ -129,10 +152,17 @@
       if (this->storeIndex.size() == 1)
       {
+         
          this->computeIndex() ;
-      }
-      else
-      {
-         this->computeIndexServer();
-      }
+         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]);
+                 
+         this->storeIndex .push_front(storeIndex_);
+         this->out_i_index.push_front(out_i_index_);
+         this->out_j_index.push_front(out_j_index_);
+         this->out_l_index.push_front(out_l_index_);
+      }
+      this->computeIndexServer();
       this->isChecked = true;
    }
@@ -177,5 +207,6 @@
 
    void CGrid::computeIndex(void)
-   {  
+   {    
+   
       const int ni   = domain->ni.getValue() ,
                 nj   = domain->nj.getValue() ,
@@ -200,4 +231,5 @@
 
       ARRAY(bool, 2) mask = domain->mask.getValue() ;
+      ARRAY(int, 2) local_mask =  this->domain->getLocalMask();
 
       int indexCount = 0;
@@ -210,7 +242,7 @@
                 temp_j = (data_dim == 1) ? -1
                        : (*data_j_index)[n] + data_jbegin;
-            i = (data_dim == 1) ? (temp_i - 2) % ni
+            i = (data_dim == 1) ? (temp_i - 1) % ni
                                 : (temp_i - 1) ;
-            j = (data_dim == 1) ? (temp_i - 2) / ni
+            j = (data_dim == 1) ? (temp_i - 1) / ni
                                 : (temp_j - 1) ;
 
@@ -226,5 +258,11 @@
       ARRAY_ASSIGN(this->out_i_index[0], int, 1, [indexCount]);
       ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]);
-
+      
+      // for(int count = 0, indexCount = 0,  l = 0; l < size; l++)
+      // for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++)
+
+      //for(int n = 0, i = 0, j = 0, count = 0, indexCount = 0; n < data_n_index;  n++)
+      //for(int l = 0; l < size; l++, count++)
+      
       for(int count = 0, indexCount = 0,  l = 0; l < size; l++)
       {
@@ -234,7 +272,7 @@
                 temp_j = (data_dim == 1) ? -1
                        : (*data_j_index)[n] + data_jbegin;
-            i = (data_dim == 1) ? (temp_i - 2) % ni
+            i = (data_dim == 1) ? (temp_i - 1) % ni
                                 : (temp_i - 1) ;
-            j = (data_dim == 1) ? (temp_i - 2) / ni
+            j = (data_dim == 1) ? (temp_i - 1) / ni
                                 : (temp_j - 1) ;
 
@@ -250,4 +288,21 @@
          }
       }
+
+
+//      if (this->storeIndex[0]->size() != 0)
+//         for (StdSize u = 0; u < this->storeIndex[0]->size(); u++)
+//            (*local_mask)[(*out_i_index[0])[u]][(*out_j_index[0])[u]] = 1;
+                                 
+//      std::cout << "indexCount" << indexCount << std::endl; 
+//      std::cout << this->getId() << " : "  << (*this->storeIndex[0]).num_elements() << std::endl;
+//      StdOFStream ofs2(("log_client_"+this->getId()).c_str());
+//      for (StdSize h = 0; h < storeIndex[0]->size(); h++)
+//      {
+//        ofs2 << "(" << (*storeIndex[0])[h]  << ";"
+//             << (*out_i_index[0])[h] << ","
+//             << (*out_j_index[0])[h] << ","
+//             << (*out_l_index[0])[h] << ")" << std::endl;
+//      }
+//      ofs2.close();   
    }
 
@@ -282,6 +337,18 @@
          (const ARRAY(double, 1) stored,  ARRAY(double, 3) field) const
    {
+      //std::cout <<"champ : " ;
       for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++)
+      {
          (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] = (*stored)[n] ;
+         /*if (storeIndex[0]->num_elements() == 31)
+         {
+            std::cout << "( " << (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] << ", "
+                      << (*out_i_index[0])[n] << ", "
+                      << (*out_j_index[0])[n] << ", "
+                      << (*out_l_index[0])[n] << ")";
+         }*/
+      }
+      //std::cout << std::endl;
+
    }
 
@@ -311,5 +378,6 @@
       (const double * const data, ARRAY(double, 1) stored) const
    {
-      const StdSize size = storeIndex[0]->num_elements() ;
+      const StdSize size = (this->storeIndex[0])->num_elements() ;
+//    std::cout << this->getId() << "> size : " << size << std::endl;
       stored->resize(boost::extents[size]) ;
       for(StdSize i = 0; i < size; i++)
@@ -365,9 +433,4 @@
    void CGrid::computeIndexServer(void)
    {
-      ARRAY(int, 1) storeIndex_srv   =  this->storeIndex[0];
-      ARRAY(int, 1) out_i_index_srv  =  this->out_i_index[0];
-      ARRAY(int, 1) out_j_index_srv  =  this->out_j_index[0];
-      ARRAY(int, 1) out_l_index_srv  =  this->out_l_index[0];
-
       ARRAY(int, 2) local_mask =  this->domain->getLocalMask();
       
@@ -375,8 +438,8 @@
       const std::vector<int> & jbegin = this->domain->getJBeginSub();
       
-      const int ibegin_srv = this->domain->ibegin.getValue();
-      const int jbegin_srv = this->domain->jbegin.getValue();
-      const int zoom_ni_srv   = this->domain->zoom_ni_loc.getValue();
-      const int zoom_nj_srv   = this->domain->zoom_nj_loc.getValue();
+      const int ibegin_srv  = this->domain->ibegin.getValue();
+      const int jbegin_srv  = this->domain->jbegin.getValue();
+      const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue();
+      const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue();
       
       const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue();
@@ -387,8 +450,8 @@
          dn += this->out_i_index[j]->size();
          
-      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]);
-      ARRAY_ASSIGN(out_l_index_srv, int, 1, [dn]);
+      ARRAY_CREATE(storeIndex_srv , int, 1, [dn]);
+      ARRAY_CREATE(out_i_index_srv, int, 1, [dn]);
+      ARRAY_CREATE(out_j_index_srv, int, 1, [dn]);
+      ARRAY_CREATE(out_l_index_srv, int, 1, [dn]);
       
       for (StdSize i = 0, dn = 0; i < ibegin.size(); i++)
@@ -404,5 +467,5 @@
          for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++)
          {
-            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn; // Faux mais inutile dans tous les cas.
+            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur.
             (*out_i_index_srv)[n] = (*out_i_index_cl)[m] 
                                   + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1);
@@ -438,13 +501,19 @@
             (*local_mask)[(*out_i_index_srv)[u]][(*out_j_index_srv)[u]] = 1;
 
-      //~ 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(("log_server_"+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();
+   
+      this->storeIndex [0] = storeIndex_srv ;
+      this->out_i_index[0] = out_i_index_srv;
+      this->out_j_index[0] = out_j_index_srv;
+      this->out_l_index[0] = out_l_index_srv;
+      
       this->storeIndex.resize(1);
       this->out_i_index.resize(1);
@@ -454,5 +523,4 @@
    }
    
-   //----------------------------------------------------------------
    
    void CGrid::inputFieldServer
Index: XMLIO_V2/dev/common/src/xmlio/node/grid.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/node/grid.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/node/grid.hpp	(revision 266)
@@ -68,6 +68,9 @@
 
          StdSize getDimension(void) const;
-         StdSize getSize(void) const;
-         std::vector<StdSize> getShape(void) const;
+         
+         StdSize getLocalSize(void) const;
+         StdSize getGlobalSize(void) const;
+         std::vector<StdSize> getLocalShape(void) const;
+         std::vector<StdSize> getGlobalShape(void) const;
 
          /// EntrÃ©es-sorties de champs ///
@@ -130,10 +133,10 @@
       void CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored) const
    {
-      if (this->getSize() != field->num_elements())
+      if (this->getGlobalSize() != field->num_elements())
          ERROR("CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored)",
-                << "[ Taille des donnÃ©es attendue = " << this->getSize()       << ", "
+                << "[ Taille des donnÃ©es attendue = " << this->getGlobalSize()       << ", "
                 << "Taille des donnÃ©es reÃ§ue = "      << field->num_elements() << " ] "
                 << "Le tableau de donnÃ©es n'a pas la bonne taille !") ;
-      this->storeField_arr(field.data(), stored) ;
+      this->storeField_arr(field->data(), stored) ;
    }
 
Index: XMLIO_V2/dev/common/src/xmlio/object_factory_impl.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/object_factory_impl.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/object_factory_impl.hpp	(revision 266)
@@ -53,5 +53,6 @@
       
       ERROR("CObjectFactory::GetObject(const U * const object)",
-               << "[type = " << U::GetName() << "]"
+               << "[type = " << U::GetName() << ", "
+               << "adress = " << object << "]"
                << " object was not found !");
       return (boost::shared_ptr<U>()); // jamais atteint
Index: XMLIO_V2/dev/common/src/xmlio/output/nc4_data_output.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/output/nc4_data_output.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/output/nc4_data_output.cpp	(revision 266)
@@ -1,2 +1,3 @@
+
 #include "nc4_data_output.hpp"
 
@@ -137,5 +138,5 @@
                   domain->data_jbegin.getValue()*/);
                   
-               SuperClassWriter::setDefaultValue(maskid, &dvm);
+               //SuperClassWriter::setDefaultValue(maskid, &dvm);
 
                SuperClassWriter::definition_end();
@@ -223,5 +224,5 @@
                              ? field->name.getValue() : field->getBaseFieldReference()->getId();
 
-         unsigned int ssize = domain->ni.getValue() * domain->nj.getValue();
+         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue();
          bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize);
 
@@ -380,14 +381,14 @@
          if (grid->hasAxis()) // 3D
          {
-            ARRAY(double, 3) field_data3D;            
+            ARRAY(double, 3) field_data3D (new CArray<double,3>(grid->getLocalShape()/*, boost::c_storage_order()*/));            
             grid->outputField(field_data, field_data3D);
-            SuperClassWriter::writeData(field_data3D, fieldid, true, 0);
+            SuperClassWriter::writeData(field_data3D, fieldid, true, field->getNStep()-1);
             
          }
          else // 2D
          {
-            ARRAY(double, 3) field_data2D;
+            ARRAY(double, 2) field_data2D (new CArray<double, 2>(grid->getLocalShape()/*, boost::c_storage_order()*/));
             grid->outputField(field_data,  field_data2D);
-            SuperClassWriter::writeData(field_data2D, fieldid, true, 0);
+            SuperClassWriter::writeData(field_data2D, fieldid, true, field->getNStep()-1);
          }
       }
Index: XMLIO_V2/dev/common/src/xmlio/output/onetcdf4.cpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/output/onetcdf4.cpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/output/onetcdf4.cpp	(revision 266)
@@ -142,4 +142,17 @@
       }
       
+      StdString CONetCDF4::getUnlimitedDimensionName(void)
+      {
+         char full_name_in[NC_MAX_NAME +1];
+         int grpid = this->getGroup(path);
+         int dimid = this->getUnlimitedDimension();
+                              
+         if (dimid == -1) return (std::string());
+            CheckError(nc_inq_dimname(grpid, dimid, full_name_in));
+                                          
+         StdString dimname(full_name_in);
+         return (dimname);
+      }
+      
       //---------------------------------------------------------------
       
@@ -166,4 +179,37 @@
          return (retvalue);
       }
+
+      std::vector<std::string> CONetCDF4::getDimensionsIdList (const std::string * _varname)
+      {
+         char full_name_in[NC_MAX_NAME +1];
+         int nbdim = 0, *dimid = NULL;
+         int grpid = this->getCurrentGroup();
+         int varid = (_varname != NULL) ? this->getVariable(*_varname) : NC_GLOBAL;
+         std::vector<std::string> retvalue;
+                                   
+         if (_varname != NULL)
+         {
+            CheckError(nc_inq_varndims(grpid, varid, &nbdim));
+            dimid = new int[nbdim]();
+            CheckError(nc_inq_vardimid(grpid, varid, dimid));
+         }
+         else
+         {
+            CheckError(nc_inq_dimids(grpid, &nbdim, NULL, 1));
+            dimid = new int[nbdim]();
+            CheckError(nc_inq_dimids(grpid, NULL, dimid, 1));
+         }
+                                        
+         for (int i = 0; i < nbdim; i++)
+         {
+            CheckError(nc_inq_dimname(grpid, dimid[i], full_name_in));
+            std::string dimname(full_name_in);
+            retvalue.push_back(dimname);
+         }
+         delete [] dimid;
+                                                                                                                                                      
+         return (retvalue);
+      }
+
 
       //---------------------------------------------------------------
@@ -271,44 +317,42 @@
                                         const std::vector<StdSize> * start,
                                         const std::vector<StdSize> * count)
-      {
-         std::vector<StdSize> sizes = this->getDimensions(name);       
-         std::vector<StdSize>::const_iterator
+      {   
+         std::vector<std::size_t> sizes  = this->getDimensions(name);
+         std::vector<std::string> iddims = this->getDimensionsIdList (&name);   
+         std::vector<std::size_t>::const_iterator
             it  = sizes.begin(), end = sizes.end();
          int i = 0;
+      
+         if (iddims.begin()->compare(this->getUnlimitedDimensionName()) == 0)
+         {
+            sstart.push_back(record);
+            scount.push_back(1); 
+            if ((start == NULL) &&
+                (count == NULL)) i++;
+            it++;
+         }
 
          for (;it != end; it++)
-         {
-            StdSize  s = *it;
+         {      
             if ((start != NULL) && (count != NULL))
             {
-               if (s == UNLIMITED_DIM)
-               {
-                  sstart.push_back(record);
-                  scount.push_back(1);
-               }
-               else
-               {
-                  sstart.push_back((*start)[i]);
-                  scount.push_back((*count)[i]);
-                  array_size *= (*count)[i];
-                  i++;
-               }
+               sstart.push_back((*start)[i]);
+               scount.push_back((*count)[i]);
+               array_size *= (*count)[i];
+               i++;
             }
             else
             {
-               if (s == UNLIMITED_DIM)
-               {
-                  sstart.push_back(record);
-                  scount.push_back(1);
-               }
-               else
-               {
-                  sstart.push_back(0);
-                  scount.push_back(sizes[i]);
-                  array_size *= sizes[i];
-               }
+               sstart.push_back(0);
+               scount.push_back(sizes[i]);
+               array_size *= sizes[i];
                i++;
             }
          }
+         
+         
+//         for (StdSize u = 0; u < sstart.size(); u++)
+//            std::cout << "(" << sstart[u] << "," << scount[u]  << ")" ;
+//         std::cout << std::endl;
       }
 
Index: XMLIO_V2/dev/common/src/xmlio/output/onetcdf4.hpp
===================================================================
--- XMLIO_V2/dev/common/src/xmlio/output/onetcdf4.hpp	(revision 255)
+++ XMLIO_V2/dev/common/src/xmlio/output/onetcdf4.hpp	(revision 266)
@@ -94,6 +94,8 @@
             int getVariable(const StdString & varname);
             int getDimension(const StdString & dimname);
-            std::vector<StdSize> getDimensions(const StdString & varname);
-            int getUnlimitedDimension(void);
+            std::vector<StdSize>   getDimensions       (const StdString & varname);
+            std::vector<StdString> getDimensionsIdList (const StdString * varname);
+            int       getUnlimitedDimension(void);
+            StdString getUnlimitedDimensionName(void);
 
             bool varExist(const StdString & varname);
@@ -144,4 +146,12 @@
          this->getWriteDataInfos
          (name, record, array_size,  sstart, scount, start, count);
+         if (data->num_elements() != array_size)
+         {
+            ERROR("CONetCDF4::writeData(...)",
+                  << "[ input array size = "  << data->num_elements()
+                  << ", intern array size = " << array_size
+                  << " ] Invalid input data !" );
+         }
+         
          this->writeData_(grpid, varid, sstart, scount, data->data());
       }
