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

Last change on this file since 403 was 403, checked in by ymipsl, 9 years ago

Give the hand at each time step to the mpi library for better asynchronism

YM

  • Property svn:eol-style set to native
File size: 1.6 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#include "context_client.hpp"
20
21extern "C"
22{
23// /////////////////////////////// Définitions ////////////////////////////// //
24
25   void cxios_set_timestep(double ts_year, double ts_month,  double ts_day,
26                          double ts_hour, double ts_minute, double ts_second)
27   {
28      try
29      {
30         CTimer::get("XIOS").resume() ;
31         CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second};
32         xios::CContext* context = CContext::getCurrent() ;
33         
34            context->timestep.setValue(dur.toString());
35            context->sendAttributToServer("timestep") ;
36          CTimer::get("XIOS").suspend() ;
37      }
38      catch (xios::CException & exc)
39      {
40         std::cerr << exc.getMessage() << std::endl;
41         exit (EXIT_FAILURE);
42      }
43   }
44   
45   void cxios_update_calendar(int step)
46   {
47      CTimer::get("XIOS").resume() ;
48      xios::CContext* context = CContext::getCurrent() ;
49      if (!context->hasServer) context->client->checkBuffers() ;
50      context->updateCalendar(step) ;
51      context->sendUpdateCalendar(step) ;
52      CTimer::get("XIOS").suspend() ;
53     
54   }
55
56} // extern "C"
Note: See TracBrowser for help on using the repository browser.