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

Last change on this file since 680 was 676, checked in by rlacroix, 9 years ago

Add support for indexed output.

If the new field attribute "indexed_output" is set to true and a mask is defined (either at grid, domain or axis level), the indexed data will be outputed instead of the full data with missing values.

See http://cfconventions.org/Data/cf-conventions/cf-conventions-1.5/build/cf-conventions.html#compression-by-gathering for more information.

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