source: XIOS/trunk/src/node/axis.hpp @ 1169

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

Non-continuous zoom on axis
Zoomed points are defined by array index of zoom_axis

+) Update axis with new type of zoom

Test
+) On Curie
+) Work
+) Update test_complete with this new zoom.

  • 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: 6.9 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         enum EEventId
41         {
42           EVENT_ID_SERVER_ATTRIBUT,
43           EVENT_ID_INDEX,
44           EVENT_ID_DISTRIBUTED_VALUE,
45           EVENT_ID_NON_DISTRIBUTED_VALUE
46         } ;
47
48         /// typedef ///
49         typedef CObjectTemplate<CAxis>   SuperClass;
50         typedef CAxisAttributes SuperClassAttribute;
51
52      public :
53
54         typedef CAxisAttributes RelAttributes;
55         typedef CAxisGroup      RelGroup;
56         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
57
58      public:
59         /// Constructeurs ///
60         CAxis(void);
61         explicit CAxis(const StdString & id);
62         CAxis(const CAxis & axis);       // Not implemented yet.
63         CAxis(const CAxis * const axis); // Not implemented yet.
64
65         static CAxis* createAxis();
66
67         /// Accesseurs ///
68         const std::set<StdString> & getRelFiles(void) const;
69
70         const std::vector<int>& getIndexesToWrite(void) const;
71         int getNumberWrittenIndexes() const;
72         int getTotalNumberWrittenIndexes() const;
73         int getOffsetWrittenIndexes() const;
74
75         std::map<int, StdSize> getAttributesBufferSize();
76
77         /// Test ///
78         bool IsWritten(const StdString & filename) const;
79         bool isWrittenCompressed(const StdString& filename) const;
80         bool isDistributed(void) const;
81         bool isCompressible(void) const;
82
83         /// Mutateur ///
84         void addRelFile(const StdString & filename);
85         void addRelFileCompressed(const StdString& filename);
86
87         /// Vérifications ///
88         void checkAttributes(void);
89
90         /// Destructeur ///
91         virtual ~CAxis(void);
92
93         virtual void parse(xml::CXMLNode & node);
94
95         /// Accesseurs statiques ///
96         static StdString GetName(void);
97         static StdString GetDefName(void);
98         static ENodeType GetType(void);
99
100         void sendServerAttribut(const std::vector<int>& globalDim, int orderPositionInGrid,
101                                 CServerDistributionDescription::ServerDistributionType distType);
102         static bool dispatchEvent(CEventServer& event);
103         static void recvServerAttribut(CEventServer& event);
104         void recvServerAttribut(CBufferIn& buffer) ;
105         void checkAttributesOnClient();
106         void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid,
107                                                         CServerDistributionDescription::ServerDistributionType distType = CServerDistributionDescription::BAND_DISTRIBUTION);
108         void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
109                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION);
110
111         void checkEligibilityForCompressedOutput();
112
113         bool hasTransformation();
114         void solveInheritanceTransformation();
115         TransMapTypes getAllTransformations();
116         void fillInValues(const CArray<double,1>& values);
117         void duplicateTransformation(CAxis*);
118         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
119         bool isEqual(CAxis* axis);
120
121      public:
122        int zoom_begin_srv, zoom_end_srv, zoom_size_srv;
123        int ni_srv, begin_srv, end_srv;
124        int global_zoom_begin_srv, global_zoom_end_srv, global_zoom_size_srv;
125        CArray<double,1> value_srv;
126        CArray<double,2> bound_srv;
127        CArray<StdString,1> label_srv;
128        CArray<int,1> zoom_index_srv;
129        bool hasValue;
130
131      private:
132         void checkData();
133         void checkMask();
134         void checkZoom();
135         void checkBounds();
136         void checkLabel();         
137         void sendValue();
138         void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid,
139                                     CServerDistributionDescription::ServerDistributionType distType);
140         void sendDistributedValue();
141         void sendNonDistributedValue();
142         bool zoomByIndex();
143
144         static void recvIndex(CEventServer& event);
145         static void recvDistributedValue(CEventServer& event);
146         static void recvNonDistributedValue(CEventServer& event);
147         void recvIndex(int rank, CBufferIn& buffer);
148         void recvDistributedValue(int rank, CBufferIn& buffer);
149         void recvNonDistributedValue(int rank, CBufferIn& buffer);
150
151         void setTransformations(const TransMapTypes&);
152
153      private:
154         bool isChecked;
155         bool areClientAttributesChecked_;
156         bool isClientAfterTransformationChecked;
157         std::set<StdString> relFiles, relFilesCompressed;
158         TransMapTypes transformationMap_;
159         bool isDistributed_;
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         std::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         std::vector<int> indexesToWrite;
166         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
167         std::vector<int> connectedServerRank_;
168         std::map<int, CArray<int,1> > indiSrv_;
169         bool hasBounds_;
170         bool hasLabel;
171
172       private:
173         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
174         static std::map<StdString, ETranformationType> transformationMapList_;
175         static bool dummyTransformationMapList_;
176
177         DECLARE_REF_FUNC(Axis,axis)
178   }; // class CAxis
179
180   ///--------------------------------------------------------------
181
182   // Declare/Define CAxisGroup and CAxisDefinition
183   DECLARE_GROUP(CAxis);
184} // namespace xios
185
186#endif // __XIOS_CAxis__
Note: See TracBrowser for help on using the repository browser.