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 | |
---|
21 | extern "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, 0}; |
---|
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" |
---|