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

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

Correctly estimate the needed buffer sizes.

The attributes were not considered which could lead to incorrect estimations.

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