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

Last change on this file since 836 was 836, checked in by mhnguyen, 8 years ago

Exposing transformation to Fortran interface

+) Export zoom and axis transformation to Fortran interface

Test
+) On Curie
+) All work

  • 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.7 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
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 checkEligibilityForCompressedOutput(void);
73
74         void sendCheckedAttributes();
75
76         bool hasTransformation();
77         void solveInheritanceTransformation();
78         TransMapTypes getAllTransformations();
79         void redistribute(int nbLocalDomain);
80         void duplicateTransformation(CDomain*);
81         CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id="");
82
83      public:
84         const std::set<StdString> & getRelFiles(void) const;
85         bool IsWritten(const StdString & filename) const;
86         bool isWrittenCompressed(const StdString& filename) const;
87
88         const std::vector<int>& getIndexesToWrite(void) const;
89         int getNumberWrittenIndexes() const;
90         int getTotalNumberWrittenIndexes() const;
91         int getOffsetWrittenIndexes() const;
92
93         std::map<int, StdSize> getAttributesBufferSize();
94
95         bool isEmpty(void) const;
96         bool isDistributed(void) const;
97         bool isCompressible(void) const;
98
99         int ni_srv,ibegin_srv,iend_srv ;
100         int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ;
101
102         int nj_srv,jbegin_srv,jend_srv ;
103         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ;
104
105         CArray<double, 1> lonvalue_srv, latvalue_srv ;
106         CArray<double, 2> bounds_lon_srv, bounds_lat_srv ;
107         CArray<double, 1> lonvalue_client, latvalue_client;
108         CArray<double, 2> bounds_lon_client, bounds_lat_client;
109         CArray<double, 1> area_srv;
110
111        vector<int> connectedServer ; // list of connected server
112        vector<int> nbSenders ; // for each communication with a server, number of communicating client
113        vector<int> nbDataSrv ; // size of data to send to each server
114        vector< vector<int> > i_indSrv ; // for each server, i global index to send
115        vector< vector<int> > j_indSrv ; // for each server, j global index to send
116
117      public:
118         /// Mutateur ///
119         void addRelFile(const StdString & filename);
120         void addRelFileCompressed(const StdString& filename);
121         void completeLonLatClient(void);
122         void sendServerAttribut(void) ;
123         void sendLonLatArea(void);
124         void computeConnectedServer(void) ;
125
126         void AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat,
127                                         CArray<double,1>& lon_g, CArray<double,1>& lat_g);
128
129         void fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat,
130                                           CArray<double,2>& boundsLon, CArray<double,2>& boundsLat);
131         void fillInRectilinearLonLat();
132
133         static bool dispatchEvent(CEventServer& event);
134         static void recvServerAttribut(CEventServer& event);
135         static void recvIndex(CEventServer& event);
136         static void recvLon(CEventServer& event);
137         static void recvLat(CEventServer& event);
138         static void recvArea(CEventServer& event);
139         void recvServerAttribut(CBufferIn& buffer);
140         void recvIndex(int rank, CBufferIn& buffer);
141         void recvLon(int rank, CBufferIn& buffer);
142         void recvLat(int rank, CBufferIn& buffer);
143         void recvArea(int rank, CBufferIn& buffer);
144
145         /// Destructeur ///
146         virtual ~CDomain(void);
147
148         /// Accesseurs statiques ///
149         static StdString GetName(void);
150         static StdString GetDefName(void);
151
152         static ENodeType GetType(void);
153         const std::map<int, vector<size_t> >& getIndexServer() const;
154         CArray<int, 2> local_mask;
155         bool isCurvilinear ;
156         bool hasBounds ;
157         bool hasArea;
158         bool hasLonLat;
159      private:
160         void checkDomain(void);
161         void checkLocalIDomain(void);
162         void checkLocalJDomain(void);
163
164         void checkMask(void);
165         void checkDomainData(void);
166         void checkCompression(void);
167
168         void checkBounds(void);
169         void checkArea(void);
170         void checkLonLat();
171         void checkZoom(void);
172
173         void checkTransformations();
174         void setTransformations(const TransMapTypes&);
175         void computeNGlobDomain();
176
177         void sendIndex();
178         void sendArea();
179         void sendLonLat();
180
181       private:
182         bool isChecked;
183         std::set<StdString> relFiles, relFilesCompressed;
184         bool isClientChecked; // Verify whether all attributes of domain on the client side are good
185         bool isClientAfterTransformationChecked;
186         std::map<int, CArray<int,1> > indiSrv, indjSrv;
187         std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server
188         std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server
189         std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
190         std::vector<int> indexesToWrite;
191         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
192         std::vector<int> connectedServerRank_;
193         bool isDistributed_;
194         //! True if and only if the data defined on the domain can be outputted in a compressed way
195         bool isCompressible_;
196         bool isRedistributed_;
197         TransMapTypes transformationMap_;
198         std::vector<int> nGlobDomain_;
199         bool isUnstructed_;
200
201       private:
202         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
203         static std::map<StdString, ETranformationType> transformationMapList_;
204         static bool _dummyTransformationMapList;
205
206         DECLARE_REF_FUNC(Domain,domain)
207
208   }; // class CDomain
209
210   ///--------------------------------------------------------------
211
212   // Declare/Define CDomainGroup and CDomainDefinition
213   DECLARE_GROUP(CDomain);
214
215   ///--------------------------------------------------------------
216
217} // namespace xios
218
219#endif // __XIOS_CDomain__
Note: See TracBrowser for help on using the repository browser.