1 | // XmlIOServer |
---|
2 | #include "xmlioserver.hpp" |
---|
3 | |
---|
4 | #include "attribute_template_impl.hpp" |
---|
5 | #include "group_template_impl.hpp" |
---|
6 | |
---|
7 | #include "client.hpp" |
---|
8 | #include "server.hpp" |
---|
9 | extern "C" |
---|
10 | { |
---|
11 | void xios_dtreatment_start(tree::CContext * context_hdl, int filetype, int comm_client_server, int comm_server); |
---|
12 | void xios_set_timestep(double ts_year, double ts_month, double ts_day, |
---|
13 | double ts_hour, double ts_minute, double ts_second); |
---|
14 | void xios_write_data_k83(const char * fieldid, int fieldid_size, double * data_k8, int data_Xsize, int data_Ysize, int data_Zsize); |
---|
15 | void xios_update_calendar(int step); |
---|
16 | } |
---|
17 | // Point d'entrée du programme principal |
---|
18 | |
---|
19 | int main (int argc, char ** argv, char ** UNUSED (env)) |
---|
20 | { |
---|
21 | try |
---|
22 | { |
---|
23 | MPIComm comm_client, comm_client_server, comm_server; |
---|
24 | CXIOSManager::Initialise (CXIOSManager::CLIENT_SERVER, &argc, &argv); |
---|
25 | if (CMPIManager::GetCommRank() == 0) |
---|
26 | { |
---|
27 | |
---|
28 | CMPIManager ::DispatchClient(true, comm_client, comm_client_server, comm_server); |
---|
29 | CXIOSManager::RunServer("Nemo", comm_client_server, comm_server); |
---|
30 | CServer::CreateServer(comm_client_server)->run(); |
---|
31 | } |
---|
32 | else |
---|
33 | { |
---|
34 | ARRAY_CREATE(data, double, 3, [20][30][20]); |
---|
35 | |
---|
36 | CMPIManager ::DispatchClient(false, comm_client, comm_client_server, comm_server); |
---|
37 | CTreeManager::ParseFile("iodef.xml"); |
---|
38 | CTreeManager::SetCurrentContextId("context1"); |
---|
39 | boost::shared_ptr<CContext> context = |
---|
40 | CObjectFactory::GetObject<CContext>("context1"); |
---|
41 | xios_set_timestep(0, 0, 0, 1, 0, 0); |
---|
42 | xios_dtreatment_start(context.get(), 0, comm_client_server, -1); |
---|
43 | |
---|
44 | for (int i = 0; i < 200; i++) |
---|
45 | { |
---|
46 | xios_update_calendar(i); |
---|
47 | for (int i = 0, l=0; i < 20; i++) |
---|
48 | for (int j = 0; j < 30; j++) |
---|
49 | for (int k = 0; k < 20; k++, l++) |
---|
50 | (*data)[i][j][k] = l*10+i; |
---|
51 | xios_write_data_k83("champ1", 6, data->data(), 20, 30, 20); |
---|
52 | } |
---|
53 | CClient::GetClient()->finalize(); |
---|
54 | } |
---|
55 | CXIOSManager::Finalize (); |
---|
56 | |
---|
57 | } |
---|
58 | catch (CException & exc) |
---|
59 | { |
---|
60 | std::cerr << exc.getMessage () << std::endl; |
---|
61 | CMPIManager::Finalize (); |
---|
62 | return (EXIT_FAILURE); |
---|
63 | } |
---|
64 | return (EXIT_SUCCESS); |
---|
65 | } |
---|
66 | |
---|