1 | #ifndef __XIOS_CDomain__ |
---|
2 | #define __XIOS_CDomain__ |
---|
3 | |
---|
4 | /// XIOS headers /// |
---|
5 | #include "xios_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 | bool isDistributed(void) const; |
---|
92 | |
---|
93 | |
---|
94 | int ni_client,ibegin_client,iend_client ; |
---|
95 | int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ; |
---|
96 | |
---|
97 | int nj_client,jbegin_client,jend_client ; |
---|
98 | int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ; |
---|
99 | |
---|
100 | int ni_srv,ibegin_srv,iend_srv ; |
---|
101 | int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ; |
---|
102 | |
---|
103 | int nj_srv,jbegin_srv,jend_srv ; |
---|
104 | int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ; |
---|
105 | |
---|
106 | CArray<double, 1> lonvalue_srv, latvalue_srv ; |
---|
107 | CArray<double, 2> bounds_lon_srv, bounds_lat_srv ; |
---|
108 | |
---|
109 | |
---|
110 | vector<int> connectedServer ; // list of connected server |
---|
111 | vector<int> nbSenders ; // for each communication with a server, number of communicating client |
---|
112 | vector<int> nbDataSrv ; // size of data to send to each server |
---|
113 | vector< vector<int> > i_indSrv ; // for each server, i global index to send |
---|
114 | vector< vector<int> > j_indSrv ; // for each server, j global index to send |
---|
115 | |
---|
116 | |
---|
117 | CArray<int,2> mapConnectedServer ; // (ni,nj) => mapped to connected server number, -1 if no server is target |
---|
118 | |
---|
119 | |
---|
120 | // vector<int> ib_srv, ie_srv, in_srv ; |
---|
121 | // vector<int> jb_srv, je_srv, jn_srv ; |
---|
122 | |
---|
123 | public : |
---|
124 | |
---|
125 | /// Mutateur /// |
---|
126 | void addRelFile(const StdString & filename); |
---|
127 | void completeLonLatClient(void); |
---|
128 | void sendServerAttribut(void) ; |
---|
129 | void sendLonLat(void) ; |
---|
130 | void computeConnectedServer(void) ; |
---|
131 | static bool dispatchEvent(CEventServer& event) ; |
---|
132 | static void recvLat(CEventServer& event) ; |
---|
133 | static void recvLon(CEventServer& event) ; |
---|
134 | static void recvServerAttribut(CEventServer& event) ; |
---|
135 | void recvLat(CBufferIn& buffer) ; |
---|
136 | void recvLon(CBufferIn& buffer) ; |
---|
137 | void recvServerAttribut(CBufferIn& buffer) ; |
---|
138 | |
---|
139 | /// Destructeur /// |
---|
140 | virtual ~CDomain(void); |
---|
141 | |
---|
142 | /// Accesseurs statiques /// |
---|
143 | static StdString GetName(void); |
---|
144 | static StdString GetDefName(void); |
---|
145 | |
---|
146 | static ENodeType GetType(void); |
---|
147 | |
---|
148 | CArray<int, 2> local_mask; |
---|
149 | bool isCurvilinear ; |
---|
150 | bool hasBounds ; |
---|
151 | private : |
---|
152 | |
---|
153 | /// Proriétés protégées /// |
---|
154 | bool isChecked; |
---|
155 | std::set<StdString> relFiles; |
---|
156 | bool isClientChecked; // Verify whether all attributes of domain on the client side are good |
---|
157 | std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server |
---|
158 | std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server |
---|
159 | std::vector<int> connectedServerRank_; |
---|
160 | bool isDistributed_; |
---|
161 | |
---|
162 | DECLARE_REF_FUNC(Domain,domain) |
---|
163 | |
---|
164 | }; // class CDomain |
---|
165 | |
---|
166 | ///-------------------------------------------------------------- |
---|
167 | |
---|
168 | // Declare/Define CDomainGroup and CDomainDefinition |
---|
169 | DECLARE_GROUP(CDomain); |
---|
170 | |
---|
171 | ///-------------------------------------------------------------- |
---|
172 | |
---|
173 | } // namespace xios |
---|
174 | |
---|
175 | #endif // __XIOS_CDomain__ |
---|