[325] | 1 | /* ************************************************************************** * |
---|
[335] | 2 | * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * |
---|
[325] | 3 | * ************************************************************************** */ |
---|
| 4 | |
---|
| 5 | #include <boost/multi_array.hpp> |
---|
| 6 | #include <boost/shared_ptr.hpp> |
---|
| 7 | |
---|
| 8 | #include "xmlioserver.hpp" |
---|
| 9 | |
---|
[352] | 10 | #include "attribute_template.hpp" |
---|
| 11 | #include "object_template.hpp" |
---|
| 12 | #include "group_template.hpp" |
---|
[325] | 13 | |
---|
| 14 | #include "calendar_type.hpp" |
---|
| 15 | |
---|
| 16 | #include "icutil.hpp" |
---|
[347] | 17 | #include "timer.hpp" |
---|
[352] | 18 | #include "context.hpp" |
---|
[403] | 19 | #include "context_client.hpp" |
---|
[325] | 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 | { |
---|
[347] | 30 | CTimer::get("XIOS").resume() ; |
---|
[448] | 31 | CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second, 0}; |
---|
[347] | 32 | xios::CContext* context = CContext::getCurrent() ; |
---|
[325] | 33 | |
---|
| 34 | context->timestep.setValue(dur.toString()); |
---|
| 35 | context->sendAttributToServer("timestep") ; |
---|
[347] | 36 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 37 | } |
---|
[335] | 38 | catch (xios::CException & exc) |
---|
[325] | 39 | { |
---|
| 40 | std::cerr << exc.getMessage() << std::endl; |
---|
| 41 | exit (EXIT_FAILURE); |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | void cxios_update_calendar(int step) |
---|
| 46 | { |
---|
[347] | 47 | CTimer::get("XIOS").resume() ; |
---|
| 48 | xios::CContext* context = CContext::getCurrent() ; |
---|
[403] | 49 | if (!context->hasServer) context->client->checkBuffers() ; |
---|
[325] | 50 | context->updateCalendar(step) ; |
---|
| 51 | context->sendUpdateCalendar(step) ; |
---|
[347] | 52 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 53 | |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | } // extern "C" |
---|