[591] | 1 | #ifndef __XIOS_CDomain__ |
---|
| 2 | #define __XIOS_CDomain__ |
---|
[219] | 3 | |
---|
[591] | 4 | /// XIOS headers /// |
---|
| 5 | #include "xios_spl.hpp" |
---|
[219] | 6 | #include "group_factory.hpp" |
---|
| 7 | |
---|
| 8 | #include "declare_group.hpp" |
---|
[540] | 9 | #include "declare_ref_func.hpp" |
---|
[300] | 10 | #include "event_client.hpp" |
---|
| 11 | #include "event_server.hpp" |
---|
| 12 | #include "buffer_in.hpp" |
---|
[369] | 13 | #include "array_new.hpp" |
---|
| 14 | #include "attribute_array.hpp" |
---|
[449] | 15 | #include "attribute_enum.hpp" |
---|
[219] | 16 | |
---|
[335] | 17 | namespace xios { |
---|
[509] | 18 | |
---|
[219] | 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 | { |
---|
[300] | 38 | enum EEventId |
---|
| 39 | { |
---|
[518] | 40 | EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_LAT, EVENT_ID_LON |
---|
[300] | 41 | } ; |
---|
[509] | 42 | |
---|
[219] | 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 | |
---|
[509] | 61 | void checkAttributesOnClient(); |
---|
| 62 | |
---|
| 63 | void sendCheckedAttributes(); |
---|
| 64 | |
---|
[219] | 65 | private : |
---|
| 66 | |
---|
[467] | 67 | void checkDomain(void); |
---|
[219] | 68 | |
---|
| 69 | void checkLocalIDomain(void); |
---|
| 70 | void checkLocalJDomain(void); |
---|
| 71 | |
---|
| 72 | void checkMask(void); |
---|
| 73 | void checkDomainData(void); |
---|
| 74 | void checkCompression(void); |
---|
[509] | 75 | |
---|
[219] | 76 | void checkZoom(void); |
---|
[449] | 77 | void checkBounds(void); |
---|
[219] | 78 | |
---|
| 79 | |
---|
| 80 | public : |
---|
[509] | 81 | |
---|
[219] | 82 | /// Autres /// |
---|
| 83 | |
---|
| 84 | const std::set<StdString> & getRelFiles(void) const; |
---|
| 85 | |
---|
[274] | 86 | |
---|
[219] | 87 | /// Test /// |
---|
| 88 | bool IsWritten(const StdString & filename) const; |
---|
| 89 | bool hasZoom(void) const; |
---|
| 90 | bool isEmpty(void) const; |
---|
[509] | 91 | |
---|
| 92 | |
---|
[300] | 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 | |
---|
[369] | 105 | CArray<double, 1> lonvalue_srv, latvalue_srv ; |
---|
[449] | 106 | CArray<double, 2> bounds_lon_srv, bounds_lat_srv ; |
---|
[509] | 107 | |
---|
| 108 | |
---|
| 109 | vector<int> connectedServer ; // list of connected server |
---|
[467] | 110 | vector<int> nbSenders ; // for each communication with a server, number of communicating client |
---|
[509] | 111 | vector<int> nbDataSrv ; // size of data to send to each server |
---|
[467] | 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 |
---|
[509] | 114 | |
---|
[553] | 115 | |
---|
[467] | 116 | CArray<int,2> mapConnectedServer ; // (ni,nj) => mapped to connected server number, -1 if no server is target |
---|
[509] | 117 | |
---|
[553] | 118 | |
---|
[467] | 119 | // vector<int> ib_srv, ie_srv, in_srv ; |
---|
| 120 | // vector<int> jb_srv, je_srv, jn_srv ; |
---|
[509] | 121 | |
---|
[219] | 122 | public : |
---|
[509] | 123 | |
---|
[219] | 124 | /// Mutateur /// |
---|
| 125 | void addRelFile(const StdString & filename); |
---|
[266] | 126 | void completeLonLatClient(void); |
---|
[300] | 127 | void sendServerAttribut(void) ; |
---|
| 128 | void sendLonLat(void) ; |
---|
| 129 | void computeConnectedServer(void) ; |
---|
| 130 | static bool dispatchEvent(CEventServer& event) ; |
---|
[518] | 131 | static void recvLat(CEventServer& event) ; |
---|
| 132 | static void recvLon(CEventServer& event) ; |
---|
[300] | 133 | static void recvServerAttribut(CEventServer& event) ; |
---|
[518] | 134 | void recvLat(CBufferIn& buffer) ; |
---|
| 135 | void recvLon(CBufferIn& buffer) ; |
---|
[300] | 136 | void recvServerAttribut(CBufferIn& buffer) ; |
---|
[509] | 137 | |
---|
[219] | 138 | /// Destructeur /// |
---|
| 139 | virtual ~CDomain(void); |
---|
| 140 | |
---|
| 141 | /// Accesseurs statiques /// |
---|
| 142 | static StdString GetName(void); |
---|
| 143 | static StdString GetDefName(void); |
---|
[509] | 144 | |
---|
[219] | 145 | static ENodeType GetType(void); |
---|
| 146 | |
---|
[369] | 147 | CArray<int, 2> local_mask; |
---|
[384] | 148 | bool isCurvilinear ; |
---|
[449] | 149 | bool hasBounds ; |
---|
[219] | 150 | private : |
---|
| 151 | |
---|
| 152 | /// Proriétés protégées /// |
---|
| 153 | bool isChecked; |
---|
| 154 | std::set<StdString> relFiles; |
---|
[551] | 155 | bool isClientChecked; // Verify whether all attributes of domain on the client side are good |
---|
[553] | 156 | std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server |
---|
| 157 | std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server |
---|
[584] | 158 | std::vector<int> connectedServerRank_; |
---|
[219] | 159 | |
---|
[540] | 160 | DECLARE_REF_FUNC(Domain,domain) |
---|
| 161 | |
---|
[219] | 162 | }; // class CDomain |
---|
| 163 | |
---|
| 164 | ///-------------------------------------------------------------- |
---|
| 165 | |
---|
| 166 | // Declare/Define CDomainGroup and CDomainDefinition |
---|
| 167 | DECLARE_GROUP(CDomain); |
---|
| 168 | |
---|
| 169 | ///-------------------------------------------------------------- |
---|
| 170 | |
---|
[335] | 171 | } // namespace xios |
---|
[219] | 172 | |
---|
[591] | 173 | #endif // __XIOS_CDomain__ |
---|