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 | |
---|
19 | namespace 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 | END_DECLARE_ATTRIBUTE_MAP(CAxis) |
---|
32 | |
---|
33 | ///-------------------------------------------------------------- |
---|
34 | |
---|
35 | class CAxis |
---|
36 | : public CObjectTemplate<CAxis> |
---|
37 | , public CAxisAttributes |
---|
38 | { |
---|
39 | enum EEventId |
---|
40 | { |
---|
41 | EVENT_ID_SERVER_ATTRIBUT, |
---|
42 | EVENT_ID_INDEX, |
---|
43 | EVENT_ID_DISTRIBUTED_VALUE, |
---|
44 | EVENT_ID_NON_DISTRIBUTED_VALUE |
---|
45 | } ; |
---|
46 | |
---|
47 | /// typedef /// |
---|
48 | typedef CObjectTemplate<CAxis> SuperClass; |
---|
49 | typedef CAxisAttributes SuperClassAttribute; |
---|
50 | |
---|
51 | public : |
---|
52 | |
---|
53 | typedef CAxisAttributes RelAttributes; |
---|
54 | typedef CAxisGroup RelGroup; |
---|
55 | typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes; |
---|
56 | |
---|
57 | public: |
---|
58 | /// Constructeurs /// |
---|
59 | CAxis(void); |
---|
60 | explicit CAxis(const StdString & id); |
---|
61 | CAxis(const CAxis & axis); // Not implemented yet. |
---|
62 | CAxis(const CAxis * const axis); // Not implemented yet. |
---|
63 | |
---|
64 | static CAxis* createAxis(); |
---|
65 | |
---|
66 | /// Accesseurs /// |
---|
67 | const std::set<StdString> & getRelFiles(void) const; |
---|
68 | |
---|
69 | /// Test /// |
---|
70 | bool IsWritten(const StdString & filename) const; |
---|
71 | bool isDistributed(void) const; |
---|
72 | |
---|
73 | /// Mutateur /// |
---|
74 | void addRelFile(const StdString & filename); |
---|
75 | |
---|
76 | /// Vérifications /// |
---|
77 | void checkAttributes(void); |
---|
78 | |
---|
79 | /// Destructeur /// |
---|
80 | virtual ~CAxis(void); |
---|
81 | |
---|
82 | virtual void parse(xml::CXMLNode & node); |
---|
83 | |
---|
84 | /// Accesseurs statiques /// |
---|
85 | static StdString GetName(void); |
---|
86 | static StdString GetDefName(void); |
---|
87 | static ENodeType GetType(void); |
---|
88 | |
---|
89 | void sendServerAttribut(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
90 | CServerDistributionDescription::ServerDistributionType distType); |
---|
91 | static bool dispatchEvent(CEventServer& event); |
---|
92 | static void recvServerAttribut(CEventServer& event); |
---|
93 | void recvServerAttribut(CBufferIn& buffer) ; |
---|
94 | void checkAttributesOnClient(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
95 | CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); |
---|
96 | void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
97 | CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); |
---|
98 | |
---|
99 | bool hasTransformation(); |
---|
100 | void solveInheritanceTransformation(); |
---|
101 | TransMapTypes getAllTransformations(); |
---|
102 | |
---|
103 | public: |
---|
104 | int zoom_begin_srv, zoom_end_srv, zoom_size_srv; |
---|
105 | int ni_srv, begin_srv, end_srv; |
---|
106 | int global_zoom_begin, global_zoom_size; // The real global zoom begin and zoom size after axis is transformed (zoomed) |
---|
107 | CArray<double,1> value_srv; |
---|
108 | CArray<double,2> bound_srv; |
---|
109 | private : |
---|
110 | void checkData(); |
---|
111 | void checkMask(); |
---|
112 | void checkZoom(); |
---|
113 | void checkBounds(); |
---|
114 | void checkTransformations(); |
---|
115 | void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
116 | CServerDistributionDescription::ServerDistributionType disType); |
---|
117 | void sendValue(); |
---|
118 | void computeConnectedServer(void); |
---|
119 | void sendDistributedValue(); |
---|
120 | void sendNonDistributedValue(); |
---|
121 | |
---|
122 | static void recvIndex(CEventServer& event); |
---|
123 | static void recvDistributedValue(CEventServer& event); |
---|
124 | static void recvNonDistributedValue(CEventServer& event); |
---|
125 | void recvIndex(int rank, CBufferIn& buffer); |
---|
126 | void recvDistributedValue(int rank, CBufferIn& buffer); |
---|
127 | void recvNonDistributedValue(int rank, CBufferIn& buffer); |
---|
128 | |
---|
129 | void setTransformations(const TransMapTypes&); |
---|
130 | private: |
---|
131 | bool isChecked; |
---|
132 | bool areClientAttributesChecked_; |
---|
133 | std::set<StdString> relFiles; |
---|
134 | TransMapTypes transformationMap_; |
---|
135 | bool isDistributed_; |
---|
136 | std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server |
---|
137 | std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server |
---|
138 | std::vector<int> connectedServerRank_; |
---|
139 | std::map<int, CArray<int,1> > indiSrv_; |
---|
140 | bool hasBounds_; |
---|
141 | DECLARE_REF_FUNC(Axis,axis) |
---|
142 | }; // class CAxis |
---|
143 | |
---|
144 | ///-------------------------------------------------------------- |
---|
145 | |
---|
146 | // Declare/Define CAxisGroup and CAxisDefinition |
---|
147 | DECLARE_GROUP(CAxis); |
---|
148 | } // namespace xios |
---|
149 | |
---|
150 | #endif // __XIOS_CAxis__ |
---|