1 | #ifndef __XMLIO_CDomain__ |
---|
2 | #define __XMLIO_CDomain__ |
---|
3 | |
---|
4 | /// xios headers /// |
---|
5 | #include "xmlioserver_spl.hpp" |
---|
6 | #include "group_factory.hpp" |
---|
7 | |
---|
8 | #include "declare_group.hpp" |
---|
9 | #include "declare_ref_func.hpp" |
---|
10 | #include "event_client.hpp" |
---|
11 | #include "event_server.hpp" |
---|
12 | #include "buffer_in.hpp" |
---|
13 | #include "array_new.hpp" |
---|
14 | #include "attribute_array.hpp" |
---|
15 | #include "attribute_enum.hpp" |
---|
16 | |
---|
17 | namespace xios { |
---|
18 | |
---|
19 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
20 | |
---|
21 | class CDomainGroup; |
---|
22 | class CDomainAttributes; |
---|
23 | class CDomain; |
---|
24 | |
---|
25 | ///-------------------------------------------------------------- |
---|
26 | |
---|
27 | // Declare/Define CDomainAttribute |
---|
28 | BEGIN_DECLARE_ATTRIBUTE_MAP(CDomain) |
---|
29 | # include "domain_attribute.conf" |
---|
30 | END_DECLARE_ATTRIBUTE_MAP(CDomain) |
---|
31 | |
---|
32 | ///-------------------------------------------------------------- |
---|
33 | |
---|
34 | class CDomain |
---|
35 | : public CObjectTemplate<CDomain> |
---|
36 | , public CDomainAttributes |
---|
37 | { |
---|
38 | enum EEventId |
---|
39 | { |
---|
40 | EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_LAT, EVENT_ID_LON |
---|
41 | } ; |
---|
42 | |
---|
43 | /// typedef /// |
---|
44 | typedef CObjectTemplate<CDomain> SuperClass; |
---|
45 | typedef CDomainAttributes SuperClassAttribute; |
---|
46 | |
---|
47 | public : |
---|
48 | |
---|
49 | typedef CDomainAttributes RelAttributes; |
---|
50 | typedef CDomainGroup RelGroup; |
---|
51 | |
---|
52 | /// Constructeurs /// |
---|
53 | CDomain(void); |
---|
54 | explicit CDomain(const StdString & id); |
---|
55 | CDomain(const CDomain & domain); // Not implemented yet. |
---|
56 | CDomain(const CDomain * const domain); // Not implemented yet. |
---|
57 | |
---|
58 | /// Vérifications /// |
---|
59 | void checkAttributes(void); |
---|
60 | |
---|
61 | void checkAttributesOnClient(); |
---|
62 | |
---|
63 | void sendCheckedAttributes(); |
---|
64 | |
---|
65 | private : |
---|
66 | |
---|
67 | void checkDomain(void); |
---|
68 | |
---|
69 | void checkLocalIDomain(void); |
---|
70 | void checkLocalJDomain(void); |
---|
71 | |
---|
72 | void checkMask(void); |
---|
73 | void checkDomainData(void); |
---|
74 | void checkCompression(void); |
---|
75 | |
---|
76 | void checkZoom(void); |
---|
77 | void checkBounds(void); |
---|
78 | |
---|
79 | |
---|
80 | public : |
---|
81 | |
---|
82 | /// Autres /// |
---|
83 | |
---|
84 | const std::set<StdString> & getRelFiles(void) const; |
---|
85 | |
---|
86 | |
---|
87 | /// Test /// |
---|
88 | bool IsWritten(const StdString & filename) const; |
---|
89 | bool hasZoom(void) const; |
---|
90 | bool isEmpty(void) const; |
---|
91 | |
---|
92 | |
---|
93 | int ni_client,ibegin_client,iend_client ; |
---|
94 | int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ; |
---|
95 | |
---|
96 | int nj_client,jbegin_client,jend_client ; |
---|
97 | int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ; |
---|
98 | |
---|
99 | int ni_srv,ibegin_srv,iend_srv ; |
---|
100 | int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ; |
---|
101 | |
---|
102 | int nj_srv,jbegin_srv,jend_srv ; |
---|
103 | int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ; |
---|
104 | |
---|
105 | CArray<double, 1> lonvalue_srv, latvalue_srv ; |
---|
106 | CArray<double, 2> bounds_lon_srv, bounds_lat_srv ; |
---|
107 | |
---|
108 | |
---|
109 | vector<int> connectedServer ; // list of connected server |
---|
110 | vector<int> nbSenders ; // for each communication with a server, number of communicating client |
---|
111 | vector<int> nbDataSrv ; // size of data to send to each server |
---|
112 | vector< vector<int> > i_indSrv ; // for each server, i global index to send |
---|
113 | vector< vector<int> > j_indSrv ; // for each server, j global index to send |
---|
114 | |
---|
115 | CArray<int,2> mapConnectedServer ; // (ni,nj) => mapped to connected server number, -1 if no server is target |
---|
116 | |
---|
117 | // vector<int> ib_srv, ie_srv, in_srv ; |
---|
118 | // vector<int> jb_srv, je_srv, jn_srv ; |
---|
119 | |
---|
120 | public : |
---|
121 | |
---|
122 | /// Mutateur /// |
---|
123 | void addRelFile(const StdString & filename); |
---|
124 | void completeLonLatClient(void); |
---|
125 | void sendServerAttribut(void) ; |
---|
126 | void sendLonLat(void) ; |
---|
127 | void computeConnectedServer(void) ; |
---|
128 | static bool dispatchEvent(CEventServer& event) ; |
---|
129 | static void recvLat(CEventServer& event) ; |
---|
130 | static void recvLon(CEventServer& event) ; |
---|
131 | static void recvServerAttribut(CEventServer& event) ; |
---|
132 | void recvLat(CBufferIn& buffer) ; |
---|
133 | void recvLon(CBufferIn& buffer) ; |
---|
134 | void recvServerAttribut(CBufferIn& buffer) ; |
---|
135 | |
---|
136 | /// Destructeur /// |
---|
137 | virtual ~CDomain(void); |
---|
138 | |
---|
139 | /// Accesseurs statiques /// |
---|
140 | static StdString GetName(void); |
---|
141 | static StdString GetDefName(void); |
---|
142 | |
---|
143 | static ENodeType GetType(void); |
---|
144 | |
---|
145 | CArray<int, 2> local_mask; |
---|
146 | bool isCurvilinear ; |
---|
147 | bool hasBounds ; |
---|
148 | private : |
---|
149 | |
---|
150 | /// Proriétés protégées /// |
---|
151 | bool isChecked; |
---|
152 | std::set<StdString> relFiles; |
---|
153 | bool isClientChecked; // Verify whether all attributes of domain on the client side is good |
---|
154 | |
---|
155 | DECLARE_REF_FUNC(Domain,domain) |
---|
156 | |
---|
157 | }; // class CDomain |
---|
158 | |
---|
159 | ///-------------------------------------------------------------- |
---|
160 | |
---|
161 | // Declare/Define CDomainGroup and CDomainDefinition |
---|
162 | DECLARE_GROUP(CDomain); |
---|
163 | |
---|
164 | ///-------------------------------------------------------------- |
---|
165 | |
---|
166 | } // namespace xios |
---|
167 | |
---|
168 | #endif // __XMLIO_CDomain__ |
---|