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

Last change on this file since 878 was 878, checked in by oabramkina, 8 years ago

Sequential version for UGRID norms. File attribute "convention" has been added with two possible values "CF" and "UGRID". The default value is "CF".

  • 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.8 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
[878]19#include "mesh.hpp"
20
[335]21namespace xios {
[509]22
[219]23   /// ////////////////////// Déclarations ////////////////////// ///
24
25   class CDomainGroup;
26   class CDomainAttributes;
27   class CDomain;
[878]28   class CFile;
[219]29
30   ///--------------------------------------------------------------
31
32   // Declare/Define CDomainAttribute
33   BEGIN_DECLARE_ATTRIBUTE_MAP(CDomain)
34#  include "domain_attribute.conf"
[775]35#  include "domain_attribute_private.conf"
[219]36   END_DECLARE_ATTRIBUTE_MAP(CDomain)
37
38   ///--------------------------------------------------------------
39
40   class CDomain
41      : public CObjectTemplate<CDomain>
42      , public CDomainAttributes
43   {
[878]44
[300]45         enum EEventId
46         {
[611]47           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT, EVENT_ID_AREA
[300]48         } ;
[509]49
[219]50         /// typedef ///
51         typedef CObjectTemplate<CDomain>   SuperClass;
52         typedef CDomainAttributes SuperClassAttribute;
53
[676]54      public:
[219]55
56         typedef CDomainAttributes RelAttributes;
57         typedef CDomainGroup      RelGroup;
[631]58         typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes;
[219]59
60         /// Constructeurs ///
61         CDomain(void);
62         explicit CDomain(const StdString & id);
63         CDomain(const CDomain & domain);       // Not implemented yet.
64         CDomain(const CDomain * const domain); // Not implemented yet.
65
[622]66         static CDomain* createDomain();
[878]67         
68         CMesh* mesh;
69       
[631]70         virtual void parse(xml::CXMLNode & node);
71
[219]72         /// Vérifications ///
73         void checkAttributes(void);
74
[509]75         void checkAttributesOnClient();
[657]76         void checkAttributesOnClientAfterTransformation();
[509]77
[676]78         void checkEligibilityForCompressedOutput(void);
79
[509]80         void sendCheckedAttributes();
81
[631]82         bool hasTransformation();
83         void solveInheritanceTransformation();
84         TransMapTypes getAllTransformations();
[687]85         void redistribute(int nbLocalDomain);
[823]86         void duplicateTransformation(CDomain*);
[836]87         CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id="");
[631]88
[676]89      public:
[219]90         const std::set<StdString> & getRelFiles(void) const;
91         bool IsWritten(const StdString & filename) const;
[676]92         bool isWrittenCompressed(const StdString& filename) const;
93
94         const std::vector<int>& getIndexesToWrite(void) const;
95         int getNumberWrittenIndexes() const;
96         int getTotalNumberWrittenIndexes() const;
97         int getOffsetWrittenIndexes() const;
98
[731]99         std::map<int, StdSize> getAttributesBufferSize();
100
[219]101         bool isEmpty(void) const;
[594]102         bool isDistributed(void) const;
[676]103         bool isCompressible(void) const;
[509]104
[300]105         int ni_srv,ibegin_srv,iend_srv ;
106         int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ;
107
108         int nj_srv,jbegin_srv,jend_srv ;
109         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ;
110
[369]111         CArray<double, 1> lonvalue_srv, latvalue_srv ;
[449]112         CArray<double, 2> bounds_lon_srv, bounds_lat_srv ;
[664]113         CArray<double, 1> lonvalue_client, latvalue_client;
114         CArray<double, 2> bounds_lon_client, bounds_lat_client;
[611]115         CArray<double, 1> area_srv;
[509]116
117        vector<int> connectedServer ; // list of connected server
[467]118        vector<int> nbSenders ; // for each communication with a server, number of communicating client
[509]119        vector<int> nbDataSrv ; // size of data to send to each server
[467]120        vector< vector<int> > i_indSrv ; // for each server, i global index to send
121        vector< vector<int> > j_indSrv ; // for each server, j global index to send
[509]122
[676]123      public:
[219]124         /// Mutateur ///
125         void addRelFile(const StdString & filename);
[676]126         void addRelFileCompressed(const StdString& filename);
[266]127         void completeLonLatClient(void);
[300]128         void sendServerAttribut(void) ;
[611]129         void sendLonLatArea(void);
[300]130         void computeConnectedServer(void) ;
[821]131
132         void AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat,
[809]133                                         CArray<double,1>& lon_g, CArray<double,1>& lat_g);
[821]134
135         void fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat,
[809]136                                           CArray<double,2>& boundsLon, CArray<double,2>& boundsLat);
[775]137         void fillInRectilinearLonLat();
[611]138
[610]139         static bool dispatchEvent(CEventServer& event);
140         static void recvServerAttribut(CEventServer& event);
141         static void recvIndex(CEventServer& event);
142         static void recvLon(CEventServer& event);
143         static void recvLat(CEventServer& event);
[611]144         static void recvArea(CEventServer& event);
[610]145         void recvServerAttribut(CBufferIn& buffer);
146         void recvIndex(int rank, CBufferIn& buffer);
147         void recvLon(int rank, CBufferIn& buffer);
148         void recvLat(int rank, CBufferIn& buffer);
[611]149         void recvArea(int rank, CBufferIn& buffer);
[509]150
[219]151         /// Destructeur ///
152         virtual ~CDomain(void);
153
154         /// Accesseurs statiques ///
155         static StdString GetName(void);
156         static StdString GetDefName(void);
[509]157
[219]158         static ENodeType GetType(void);
[657]159         const std::map<int, vector<size_t> >& getIndexServer() const;
[369]160         CArray<int, 2> local_mask;
[384]161         bool isCurvilinear ;
[449]162         bool hasBounds ;
[611]163         bool hasArea;
[665]164         bool hasLonLat;
[631]165      private:
[667]166         void checkDomain(void);
167         void checkLocalIDomain(void);
168         void checkLocalJDomain(void);
169
170         void checkMask(void);
171         void checkDomainData(void);
172         void checkCompression(void);
173
174         void checkBounds(void);
175         void checkArea(void);
176         void checkLonLat();
[821]177         void checkZoom(void);
[667]178
[631]179         void checkTransformations();
180         void setTransformations(const TransMapTypes&);
[657]181         void computeNGlobDomain();
[631]182
[665]183         void sendIndex();
184         void sendArea();
185         void sendLonLat();
186
[676]187       private:
[219]188         bool isChecked;
[676]189         std::set<StdString> relFiles, relFilesCompressed;
[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
[676]195         std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
196         std::vector<int> indexesToWrite;
197         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
[584]198         std::vector<int> connectedServerRank_;
[594]199         bool isDistributed_;
[676]200         //! True if and only if the data defined on the domain can be outputted in a compressed way
201         bool isCompressible_;
[715]202         bool isRedistributed_;
[631]203         TransMapTypes transformationMap_;
[657]204         std::vector<int> nGlobDomain_;
205         bool isUnstructed_;
[219]206
[836]207       private:
208         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
209         static std::map<StdString, ETranformationType> transformationMapList_;
210         static bool _dummyTransformationMapList;
211
[540]212         DECLARE_REF_FUNC(Domain,domain)
213
[219]214   }; // class CDomain
215
216   ///--------------------------------------------------------------
217
218   // Declare/Define CDomainGroup and CDomainDefinition
219   DECLARE_GROUP(CDomain);
220
221   ///--------------------------------------------------------------
222
[335]223} // namespace xios
[219]224
[878]225#endif //__XIOS_CDomain__
Note: See TracBrowser for help on using the repository browser.