source: XIOS/trunk/src/interface/c/icdate.cpp @ 352

Last change on this file since 352 was 352, checked in by ymipsl, 10 years ago
  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6#include <boost/shared_ptr.hpp>
7
8#include "xmlioserver.hpp"
9
10#include "attribute_template.hpp"
11#include "object_template.hpp"
12#include "group_template.hpp"
13
14#include "calendar_type.hpp"
15
16#include "icutil.hpp"
17#include "timer.hpp"
18#include "context.hpp"
19
20extern "C"
21{
22// /////////////////////////////// Définitions ////////////////////////////// //
23
24   void cxios_set_timestep(double ts_year, double ts_month,  double ts_day,
25                          double ts_hour, double ts_minute, double ts_second)
26   {
27      try
28      {
29         CTimer::get("XIOS").resume() ;
30         CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second};
31         xios::CContext* context = CContext::getCurrent() ;
32         
33            context->timestep.setValue(dur.toString());
34            context->sendAttributToServer("timestep") ;
35          CTimer::get("XIOS").suspend() ;
36      }
37      catch (xios::CException & exc)
38      {
39         std::cerr << exc.getMessage() << std::endl;
40         exit (EXIT_FAILURE);
41      }
42   }
43   
44   void cxios_update_calendar(int step)
45   {
46      CTimer::get("XIOS").resume() ;
47      xios::CContext* context = CContext::getCurrent() ;
48      context->updateCalendar(step) ;
49      context->sendUpdateCalendar(step) ;
50      CTimer::get("XIOS").suspend() ;
51     
52   }
53
54} // extern "C"
Note: See TracBrowser for help on using the repository browser.