source: XIOS/branchs/xios-1.0/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: 4.7 KB
Line 
1#ifndef __XMLIO_CDomain__
2#define __XMLIO_CDomain__
3
4/// xios headers ///
5#include "xmlioserver_spl.hpp"
6#include "group_factory.hpp"
7
8#include "declare_group.hpp"
9#include "event_client.hpp"
10#include "event_server.hpp"
11#include "buffer_in.hpp"
12#include "array_new.hpp"
13#include "attribute_array.hpp"
14#include "attribute_enum.hpp"
15
16namespace xios {
17
18   /// ////////////////////// Déclarations ////////////////////// ///
19
20   class CDomainGroup;
21   class CDomainAttributes;
22   class CDomain;
23
24   ///--------------------------------------------------------------
25
26   // Declare/Define CDomainAttribute
27   BEGIN_DECLARE_ATTRIBUTE_MAP(CDomain)
28#  include "domain_attribute.conf"
29   END_DECLARE_ATTRIBUTE_MAP(CDomain)
30
31   ///--------------------------------------------------------------
32
33   class CDomain
34      : public CObjectTemplate<CDomain>
35      , public CDomainAttributes
36   {
37         enum EEventId
38         {
39           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_LON_LAT, EVENT_ID_AREA
40         } ;
41
42         /// typedef ///
43         typedef CObjectTemplate<CDomain>   SuperClass;
44         typedef CDomainAttributes SuperClassAttribute;
45
46      public :
47
48         typedef CDomainAttributes RelAttributes;
49         typedef CDomainGroup      RelGroup;
50
51         /// Constructeurs ///
52         CDomain(void);
53         explicit CDomain(const StdString & id);
54         CDomain(const CDomain & domain);       // Not implemented yet.
55         CDomain(const CDomain * const domain); // Not implemented yet.
56
57         /// Vérifications ///
58         void checkAttributes(void);
59
60      private :
61
62         void checkDomain(void);
63
64         void checkLocalIDomain(void);
65         void checkLocalJDomain(void);
66
67         void checkMask(void);
68         void checkDomainData(void);
69         void checkCompression(void);
70
71         void checkZoom(void);
72         void checkBounds(void);
73         void checkArea(void);
74
75
76      public :
77
78         /// Autres ///
79
80         const std::set<StdString> & getRelFiles(void) const;
81
82
83         /// Test ///
84         bool IsWritten(const StdString & filename) const;
85         bool hasZoom(void) const;
86         bool isEmpty(void) const;
87
88
89         int ni_client,ibegin_client,iend_client ;
90         int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ;
91
92         int nj_client,jbegin_client,jend_client ;
93         int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ;
94
95         int ni_srv,ibegin_srv,iend_srv ;
96         int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ;
97
98         int nj_srv,jbegin_srv,jend_srv ;
99         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ;
100
101         CArray<double, 1> lonvalue_srv, latvalue_srv ;
102         CArray<double, 2> bounds_lon_srv, bounds_lat_srv ;
103         CArray<double, 1> area_srv;
104
105
106        vector<int> connectedServer ; // list of connected server
107        vector<int> nbSenders ; // for each communication with a server, number of communicating client
108        vector<int> nbDataSrv ; // size of data to send to each server
109        vector< vector<int> > i_indSrv ; // for each server, i global index to send
110        vector< vector<int> > j_indSrv ; // for each server, j global index to send
111
112        CArray<int,2> mapConnectedServer ;  // (ni,nj) => mapped to connected server number, -1 if no server is target
113
114//        vector<int> ib_srv, ie_srv, in_srv ;
115//        vector<int> jb_srv, je_srv, jn_srv ;
116
117      public :
118
119         /// Mutateur ///
120         void addRelFile(const StdString & filename);
121         void completeLonLatClient(void);
122         void sendServerAttribut(void);
123         void sendLonLatArea(void);
124         void computeConnectedServer(void);
125
126         static bool dispatchEvent(CEventServer& event);
127         static void recvServerAttribut(CEventServer& event);
128         static void recvLonLat(CEventServer& event);
129         static void recvArea(CEventServer& event);
130         void recvServerAttribut(CBufferIn& buffer);
131         void recvLonLat(int rank, CBufferIn& buffer);
132         void recvArea(int rank, CBufferIn& buffer);
133
134         /// Destructeur ///
135         virtual ~CDomain(void);
136
137         /// Accesseurs statiques ///
138         static StdString GetName(void);
139         static StdString GetDefName(void);
140
141         static ENodeType GetType(void);
142
143         CArray<int, 2> local_mask;
144         bool isCurvilinear ;
145         bool hasBounds ;
146         bool hasArea;
147
148       private :
149         /// Proriétés protégées ///
150         bool isChecked;
151         std::set<StdString> relFiles;
152         std::map<int, CArray<int,1> > indiSrv, indjSrv;
153
154   }; // class CDomain
155
156   ///--------------------------------------------------------------
157
158   // Declare/Define CDomainGroup and CDomainDefinition
159   DECLARE_GROUP(CDomain);
160
161   ///--------------------------------------------------------------
162
163} // namespace xios
164
165#endif // __XMLIO_CDomain__
Note: See TracBrowser for help on using the repository browser.