Index: XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp	(revision 137)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp	(revision 138)
@@ -44,13 +44,13 @@
 void xios_xml_parse_file(const XString _filename, XSize _filename_len)
 {
-   MAKE_STRING(__filename, _filename, _filename_len);
-   std::ifstream __istr( __filename.c_str() , std::ifstream::in );
-
-   // On commence la lecture du flux de donnÃ©e xml.
-   XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName());
-   // On parse le fichier xml noeud par noeud
-   // (ie on construit dynamiquement notre arbre d'objets).
-   XMLParser::Parse(node);
-
+
+      MAKE_STRING(__filename, _filename, _filename_len);
+      std::ifstream __istr( __filename.c_str() , std::ifstream::in );
+
+      // On commence la lecture du flux de donnÃ©e xml.
+      XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName());
+      // On parse le fichier xml noeud par noeud
+      // (ie on construit dynamiquement notre arbre d'objets).
+      XMLParser::Parse(node);
 }
 
@@ -76,5 +76,7 @@
 
 void xios_context_create (XPtr * _ctx, const XString _ctx_id,
-                          XSize _ctx_id_len, XCalendarType _calType)
+                          XSize _ctx_id_len, XCalendarType _calType,
+                          XInt yr, XInt mth, XInt dd,
+                          XInt hr, XInt min, XInt sec)
 {
    MAKE_STRING(__ctx_id, _ctx_id, _ctx_id_len);
@@ -92,13 +94,18 @@
    {
       case (D360) :
-         context->setCalendar(new D360Calendar());      return;
+         context->setCalendar(new D360Calendar(yr, mth, dd, hr, min, sec));
+         return;
       case (ALLLEAP) :
-         context->setCalendar(new AllLeapCalendar());   return;
+         context->setCalendar(new AllLeapCalendar(yr, mth, dd, hr, min, sec));
+         return;
       case (NOLEAP) :
-         context->setCalendar(new NoLeapCalendar());    return;
+         context->setCalendar(new NoLeapCalendar(yr, mth, dd, hr, min, sec));
+         return;
       case (JULIAN) :
-         context->setCalendar(new JulianCalendar());    return;
+         context->setCalendar(new JulianCalendar(yr, mth, dd, hr, min, sec));
+         return;
       case (GREGORIAN) :
-         context->setCalendar(new GregorianCalendar()); return;
+         context->setCalendar(new GregorianCalendar(yr, mth, dd, hr, min, sec));
+         return;
       default:
          std::cerr << "[context_create] Type de calendrier invalide [0-5]" << std::endl;
@@ -149,5 +156,6 @@
          CFile * _file = (CFile *) _parent;
          FieldGroup * _field_group = _file->createVirtualFieldGroup(_file->getId());
-         xios_xml_tree_add (_field_group, GFIELD, _child, _child_type, _child_id, _child_id_len);
+         xios_xml_tree_add (_field_group, GFIELD,
+                            _child, _child_type, _child_id, _child_id_len);
          return;
       }
@@ -279,5 +287,6 @@
 XML_SET_STRING(Axis, axis, unit, unit)
 
-void xios_xml_set_axis_value(XPtr const _axis, XDType _dtype, double value[], XSize value_size)
+void xios_xml_set_axis_value(XPtr const _axis, XDType _dtype,
+                             double value[], XSize value_size)
 {
    Array<double, 1> __arr(value, shape(value_size), neverDeleteData, FortranArray<1>());
@@ -312,5 +321,6 @@
 XML_SET(Domain, domain, int, nj, nj)
 
-void xios_xml_set_domain_mask(XPtr const _domain, XDType _dtype, bool * _mask , XSize _maskXsize, XSize _maskYsize)
+void xios_xml_set_domain_mask(XPtr const _domain, XDType _dtype, bool * _mask ,
+                              XSize _maskXsize, XSize _maskYsize)
 {
    Array<bool, 2> __arr(_mask, shape(_maskXsize, _maskYsize), neverDeleteData, FortranArray<2>());
@@ -336,5 +346,6 @@
 XML_SET(Domain, domain, int, dnindex, data_n_index)
 
-void xios_xml_set_domain_diindex(XPtr const _domain, XDType _dtype, int _diindex[], XSize _diindex_size)
+void xios_xml_set_domain_diindex(XPtr const _domain, XDType _dtype,
+                                 int _diindex[], XSize _diindex_size)
 {
    Array<int, 1> __arr(_diindex, shape(_diindex_size), neverDeleteData, FortranArray<1>());
@@ -351,5 +362,6 @@
 }
 
-void xios_xml_set_domain_djindex(XPtr const _domain, XDType _dtype, int _djindex[], XSize _djindex_size)
+void xios_xml_set_domain_djindex(XPtr const _domain, XDType _dtype,
+                                 int _djindex[], XSize _djindex_size)
 {
    Array<int, 1> __arr(_djindex, shape(_djindex_size), neverDeleteData, FortranArray<1>());
@@ -366,5 +378,6 @@
 }
 
-void xios_xml_set_domain_lonvalue(XPtr const _domain, XDType _dtype, double _lonvalue[], XSize _lonvalue_Xsize, XSize _lonvalue_Ysize)
+void xios_xml_set_domain_lonvalue(XPtr const _domain, XDType _dtype, double _lonvalue[],
+                                  XSize _lonvalue_Xsize, XSize _lonvalue_Ysize)
 {
    XSize __size = (_lonvalue_Ysize == -1)
@@ -383,5 +396,6 @@
 }
 
-void xios_xml_set_domain_latvalue(XPtr const _domain, XDType _dtype, double _latvalue[], XSize _latvalue_Xsize, XSize _latvalue_Ysize)
+void xios_xml_set_domain_latvalue(XPtr const _domain, XDType _dtype, double _latvalue[],
+                                  XSize _latvalue_Xsize, XSize _latvalue_Ysize)
 {
    XSize __size = (_latvalue_Ysize == -1)
@@ -428,5 +442,88 @@
          called = true;
       }
-   }
+      switch(filetype)
+      {
+         case (NETCDF4):
+            __dtrt->createDataOutput<NetCDF4DataOutput>();
+            return;
+         // Autres formats de fichiers si disponibles...
+         default:
+            return;
+      }
+   }
+}
+
+void xios_dtreatment_end(void)
+{
+
+
+}
+
+void xios_write_data(const XString _field_id, XSize _field_id_len, double * data_k8,
+                     XSize data_Xsize, XSize data_Ysize, XSize data_Zsize)
+{
+   MAKE_STRING(__field_id, _field_id, _field_id_len);
+
+   Context          * const __ctxt = Context::GetCurrentContext();
+   DataTreatment    * __dtrt = __ctxt->getDataTreatment();
+   AbstractCalendar * __cald = __ctxt->getCalendar();
+   if (__dtrt != NULL)
+   {
+      std::cout << "> ItÃ©ration de calcul effectuÃ©e Ã   la date t = " << __cald->getCurrentDate()
+                << " (soit aprÃšs " << (Time)__cald->getCurrentDate() << " sec.)." << std::endl;
+      std::cout << __field_id << " : "
+                << data_Xsize << " : "
+                << data_Ysize << " : "
+                << data_Zsize << std::endl;
+      if ((data_Zsize == -1) && (data_Ysize == -1))
+      { // cas 1D
+         Array<double, 1> __arr(data_k8, shape(data_Xsize),
+                                neverDeleteData, FortranArray<1>());
+         __dtrt->writeData<Array<double, 1> >(__field_id, __arr);
+      }
+      else if (data_Zsize == -1)
+      { // cas 2D
+         Array<double, 2> __arr(data_k8, shape(data_Xsize, data_Ysize),
+                                neverDeleteData, FortranArray<2>());
+         __dtrt->writeData<Array<double, 2> >(__field_id, __arr);
+      }
+      else
+      { // cas 3D
+         Array<double, 3> __arr(data_k8, shape(data_Xsize, data_Ysize, data_Zsize),
+                                neverDeleteData, FortranArray<3>());
+         __dtrt->writeData<Array<double, 3> >(__field_id, __arr);
+      }
+   }
+}
+
+/* ********************************************************** */
+/*                      CALENDAR INTERFACE                    */
+/* ********************************************************** */
+
+void xios_update_calendar(int step)
+{
+   Context * current = Context::GetCurrentContext();
+   AbstractCalendar * calendar =  current->getCalendar();
+   if (current->getDataTreatment() == NULL)
+   {
+      std::cerr << "Error : Le traitement n'a pas Ã©tÃ© effectuÃ©" << std::endl;
+      return;
+   }
+   calendar->update();
+}
+
+void xios_set_timestep(double ts_year, double ts_month, double ts_day,
+                       double ts_hour, double ts_minute, double ts_second)
+{
+   Context * current = Context::GetCurrentContext();
+   AbstractCalendar * calendar =  current->getCalendar();
+   struct _duration dr = { ts_year, ts_month , ts_day,
+                           ts_hour, ts_minute, ts_second };
+   if (current->getDataTreatment() == NULL)
+   {
+      std::cerr << "Error : Le traitement n'a pas Ã©tÃ© effectuÃ©" << std::endl;
+      return;
+   }
+   calendar->setTimeStep(dr);
 }
 
