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

Last change on this file since 611 was 611, checked in by rlacroix, 9 years ago

Improve CF compliance: Add a new domain attribute "area".

Fixes ticket #68.

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