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

Last change on this file since 665 was 665, checked in by mhnguyen, 9 years ago

Changing longitude and latitude (as well as their bounds) be optional

+) Seperate sendIndex, sendLonLat and sendArea

Test
+) On Curie
+) test_client and test_complete are correct

  • 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: 6.7 KB
RevLine 
[591]1#ifndef __XIOS_CDomain__
2#define __XIOS_CDomain__
[219]3
[591]4/// XIOS headers ///
5#include "xios_spl.hpp"
[219]6#include "group_factory.hpp"
7
8#include "declare_group.hpp"
[540]9#include "declare_ref_func.hpp"
[300]10#include "event_client.hpp"
11#include "event_server.hpp"
12#include "buffer_in.hpp"
[369]13#include "array_new.hpp"
14#include "attribute_array.hpp"
[449]15#include "attribute_enum.hpp"
[631]16#include "transformation.hpp"
17#include "transformation_enum.hpp"
[219]18
[335]19namespace xios {
[509]20
[219]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   END_DECLARE_ATTRIBUTE_MAP(CDomain)
33
34   ///--------------------------------------------------------------
35
36   class CDomain
37      : public CObjectTemplate<CDomain>
38      , public CDomainAttributes
39   {
[300]40         enum EEventId
41         {
[611]42           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT, EVENT_ID_AREA
[300]43         } ;
[509]44
[219]45         /// typedef ///
46         typedef CObjectTemplate<CDomain>   SuperClass;
47         typedef CDomainAttributes SuperClassAttribute;
48
49      public :
50
51         typedef CDomainAttributes RelAttributes;
52         typedef CDomainGroup      RelGroup;
[631]53         typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes;
[219]54
55         /// Constructeurs ///
56         CDomain(void);
57         explicit CDomain(const StdString & id);
58         CDomain(const CDomain & domain);       // Not implemented yet.
59         CDomain(const CDomain * const domain); // Not implemented yet.
60
[622]61         static CDomain* createDomain();
62         void duplicateAttributes(CDomain* domain);
63
[631]64         virtual void parse(xml::CXMLNode & node);
65
[219]66         /// Vérifications ///
67         void checkAttributes(void);
68
[509]69         void checkAttributesOnClient();
[657]70         void checkAttributesOnClientAfterTransformation();
[509]71
72         void sendCheckedAttributes();
73
[631]74         bool hasTransformation();
75         void solveInheritanceTransformation();
76         TransMapTypes getAllTransformations();
77
[219]78      private :
79
[467]80         void checkDomain(void);
[219]81
82         void checkLocalIDomain(void);
83         void checkLocalJDomain(void);
84
85         void checkMask(void);
86         void checkDomainData(void);
87         void checkCompression(void);
[509]88
[219]89         void checkZoom(void);
[449]90         void checkBounds(void);
[611]91         void checkArea(void);
[665]92         void checkLonLat();
[219]93
94
95      public :
[509]96
[219]97         /// Autres ///
98
99         const std::set<StdString> & getRelFiles(void) const;
100
[274]101
[219]102         /// Test ///
103         bool IsWritten(const StdString & filename) const;
[657]104//         bool hasZoom(void) const;
[219]105         bool isEmpty(void) const;
[594]106         bool isDistributed(void) const;
[509]107
108
[300]109         int ni_client,ibegin_client,iend_client ;
110         int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ;
111
112         int nj_client,jbegin_client,jend_client ;
113         int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ;
114
115         int ni_srv,ibegin_srv,iend_srv ;
116         int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ;
117
118         int nj_srv,jbegin_srv,jend_srv ;
119         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ;
120
[369]121         CArray<double, 1> lonvalue_srv, latvalue_srv ;
[449]122         CArray<double, 2> bounds_lon_srv, bounds_lat_srv ;
[664]123         CArray<double, 1> lonvalue_client, latvalue_client;
124         CArray<double, 2> bounds_lon_client, bounds_lat_client;
[611]125         CArray<double, 1> area_srv;
[509]126
127
128        vector<int> connectedServer ; // list of connected server
[467]129        vector<int> nbSenders ; // for each communication with a server, number of communicating client
[509]130        vector<int> nbDataSrv ; // size of data to send to each server
[467]131        vector< vector<int> > i_indSrv ; // for each server, i global index to send
132        vector< vector<int> > j_indSrv ; // for each server, j global index to send
[509]133
[553]134
[467]135        CArray<int,2> mapConnectedServer ;  // (ni,nj) => mapped to connected server number, -1 if no server is target
[509]136
[631]137        int global_zoom_ibegin, global_zoom_ni;
138        int global_zoom_jbegin, global_zoom_nj;
[664]139//        CArray<bool,1> maskInter;
[509]140
[219]141      public :
[509]142
[219]143         /// Mutateur ///
144         void addRelFile(const StdString & filename);
[266]145         void completeLonLatClient(void);
[300]146         void sendServerAttribut(void) ;
[611]147         void sendLonLatArea(void);
[300]148         void computeConnectedServer(void) ;
[611]149
[610]150         static bool dispatchEvent(CEventServer& event);
151         static void recvServerAttribut(CEventServer& event);
152         static void recvIndex(CEventServer& event);
153         static void recvLon(CEventServer& event);
154         static void recvLat(CEventServer& event);
[611]155         static void recvArea(CEventServer& event);
[610]156         void recvServerAttribut(CBufferIn& buffer);
157         void recvIndex(int rank, CBufferIn& buffer);
158         void recvLon(int rank, CBufferIn& buffer);
159         void recvLat(int rank, CBufferIn& buffer);
[611]160         void recvArea(int rank, CBufferIn& buffer);
[509]161
[219]162         /// Destructeur ///
163         virtual ~CDomain(void);
164
165         /// Accesseurs statiques ///
166         static StdString GetName(void);
167         static StdString GetDefName(void);
[509]168
[219]169         static ENodeType GetType(void);
[657]170         const std::map<int, vector<size_t> >& getIndexServer() const;
[369]171         CArray<int, 2> local_mask;
[384]172         bool isCurvilinear ;
[449]173         bool hasBounds ;
[611]174         bool hasArea;
[665]175         bool hasLonLat;
[631]176      private:
177         void checkTransformations();
178         void setTransformations(const TransMapTypes&);
[657]179         void computeNGlobDomain();
[664]180         void completeLonClient();
181         void completeLatClient();
[631]182
[665]183         void sendIndex();
184         void sendArea();
185         void sendLonLat();
186
[219]187       private :
188         bool isChecked;
189         std::set<StdString> relFiles;
[551]190         bool isClientChecked; // Verify whether all attributes of domain on the client side are good
[657]191         bool isClientAfterTransformationChecked;
[610]192         std::map<int, CArray<int,1> > indiSrv, indjSrv;
[553]193         std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server
194         std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server
[584]195         std::vector<int> connectedServerRank_;
[594]196         bool isDistributed_;
[631]197         TransMapTypes transformationMap_;
[657]198         std::vector<int> nGlobDomain_;
199         bool isUnstructed_;
[219]200
[657]201
[664]202
[540]203         DECLARE_REF_FUNC(Domain,domain)
204
[219]205   }; // class CDomain
206
207   ///--------------------------------------------------------------
208
209   // Declare/Define CDomainGroup and CDomainDefinition
210   DECLARE_GROUP(CDomain);
211
212   ///--------------------------------------------------------------
213
[335]214} // namespace xios
[219]215
[591]216#endif // __XIOS_CDomain__
Note: See TracBrowser for help on using the repository browser.