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

Last change on this file since 789 was 789, checked in by rlacroix, 8 years ago

Domain: Remove the domain_src attribute.

It was added but was never used.

  • 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: 7.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#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#  include "domain_attribute_private.conf"
33   END_DECLARE_ATTRIBUTE_MAP(CDomain)
34
35   ///--------------------------------------------------------------
36
37   class CDomain
38      : public CObjectTemplate<CDomain>
39      , public CDomainAttributes
40   {
41         enum EEventId
42         {
43           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT, EVENT_ID_AREA
44         } ;
45
46         /// typedef ///
47         typedef CObjectTemplate<CDomain>   SuperClass;
48         typedef CDomainAttributes SuperClassAttribute;
49
50      public:
51
52         typedef CDomainAttributes RelAttributes;
53         typedef CDomainGroup      RelGroup;
54         typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes;
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
62         static CDomain* createDomain();
63         void duplicateAttributes(CDomain* domain);
64
65         virtual void parse(xml::CXMLNode & node);
66
67         /// Vérifications ///
68         void checkAttributes(void);
69
70         void checkAttributesOnClient();
71         void checkAttributesOnClientAfterTransformation();
72
73         void checkEligibilityForCompressedOutput(void);
74
75         void sendCheckedAttributes();
76
77         bool hasTransformation();
78         void solveInheritanceTransformation();
79         TransMapTypes getAllTransformations();
80         void redistribute(int nbLocalDomain);
81
82      public:
83         const std::set<StdString> & getRelFiles(void) const;
84         bool IsWritten(const StdString & filename) const;
85         bool isWrittenCompressed(const StdString& filename) const;
86
87         const std::vector<int>& getIndexesToWrite(void) const;
88         int getNumberWrittenIndexes() const;
89         int getTotalNumberWrittenIndexes() const;
90         int getOffsetWrittenIndexes() const;
91
92         std::map<int, StdSize> getAttributesBufferSize();
93
94         bool isEmpty(void) const;
95         bool isDistributed(void) const;
96         bool isCompressible(void) const;
97
98         int global_zoom_ibegin, global_zoom_ni;
99         int global_zoom_jbegin, global_zoom_nj;
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> lonvalue_client, latvalue_client;
110         CArray<double, 2> bounds_lon_client, bounds_lat_client;
111         CArray<double, 1> area_srv;
112
113        vector<int> connectedServer ; // list of connected server
114        vector<int> nbSenders ; // for each communication with a server, number of communicating client
115        vector<int> nbDataSrv ; // size of data to send to each server
116        vector< vector<int> > i_indSrv ; // for each server, i global index to send
117        vector< vector<int> > j_indSrv ; // for each server, j global index to send
118
119      public:
120         /// Mutateur ///
121         void addRelFile(const StdString & filename);
122         void addRelFileCompressed(const StdString& filename);
123         void completeLonLatClient(void);
124         void sendServerAttribut(void) ;
125         void sendLonLatArea(void);
126         void computeConnectedServer(void) ;
127         void fillInRectilinearBoundLonLat(CArray<double,2>& boundsLon, CArray<double,2>& boundsLat,
128                                           bool isNorthPole = false, bool isSouthPole = false);
129         void fillInRectilinearLonLat();
130
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         static void recvArea(CEventServer& event);
137         void recvServerAttribut(CBufferIn& buffer);
138         void recvIndex(int rank, CBufferIn& buffer);
139         void recvLon(int rank, CBufferIn& buffer);
140         void recvLat(int rank, CBufferIn& buffer);
141         void recvArea(int rank, CBufferIn& buffer);
142
143         /// Destructeur ///
144         virtual ~CDomain(void);
145
146         /// Accesseurs statiques ///
147         static StdString GetName(void);
148         static StdString GetDefName(void);
149
150         static ENodeType GetType(void);
151         const std::map<int, vector<size_t> >& getIndexServer() const;
152         CArray<int, 2> local_mask;
153         bool isCurvilinear ;
154         bool hasBounds ;
155         bool hasArea;
156         bool hasLonLat;
157      private:
158         void checkDomain(void);
159         void checkLocalIDomain(void);
160         void checkLocalJDomain(void);
161
162         void checkMask(void);
163         void checkDomainData(void);
164         void checkCompression(void);
165
166         void checkBounds(void);
167         void checkArea(void);
168         void checkLonLat();
169
170         void checkTransformations();
171         void setTransformations(const TransMapTypes&);
172         void computeNGlobDomain();
173
174         void sendIndex();
175         void sendArea();
176         void sendLonLat();
177
178       private:
179         bool isChecked;
180         std::set<StdString> relFiles, relFilesCompressed;
181         bool isClientChecked; // Verify whether all attributes of domain on the client side are good
182         bool isClientAfterTransformationChecked;
183         std::map<int, CArray<int,1> > indiSrv, indjSrv;
184         std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server
185         std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server
186         std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
187         std::vector<int> indexesToWrite;
188         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
189         std::vector<int> connectedServerRank_;
190         bool isDistributed_;
191         //! True if and only if the data defined on the domain can be outputted in a compressed way
192         bool isCompressible_;
193         bool isRedistributed_;
194         TransMapTypes transformationMap_;
195         std::vector<int> nGlobDomain_;
196         bool isUnstructed_;
197
198         DECLARE_REF_FUNC(Domain,domain)
199
200   }; // class CDomain
201
202   ///--------------------------------------------------------------
203
204   // Declare/Define CDomainGroup and CDomainDefinition
205   DECLARE_GROUP(CDomain);
206
207   ///--------------------------------------------------------------
208
209} // namespace xios
210
211#endif // __XIOS_CDomain__
Note: See TracBrowser for help on using the repository browser.