1 | // XmlIOServer |
---|
2 | #include "xmlioserver.hpp" |
---|
3 | |
---|
4 | #include "attribute_template_impl.hpp" |
---|
5 | #include "group_template_impl.hpp" |
---|
6 | |
---|
7 | #include "fake.hpp" |
---|
8 | |
---|
9 | // Point d'entrée du programme principal |
---|
10 | int main(int argc, char ** argv, char ** UNUSED(env)) |
---|
11 | { |
---|
12 | try |
---|
13 | { |
---|
14 | comm::CMPIManager::Initialise(&argc, &argv); // < seulement en mode connecté |
---|
15 | |
---|
16 | // Création d'un contexte |
---|
17 | boost::shared_ptr<CContext> contxt = CTreeManager::CreateContext("mon_context"); |
---|
18 | |
---|
19 | |
---|
20 | boost::shared_ptr<CGridGroup> grid_def = |
---|
21 | CObjectFactory::GetObject<CGridGroup>(StdString("grid_definition")); |
---|
22 | boost::shared_ptr<CAxisGroup> axis_def = |
---|
23 | CObjectFactory::GetObject<CAxisGroup>(StdString("axis_definition")); |
---|
24 | boost::shared_ptr<CDomainGroup> domain_def = |
---|
25 | CObjectFactory::GetObject<CDomainGroup>(StdString("domain_definition")); |
---|
26 | |
---|
27 | // Ajout d'une grille, d'un axe et d'un domaine. |
---|
28 | boost::shared_ptr<CGrid> grid = |
---|
29 | CGroupFactory::CreateChild(grid_def , StdString("ma_grille")); |
---|
30 | boost::shared_ptr<CAxis> axis = |
---|
31 | CGroupFactory::CreateChild(axis_def , StdString("mon_axe")); |
---|
32 | boost::shared_ptr<CDomain> domain = |
---|
33 | CGroupFactory::CreateChild(domain_def, StdString("mon_domaine")); |
---|
34 | |
---|
35 | boost::shared_ptr<CDomain> sdomain = |
---|
36 | CGroupFactory::CreateChild(domain_def, StdString("mon_super_domaine")); |
---|
37 | |
---|
38 | // Définition des attributs de la grille. |
---|
39 | grid->domain_ref.setValue(StdString("mon_domaine")); |
---|
40 | grid->axis_ref.setValue(StdString("mon_axe")); |
---|
41 | |
---|
42 | // Définition des attributs de l'axe. |
---|
43 | ARRAY_CREATE(zvalue, double, 1, [10]); |
---|
44 | |
---|
45 | axis->size.setValue(zvalue->num_elements()); |
---|
46 | axis->zvalue.setValue(zvalue); |
---|
47 | |
---|
48 | // Définition des attributs du domaine l'axe. |
---|
49 | ARRAY_CREATE(latvalue, double, 1, [200]); |
---|
50 | ARRAY_CREATE(lonvalue, double, 1, [200]); |
---|
51 | |
---|
52 | ARRAY_CREATE(mask, bool, 2, [20][10]); |
---|
53 | |
---|
54 | for (StdSize i = 0; i<mask->num_elements(); i++) |
---|
55 | (mask->data())[i] = i%2; |
---|
56 | |
---|
57 | domain->ni_glo.setValue(40); |
---|
58 | domain->nj_glo.setValue(40); |
---|
59 | |
---|
60 | domain->ibegin.setValue(1); |
---|
61 | domain->ni.setValue(20); |
---|
62 | domain->jbegin.setValue(1); |
---|
63 | domain->nj.setValue(10); |
---|
64 | |
---|
65 | domain->data_dim.setValue(2); |
---|
66 | |
---|
67 | domain->mask.setValue(mask); |
---|
68 | domain->lonvalue.setValue(lonvalue); |
---|
69 | domain->latvalue.setValue(latvalue); |
---|
70 | |
---|
71 | // Résolution |
---|
72 | grid->solveReference(); |
---|
73 | |
---|
74 | std::cout << grid->storeIndex << std::endl; |
---|
75 | std::cout << grid->out_i_index << std::endl; |
---|
76 | std::cout << grid->out_j_index << std::endl; |
---|
77 | std::cout << grid->out_l_index << std::endl; |
---|
78 | |
---|
79 | // Sortie de l'arborescence xml sous forme de fichier. |
---|
80 | CTreeManager::PrintTreeToFile("data/def/test.xml"); |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | /*CXIOSManager::Initialise(CXIOSManager::CLIENT, &argc, &argv); |
---|
100 | CXIOSManager::AddClient("nemo", |
---|
101 | CMPIManager::GetCommSize(CMPIManager::GetCommWorld()), |
---|
102 | CMPIManager::GetCommSize(CMPIManager::GetCommWorld()), |
---|
103 | &nemo_fake_entry); |
---|
104 | CXIOSManager::RunClient(); |
---|
105 | CXIOSManager::Finalize();*/ |
---|
106 | |
---|
107 | comm::CMPIManager::Finalize(); // < seulement en mode connecté |
---|
108 | |
---|
109 | //CXIOSManager::AddClient("orchidee", 1, 1, &orchidee_fake_entry); |
---|
110 | //CXIOSManager::AddClient("lmdz" , 2, 2, &lmdz_fake_entry); |
---|
111 | //CXIOSManager::RunClientServer(); |
---|
112 | |
---|
113 | } |
---|
114 | catch (CException & exc) |
---|
115 | { |
---|
116 | std::cerr << exc.getMessage() << std::endl; |
---|
117 | CMPIManager::Finalize(); |
---|
118 | return (EXIT_FAILURE); |
---|
119 | } |
---|
120 | return (EXIT_SUCCESS); |
---|
121 | } |
---|
122 | |
---|