source: XIOS/dev/dev_olga/src/node/axis.hpp @ 1202

Last change on this file since 1202 was 1202, checked in by mhnguyen, 7 years ago

Porting non-continuous axis zoom to dev branch

+) Port axis zoom
+) Resolve some merge conflicts
+) Revert some codes

Test
+) On Curie
+) Ok

  • 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.1 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
55
56      public :
57
58         typedef CAxisAttributes RelAttributes;
59         typedef CAxisGroup      RelGroup;
60         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
61
62      public:
63         /// Constructeurs ///
64         CAxis(void);
65         explicit CAxis(const StdString & id);
66         CAxis(const CAxis & axis);       // Not implemented yet.
67         CAxis(const CAxis * const axis); // Not implemented yet.
68
69         static CAxis* createAxis();
70
71         /// Accesseurs ///
72         const std::set<StdString> & getRelFiles(void) const;
73
74         int getNumberWrittenIndexes() const;
75         int getTotalNumberWrittenIndexes() const;
76         int getOffsetWrittenIndexes() const;
77
78         std::map<int, StdSize> getAttributesBufferSize();
79
80         /// Test ///
81         bool IsWritten(const StdString & filename) const;
82         bool isWrittenCompressed(const StdString& filename) const;
83         bool isDistributed(void) const;
84         bool isCompressible(void) const;
85
86         /// Mutateur ///
87         void addRelFile(const StdString & filename);
88         void addRelFileCompressed(const StdString& filename);
89
90         /// Vérifications ///
91         void checkAttributes(void);
92
93         /// Destructeur ///
94         virtual ~CAxis(void);
95
96         virtual void parse(xml::CXMLNode & node);
97
98         /// Accesseurs statiques ///
99         static StdString GetName(void);
100         static StdString GetDefName(void);
101         static ENodeType GetType(void);
102
103         static bool dispatchEvent(CEventServer& event);
104         static void recvDistributionAttribute(CEventServer& event);
105         void recvDistributionAttribute(CBufferIn& buffer) ;
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
114         void computeWrittenIndex();
115         bool hasTransformation();
116         void solveInheritanceTransformation();
117         TransMapTypes getAllTransformations();         
118         void duplicateTransformation(CAxis*);
119         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
120         bool isEqual(CAxis* axis);
121         bool zoomByIndex();
122
123      public:               
124        CArray<StdString,1> label_srv;
125        bool hasValue;
126        CArray<int,1> globalDimGrid;
127        int orderPosInGrid;
128        CArray<size_t,1> localIndexToWriteOnServer;
129        CArray<int, 1> compressedIndexToWriteOnServer;
130
131      private:
132         void checkData();
133         void checkMask();
134         void checkZoom();
135         void checkBounds();
136         void checkLabel();
137         void sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
138                             CServerDistributionDescription::ServerDistributionType distType);
139         void sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid,
140                                        CServerDistributionDescription::ServerDistributionType distType);
141         void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid,
142                                     CServerDistributionDescription::ServerDistributionType distType);
143
144         void sendNonDistributedAttributes(void);
145         void sendDistributedAttributes(void);
146
147         static void recvNonDistributedAttributes(CEventServer& event);
148         static void recvDistributedAttributes(CEventServer& event);
149         void recvNonDistributedAttributes(int rank, CBufferIn& buffer);
150         void recvDistributedAttributes(vector<int>& rank, vector<CBufferIn*> buffers);
151
152         void setTransformations(const TransMapTypes&);
153
154      private:
155         bool isChecked;
156         bool areClientAttributesChecked_;
157         bool isClientAfterTransformationChecked;
158         std::set<StdString> relFiles, relFilesCompressed;
159         TransMapTypes transformationMap_;         
160         //! True if and only if the data defined on the axis can be outputted in a compressed way
161         bool isCompressible_;
162         std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server
163         boost::unordered_map<int, vector<size_t> > indSrv_; // Global index of each client sent to server
164         std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
165         boost::unordered_map<size_t,size_t> globalLocalIndexMap_;
166         std::vector<int> indexesToWrite;
167         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
168         std::vector<int> connectedServerRank_;
169         std::map<int, CArray<int,1> > indiSrv_;
170         bool hasBounds_;
171         bool hasLabel;         
172         bool computedWrittenIndex_;
173
174       private:
175         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
176         static std::map<StdString, ETranformationType> transformationMapList_;
177         static bool dummyTransformationMapList_;
178
179         DECLARE_REF_FUNC(Axis,axis)
180   }; // class CAxis
181
182   ///--------------------------------------------------------------
183
184   // Declare/Define CAxisGroup and CAxisDefinition
185   DECLARE_GROUP(CAxis);
186} // namespace xios
187
188#endif // __XIOS_CAxis__
Note: See TracBrowser for help on using the repository browser.