[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" |
---|
[631] | 16 | #include "transformation.hpp" |
---|
| 17 | #include "transformation_enum.hpp" |
---|
[219] | 18 | |
---|
[335] | 19 | namespace xios { |
---|
[509] | 20 | |
---|
[219] | 21 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 22 | |
---|
| 23 | class CDomainGroup; |
---|
| 24 | class CDomainAttributes; |
---|
| 25 | class CDomain; |
---|
| 26 | |
---|
| 27 | ///-------------------------------------------------------------- |
---|
| 28 | |
---|
| 29 | // Declare/Define CDomainAttribute |
---|
| 30 | BEGIN_DECLARE_ATTRIBUTE_MAP(CDomain) |
---|
| 31 | # include "domain_attribute.conf" |
---|
[775] | 32 | # include "domain_attribute_private.conf" |
---|
[219] | 33 | END_DECLARE_ATTRIBUTE_MAP(CDomain) |
---|
| 34 | |
---|
| 35 | ///-------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | class CDomain |
---|
| 38 | : public CObjectTemplate<CDomain> |
---|
| 39 | , public CDomainAttributes |
---|
| 40 | { |
---|
[300] | 41 | enum EEventId |
---|
| 42 | { |
---|
[611] | 43 | EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT, EVENT_ID_AREA |
---|
[300] | 44 | } ; |
---|
[509] | 45 | |
---|
[219] | 46 | /// typedef /// |
---|
| 47 | typedef CObjectTemplate<CDomain> SuperClass; |
---|
| 48 | typedef CDomainAttributes SuperClassAttribute; |
---|
| 49 | |
---|
[676] | 50 | public: |
---|
[219] | 51 | |
---|
| 52 | typedef CDomainAttributes RelAttributes; |
---|
| 53 | typedef CDomainGroup RelGroup; |
---|
[631] | 54 | typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes; |
---|
[219] | 55 | |
---|
| 56 | /// Constructeurs /// |
---|
| 57 | CDomain(void); |
---|
| 58 | explicit CDomain(const StdString & id); |
---|
| 59 | CDomain(const CDomain & domain); // Not implemented yet. |
---|
| 60 | CDomain(const CDomain * const domain); // Not implemented yet. |
---|
| 61 | |
---|
[622] | 62 | static CDomain* createDomain(); |
---|
| 63 | void duplicateAttributes(CDomain* domain); |
---|
| 64 | |
---|
[631] | 65 | virtual void parse(xml::CXMLNode & node); |
---|
| 66 | |
---|
[219] | 67 | /// Vérifications /// |
---|
| 68 | void checkAttributes(void); |
---|
| 69 | |
---|
[509] | 70 | void checkAttributesOnClient(); |
---|
[657] | 71 | void checkAttributesOnClientAfterTransformation(); |
---|
[509] | 72 | |
---|
[676] | 73 | void checkEligibilityForCompressedOutput(void); |
---|
| 74 | |
---|
[509] | 75 | void sendCheckedAttributes(); |
---|
| 76 | |
---|
[631] | 77 | bool hasTransformation(); |
---|
| 78 | void solveInheritanceTransformation(); |
---|
[687] | 79 | void solveSrcInheritance(); |
---|
| 80 | CDomain* getDomainSrc(); |
---|
[631] | 81 | TransMapTypes getAllTransformations(); |
---|
[687] | 82 | void redistribute(int nbLocalDomain); |
---|
[631] | 83 | |
---|
[676] | 84 | public: |
---|
[219] | 85 | const std::set<StdString> & getRelFiles(void) const; |
---|
| 86 | bool IsWritten(const StdString & filename) const; |
---|
[676] | 87 | bool isWrittenCompressed(const StdString& filename) const; |
---|
| 88 | |
---|
| 89 | const std::vector<int>& getIndexesToWrite(void) const; |
---|
| 90 | int getNumberWrittenIndexes() const; |
---|
| 91 | int getTotalNumberWrittenIndexes() const; |
---|
| 92 | int getOffsetWrittenIndexes() const; |
---|
| 93 | |
---|
[731] | 94 | std::map<int, StdSize> getAttributesBufferSize(); |
---|
| 95 | |
---|
[219] | 96 | bool isEmpty(void) const; |
---|
[594] | 97 | bool isDistributed(void) const; |
---|
[676] | 98 | bool isCompressible(void) const; |
---|
[509] | 99 | |
---|
[667] | 100 | int global_zoom_ibegin, global_zoom_ni; |
---|
| 101 | int global_zoom_jbegin, global_zoom_nj; |
---|
[300] | 102 | |
---|
| 103 | int ni_srv,ibegin_srv,iend_srv ; |
---|
| 104 | int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ; |
---|
| 105 | |
---|
| 106 | int nj_srv,jbegin_srv,jend_srv ; |
---|
| 107 | int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ; |
---|
| 108 | |
---|
[369] | 109 | CArray<double, 1> lonvalue_srv, latvalue_srv ; |
---|
[449] | 110 | CArray<double, 2> bounds_lon_srv, bounds_lat_srv ; |
---|
[664] | 111 | CArray<double, 1> lonvalue_client, latvalue_client; |
---|
| 112 | CArray<double, 2> bounds_lon_client, bounds_lat_client; |
---|
[611] | 113 | CArray<double, 1> area_srv; |
---|
[509] | 114 | |
---|
| 115 | vector<int> connectedServer ; // list of connected server |
---|
[467] | 116 | vector<int> nbSenders ; // for each communication with a server, number of communicating client |
---|
[509] | 117 | vector<int> nbDataSrv ; // size of data to send to each server |
---|
[467] | 118 | vector< vector<int> > i_indSrv ; // for each server, i global index to send |
---|
| 119 | vector< vector<int> > j_indSrv ; // for each server, j global index to send |
---|
[509] | 120 | |
---|
[676] | 121 | public: |
---|
[219] | 122 | /// Mutateur /// |
---|
| 123 | void addRelFile(const StdString & filename); |
---|
[676] | 124 | void addRelFileCompressed(const StdString& filename); |
---|
[266] | 125 | void completeLonLatClient(void); |
---|
[300] | 126 | void sendServerAttribut(void) ; |
---|
[611] | 127 | void sendLonLatArea(void); |
---|
[300] | 128 | void computeConnectedServer(void) ; |
---|
[743] | 129 | void fillInRectilinearBoundLonLat(CArray<double,2>& boundsLon, CArray<double,2>& boundsLat, |
---|
| 130 | bool isNorthPole = false, bool isSouthPole = false); |
---|
[775] | 131 | void fillInRectilinearLonLat(); |
---|
[611] | 132 | |
---|
[610] | 133 | static bool dispatchEvent(CEventServer& event); |
---|
| 134 | static void recvServerAttribut(CEventServer& event); |
---|
| 135 | static void recvIndex(CEventServer& event); |
---|
| 136 | static void recvLon(CEventServer& event); |
---|
| 137 | static void recvLat(CEventServer& event); |
---|
[611] | 138 | static void recvArea(CEventServer& event); |
---|
[610] | 139 | void recvServerAttribut(CBufferIn& buffer); |
---|
| 140 | void recvIndex(int rank, CBufferIn& buffer); |
---|
| 141 | void recvLon(int rank, CBufferIn& buffer); |
---|
| 142 | void recvLat(int rank, CBufferIn& buffer); |
---|
[611] | 143 | void recvArea(int rank, CBufferIn& buffer); |
---|
[509] | 144 | |
---|
[219] | 145 | /// Destructeur /// |
---|
| 146 | virtual ~CDomain(void); |
---|
| 147 | |
---|
| 148 | /// Accesseurs statiques /// |
---|
| 149 | static StdString GetName(void); |
---|
| 150 | static StdString GetDefName(void); |
---|
[509] | 151 | |
---|
[219] | 152 | static ENodeType GetType(void); |
---|
[657] | 153 | const std::map<int, vector<size_t> >& getIndexServer() const; |
---|
[369] | 154 | CArray<int, 2> local_mask; |
---|
[384] | 155 | bool isCurvilinear ; |
---|
[449] | 156 | bool hasBounds ; |
---|
[611] | 157 | bool hasArea; |
---|
[665] | 158 | bool hasLonLat; |
---|
[631] | 159 | private: |
---|
[667] | 160 | void checkDomain(void); |
---|
| 161 | void checkLocalIDomain(void); |
---|
| 162 | void checkLocalJDomain(void); |
---|
| 163 | |
---|
| 164 | void checkMask(void); |
---|
| 165 | void checkDomainData(void); |
---|
| 166 | void checkCompression(void); |
---|
| 167 | |
---|
| 168 | void checkBounds(void); |
---|
| 169 | void checkArea(void); |
---|
| 170 | void checkLonLat(); |
---|
| 171 | |
---|
[631] | 172 | void checkTransformations(); |
---|
| 173 | void setTransformations(const TransMapTypes&); |
---|
[657] | 174 | void computeNGlobDomain(); |
---|
[631] | 175 | |
---|
[665] | 176 | void sendIndex(); |
---|
| 177 | void sendArea(); |
---|
| 178 | void sendLonLat(); |
---|
| 179 | |
---|
[676] | 180 | private: |
---|
[219] | 181 | bool isChecked; |
---|
[676] | 182 | std::set<StdString> relFiles, relFilesCompressed; |
---|
[551] | 183 | bool isClientChecked; // Verify whether all attributes of domain on the client side are good |
---|
[657] | 184 | bool isClientAfterTransformationChecked; |
---|
[610] | 185 | std::map<int, CArray<int,1> > indiSrv, indjSrv; |
---|
[553] | 186 | std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server |
---|
| 187 | std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server |
---|
[676] | 188 | std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server |
---|
| 189 | std::vector<int> indexesToWrite; |
---|
| 190 | int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; |
---|
[584] | 191 | std::vector<int> connectedServerRank_; |
---|
[594] | 192 | bool isDistributed_; |
---|
[676] | 193 | //! True if and only if the data defined on the domain can be outputted in a compressed way |
---|
| 194 | bool isCompressible_; |
---|
[715] | 195 | bool isRedistributed_; |
---|
[631] | 196 | TransMapTypes transformationMap_; |
---|
[657] | 197 | std::vector<int> nGlobDomain_; |
---|
| 198 | bool isUnstructed_; |
---|
[687] | 199 | CDomain* srcObject_; |
---|
[219] | 200 | |
---|
[540] | 201 | DECLARE_REF_FUNC(Domain,domain) |
---|
| 202 | |
---|
[219] | 203 | }; // class CDomain |
---|
| 204 | |
---|
| 205 | ///-------------------------------------------------------------- |
---|
| 206 | |
---|
| 207 | // Declare/Define CDomainGroup and CDomainDefinition |
---|
| 208 | DECLARE_GROUP(CDomain); |
---|
| 209 | |
---|
| 210 | ///-------------------------------------------------------------- |
---|
| 211 | |
---|
[335] | 212 | } // namespace xios |
---|
[219] | 213 | |
---|
[591] | 214 | #endif // __XIOS_CDomain__ |
---|