source: XIOS/branchs/xios-2.5/src/node/axis.hpp @ 1624

Last change on this file since 1624 was 1624, checked in by oabramkina, 5 years ago

Bugfix for NEMO-like land processes elimination.

Values describing a domain (latitude, longitude, bounds,...) are set to -1 on land processes.

  • 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
  • Property svn:executable set to *
File size: 7.7 KB
Line 
1#ifndef __XIOS_CAxis__
2#define __XIOS_CAxis__
3
4/// XIOS headers ///
5#include "xios_spl.hpp"
6#include "group_factory.hpp"
7#include "virtual_node.hpp"
8
9#include "declare_group.hpp"
10#include "declare_ref_func.hpp"
11#include "declare_virtual_node.hpp"
12#include "attribute_array.hpp"
13#include "attribute_enum.hpp"
14#include "attribute_enum_impl.hpp"
15#include "server_distribution_description.hpp"
16#include "transformation.hpp"
17#include "transformation_enum.hpp"
18
19namespace xios {
20   /// ////////////////////// Déclarations ////////////////////// ///
21
22   class CAxisGroup;
23   class CAxisAttributes;
24   class CAxis;
25
26   ///--------------------------------------------------------------
27
28   // Declare/Define CAxisAttribute
29   BEGIN_DECLARE_ATTRIBUTE_MAP(CAxis)
30#  include "axis_attribute.conf"
31#  include "axis_attribute_private.conf"
32   END_DECLARE_ATTRIBUTE_MAP(CAxis)
33
34   ///--------------------------------------------------------------
35
36   class CAxis
37      : public CObjectTemplate<CAxis>
38      , public CAxisAttributes
39   {
40               /// typedef ///
41         typedef CObjectTemplate<CAxis>   SuperClass;
42         typedef CAxisAttributes SuperClassAttribute;
43         
44      public:
45         enum EEventId
46         {
47           EVENT_ID_DISTRIBUTION_ATTRIBUTE,           
48           EVENT_ID_DISTRIBUTED_VALUE,
49           EVENT_ID_NON_DISTRIBUTED_VALUE,
50           EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES,
51           EVENT_ID_DISTRIBUTED_ATTRIBUTES
52         } ;
53
54      public:
55         typedef CAxisAttributes RelAttributes;
56         typedef CAxisGroup      RelGroup;
57         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
58
59      public:
60         /// Constructeurs ///
61         CAxis(void);
62         explicit CAxis(const StdString & id);
63         CAxis(const CAxis & axis);       // Not implemented yet.
64         CAxis(const CAxis * const axis); // Not implemented yet.
65
66         static CAxis* createAxis();
67
68         /// Accesseurs ///
69         const std::set<StdString> & getRelFiles(void) const;
70
71         int getNumberWrittenIndexes(MPI_Comm writtenCom);
72         int getTotalNumberWrittenIndexes(MPI_Comm writtenCom);
73         int getOffsetWrittenIndexes(MPI_Comm writtenCom);
74         CArray<int, 1>& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom);
75
76         std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid,
77                                                        CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION);
78
79         /// Test ///
80         bool IsWritten(const StdString & filename) const;
81         bool isWrittenCompressed(const StdString& filename) const;
82         bool isDistributed(void) const;
83         bool isCompressible(void) const;
84
85         /// Mutateur ///
86         void addRelFile(const StdString & filename);
87         void addRelFileCompressed(const StdString& filename);
88
89         /// Vérifications ///
90         void checkAttributes(void);
91
92         /// Destructeur ///
93         virtual ~CAxis(void);
94
95         virtual void parse(xml::CXMLNode & node);
96
97         void setContextClient(CContextClient* contextClient);
98
99         /// Accesseurs statiques ///
100         static StdString GetName(void);
101         static StdString GetDefName(void);
102         static ENodeType GetType(void);
103
104         static bool dispatchEvent(CEventServer& event);         
105         
106         void checkAttributesOnClient();
107         void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid,
108                                                         CServerDistributionDescription::ServerDistributionType distType = CServerDistributionDescription::BAND_DISTRIBUTION);
109         void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
110                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION);
111
112         void checkEligibilityForCompressedOutput();
113         size_t getGlobalWrittenSize(void) ;
114
115         void computeWrittenIndex();
116         void computeWrittenCompressedIndex(MPI_Comm);
117         bool hasTransformation();
118         void solveInheritanceTransformation();
119         TransMapTypes getAllTransformations();         
120         void duplicateTransformation(CAxis*);
121         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
122         bool isEqual(CAxis* axis);
123         bool zoomByIndex();
124
125      public: 
126        bool hasValue;
127        CArray<int,1> localIndexToWriteOnServer;
128
129      private:
130         void checkData();
131         void checkMask();
132         void checkZoom();
133         void checkBounds();
134         void checkLabel();
135         void sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
136                             CServerDistributionDescription::ServerDistributionType distType);
137         void sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid,
138                                        CServerDistributionDescription::ServerDistributionType distType);
139         void computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid,
140                                     CServerDistributionDescription::ServerDistributionType distType);
141
142         void sendNonDistributedAttributes(void);
143         void sendDistributedAttributes(void);
144
145         static void recvNonDistributedAttributes(CEventServer& event);
146         static void recvDistributedAttributes(CEventServer& event);
147         static void recvDistributionAttribute(CEventServer& event);
148         void recvNonDistributedAttributes(int rank, CBufferIn& buffer);
149         void recvDistributedAttributes(vector<int>& rank, vector<CBufferIn*> buffers);
150         void recvDistributionAttribute(CBufferIn& buffer);
151
152         void setTransformations(const TransMapTypes&);
153
154      private:
155
156/** Clients that have to send a domain. There can be multiple clients in case of secondary server, otherwise only one client. */
157         std::list<CContextClient*> clients;
158         std::set<CContextClient*> clientsSet;
159
160         bool isChecked;
161         bool areClientAttributesChecked_;
162         bool isClientAfterTransformationChecked;
163         std::set<StdString> relFiles, relFilesCompressed;
164         TransMapTypes transformationMap_;         
165         //! True if and only if the data defined on the axis can be outputted in a compressed way
166         bool isCompressible_;
167         std::map<int, map<int,int> > nbSenders; // Mapping of number of communicating client to a server
168         std::map<int, boost::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server
169         // std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
170         boost::unordered_map<size_t,size_t> globalLocalIndexMap_;
171         std::vector<int> indexesToWrite;
172         std::map<int,int> numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
173         std::map<int, CArray<int, 1> > compressedIndexToWriteOnServer;
174         std::map<int, std::vector<int> > connectedServerRank_;
175         bool hasBounds;
176         bool hasLabel;         
177         bool computedWrittenIndex_;                 
178
179       private:
180         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
181         static std::map<StdString, ETranformationType> transformationMapList_;
182         static bool dummyTransformationMapList_;
183
184         DECLARE_REF_FUNC(Axis,axis)
185   }; // class CAxis
186
187   ///--------------------------------------------------------------
188
189   // Declare/Define CAxisGroup and CAxisDefinition
190   DECLARE_GROUP(CAxis);
191} // namespace xios
192
193#endif // __XIOS_CAxis__
Note: See TracBrowser for help on using the repository browser.