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

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

Domain initialization: Reduce communications and simplify the code.

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