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

Last change on this file since 1050 was 953, checked in by ymipsl, 8 years ago

Add gaussian grid support./n YM

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