[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() ; |
---|
[509] | 33 | context->timestep.setValue(dur.toString()); |
---|
| 34 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 35 | } |
---|
[335] | 36 | catch (xios::CException & exc) |
---|
[325] | 37 | { |
---|
| 38 | std::cerr << exc.getMessage() << std::endl; |
---|
| 39 | exit (EXIT_FAILURE); |
---|
| 40 | } |
---|
| 41 | } |
---|
[509] | 42 | |
---|
[325] | 43 | void cxios_update_calendar(int step) |
---|
| 44 | { |
---|
[347] | 45 | CTimer::get("XIOS").resume() ; |
---|
| 46 | xios::CContext* context = CContext::getCurrent() ; |
---|
[403] | 47 | if (!context->hasServer) context->client->checkBuffers() ; |
---|
[325] | 48 | context->updateCalendar(step) ; |
---|
| 49 | context->sendUpdateCalendar(step) ; |
---|
[347] | 50 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 51 | } |
---|
| 52 | |
---|
| 53 | } // extern "C" |
---|