source: XIOS/trunk/src/node/domain.hpp @ 667

Last change on this file since 667 was 667, checked in by mhnguyen, 9 years ago

Clearing some redundant codes and add some comments

Test
No

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 6.1 KB
Line 
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#include "transformation.hpp"
17#include "transformation_enum.hpp"
18
19namespace xios {
20
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"
32   END_DECLARE_ATTRIBUTE_MAP(CDomain)
33
34   ///--------------------------------------------------------------
35
36   class CDomain
37      : public CObjectTemplate<CDomain>
38      , public CDomainAttributes
39   {
40         enum EEventId
41         {
42           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT, EVENT_ID_AREA
43         } ;
44
45         /// typedef ///
46         typedef CObjectTemplate<CDomain>   SuperClass;
47         typedef CDomainAttributes SuperClassAttribute;
48
49      public :
50
51         typedef CDomainAttributes RelAttributes;
52         typedef CDomainGroup      RelGroup;
53         typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes;
54
55         /// Constructeurs ///
56         CDomain(void);
57         explicit CDomain(const StdString & id);
58         CDomain(const CDomain & domain);       // Not implemented yet.
59         CDomain(const CDomain * const domain); // Not implemented yet.
60
61         static CDomain* createDomain();
62         void duplicateAttributes(CDomain* domain);
63
64         virtual void parse(xml::CXMLNode & node);
65
66         /// Vérifications ///
67         void checkAttributes(void);
68
69         void checkAttributesOnClient();
70         void checkAttributesOnClientAfterTransformation();
71
72         void sendCheckedAttributes();
73
74         bool hasTransformation();
75         void solveInheritanceTransformation();
76         TransMapTypes getAllTransformations();
77
78      public :
79         const std::set<StdString> & getRelFiles(void) const;
80         bool IsWritten(const StdString & filename) const;
81         bool isEmpty(void) const;
82         bool isDistributed(void) const;
83
84
85         int global_zoom_ibegin, global_zoom_ni;
86         int global_zoom_jbegin, global_zoom_nj;
87
88         int ni_srv,ibegin_srv,iend_srv ;
89         int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ;
90
91         int nj_srv,jbegin_srv,jend_srv ;
92         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ;
93
94         CArray<double, 1> lonvalue_srv, latvalue_srv ;
95         CArray<double, 2> bounds_lon_srv, bounds_lat_srv ;
96         CArray<double, 1> lonvalue_client, latvalue_client;
97         CArray<double, 2> bounds_lon_client, bounds_lat_client;
98         CArray<double, 1> area_srv;
99
100        vector<int> connectedServer ; // list of connected server
101        vector<int> nbSenders ; // for each communication with a server, number of communicating client
102        vector<int> nbDataSrv ; // size of data to send to each server
103        vector< vector<int> > i_indSrv ; // for each server, i global index to send
104        vector< vector<int> > j_indSrv ; // for each server, j global index to send
105
106      public :
107         /// Mutateur ///
108         void addRelFile(const StdString & filename);
109         void completeLonLatClient(void);
110         void sendServerAttribut(void) ;
111         void sendLonLatArea(void);
112         void computeConnectedServer(void) ;
113
114         static bool dispatchEvent(CEventServer& event);
115         static void recvServerAttribut(CEventServer& event);
116         static void recvIndex(CEventServer& event);
117         static void recvLon(CEventServer& event);
118         static void recvLat(CEventServer& event);
119         static void recvArea(CEventServer& event);
120         void recvServerAttribut(CBufferIn& buffer);
121         void recvIndex(int rank, CBufferIn& buffer);
122         void recvLon(int rank, CBufferIn& buffer);
123         void recvLat(int rank, CBufferIn& buffer);
124         void recvArea(int rank, CBufferIn& buffer);
125
126         /// Destructeur ///
127         virtual ~CDomain(void);
128
129         /// Accesseurs statiques ///
130         static StdString GetName(void);
131         static StdString GetDefName(void);
132
133         static ENodeType GetType(void);
134         const std::map<int, vector<size_t> >& getIndexServer() const;
135         CArray<int, 2> local_mask;
136         bool isCurvilinear ;
137         bool hasBounds ;
138         bool hasArea;
139         bool hasLonLat;
140      private:
141         void checkDomain(void);
142         void checkLocalIDomain(void);
143         void checkLocalJDomain(void);
144
145         void checkMask(void);
146         void checkDomainData(void);
147         void checkCompression(void);
148
149         void checkBounds(void);
150         void checkArea(void);
151         void checkLonLat();
152
153         void checkTransformations();
154         void setTransformations(const TransMapTypes&);
155         void computeNGlobDomain();
156
157         void sendIndex();
158         void sendArea();
159         void sendLonLat();
160
161       private :
162         bool isChecked;
163         std::set<StdString> relFiles;
164         bool isClientChecked; // Verify whether all attributes of domain on the client side are good
165         bool isClientAfterTransformationChecked;
166         std::map<int, CArray<int,1> > indiSrv, indjSrv;
167         std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server
168         std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server
169         std::vector<int> connectedServerRank_;
170         bool isDistributed_;
171         TransMapTypes transformationMap_;
172         std::vector<int> nGlobDomain_;
173         bool isUnstructed_;
174
175         DECLARE_REF_FUNC(Domain,domain)
176
177   }; // class CDomain
178
179   ///--------------------------------------------------------------
180
181   // Declare/Define CDomainGroup and CDomainDefinition
182   DECLARE_GROUP(CDomain);
183
184   ///--------------------------------------------------------------
185
186} // namespace xios
187
188#endif // __XIOS_CDomain__
Note: See TracBrowser for help on using the repository browser.