[591] | 1 | #ifndef __XIOS_CAxis__ |
---|
| 2 | #define __XIOS_CAxis__ |
---|
[219] | 3 | |
---|
[591] | 4 | /// XIOS headers /// |
---|
| 5 | #include "xios_spl.hpp" |
---|
[219] | 6 | #include "group_factory.hpp" |
---|
[619] | 7 | #include "virtual_node.hpp" |
---|
[219] | 8 | |
---|
| 9 | #include "declare_group.hpp" |
---|
[540] | 10 | #include "declare_ref_func.hpp" |
---|
[619] | 11 | #include "declare_virtual_node.hpp" |
---|
[369] | 12 | #include "attribute_array.hpp" |
---|
[399] | 13 | #include "attribute_enum.hpp" |
---|
| 14 | #include "attribute_enum_impl.hpp" |
---|
[567] | 15 | #include "server_distribution_description.hpp" |
---|
[619] | 16 | #include "transformation.hpp" |
---|
| 17 | #include "transformation_enum.hpp" |
---|
[219] | 18 | |
---|
[335] | 19 | namespace xios { |
---|
[219] | 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) |
---|
[231] | 30 | # include "axis_attribute.conf" |
---|
[219] | 31 | END_DECLARE_ATTRIBUTE_MAP(CAxis) |
---|
| 32 | |
---|
| 33 | ///-------------------------------------------------------------- |
---|
| 34 | |
---|
| 35 | class CAxis |
---|
| 36 | : public CObjectTemplate<CAxis> |
---|
| 37 | , public CAxisAttributes |
---|
| 38 | { |
---|
[567] | 39 | enum EEventId |
---|
| 40 | { |
---|
[633] | 41 | EVENT_ID_SERVER_ATTRIBUT, |
---|
| 42 | EVENT_ID_INDEX, |
---|
| 43 | EVENT_ID_DISTRIBUTED_VALUE, |
---|
| 44 | EVENT_ID_NON_DISTRIBUTED_VALUE |
---|
[567] | 45 | } ; |
---|
| 46 | |
---|
[219] | 47 | /// typedef /// |
---|
| 48 | typedef CObjectTemplate<CAxis> SuperClass; |
---|
| 49 | typedef CAxisAttributes SuperClassAttribute; |
---|
| 50 | |
---|
| 51 | public : |
---|
| 52 | |
---|
| 53 | typedef CAxisAttributes RelAttributes; |
---|
| 54 | typedef CAxisGroup RelGroup; |
---|
[621] | 55 | typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes; |
---|
[219] | 56 | |
---|
[621] | 57 | public: |
---|
[219] | 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 | |
---|
[622] | 64 | static CAxis* createAxis(); |
---|
| 65 | |
---|
[219] | 66 | /// Accesseurs /// |
---|
| 67 | const std::set<StdString> & getRelFiles(void) const; |
---|
| 68 | |
---|
[676] | 69 | const std::vector<int>& getIndexesToWrite(void) const; |
---|
| 70 | int getNumberWrittenIndexes() const; |
---|
| 71 | int getTotalNumberWrittenIndexes() const; |
---|
| 72 | int getOffsetWrittenIndexes() const; |
---|
| 73 | |
---|
[219] | 74 | /// Test /// |
---|
| 75 | bool IsWritten(const StdString & filename) const; |
---|
[676] | 76 | bool isWrittenCompressed(const StdString& filename) const; |
---|
[594] | 77 | bool isDistributed(void) const; |
---|
[676] | 78 | bool isCompressible(void) const; |
---|
[219] | 79 | |
---|
| 80 | /// Mutateur /// |
---|
| 81 | void addRelFile(const StdString & filename); |
---|
[676] | 82 | void addRelFileCompressed(const StdString& filename); |
---|
[219] | 83 | |
---|
| 84 | /// Vérifications /// |
---|
| 85 | void checkAttributes(void); |
---|
| 86 | |
---|
| 87 | /// Destructeur /// |
---|
| 88 | virtual ~CAxis(void); |
---|
| 89 | |
---|
[619] | 90 | virtual void parse(xml::CXMLNode & node); |
---|
| 91 | |
---|
[219] | 92 | /// Accesseurs statiques /// |
---|
| 93 | static StdString GetName(void); |
---|
| 94 | static StdString GetDefName(void); |
---|
| 95 | static ENodeType GetType(void); |
---|
| 96 | |
---|
[595] | 97 | void sendServerAttribut(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 98 | CServerDistributionDescription::ServerDistributionType distType); |
---|
[567] | 99 | static bool dispatchEvent(CEventServer& event); |
---|
| 100 | static void recvServerAttribut(CEventServer& event); |
---|
| 101 | void recvServerAttribut(CBufferIn& buffer) ; |
---|
| 102 | void checkAttributesOnClient(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 103 | CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); |
---|
| 104 | void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 105 | CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); |
---|
[619] | 106 | |
---|
[676] | 107 | void checkEligibilityForCompressedOutput(); |
---|
| 108 | |
---|
[619] | 109 | bool hasTransformation(); |
---|
| 110 | void solveInheritanceTransformation(); |
---|
[621] | 111 | TransMapTypes getAllTransformations(); |
---|
[619] | 112 | |
---|
[567] | 113 | public: |
---|
| 114 | int zoom_begin_srv, zoom_end_srv, zoom_size_srv; |
---|
| 115 | int ni_srv, begin_srv, end_srv; |
---|
[623] | 116 | int global_zoom_begin, global_zoom_size; // The real global zoom begin and zoom size after axis is transformed (zoomed) |
---|
[633] | 117 | CArray<double,1> value_srv; |
---|
| 118 | CArray<double,2> bound_srv; |
---|
[676] | 119 | |
---|
| 120 | private: |
---|
[551] | 121 | void checkData(); |
---|
| 122 | void checkMask(); |
---|
[631] | 123 | void checkZoom(); |
---|
[633] | 124 | void checkBounds(); |
---|
[621] | 125 | void checkTransformations(); |
---|
| 126 | void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 127 | CServerDistributionDescription::ServerDistributionType disType); |
---|
[633] | 128 | void sendValue(); |
---|
| 129 | void computeConnectedServer(void); |
---|
| 130 | void sendDistributedValue(); |
---|
| 131 | void sendNonDistributedValue(); |
---|
[595] | 132 | |
---|
[633] | 133 | static void recvIndex(CEventServer& event); |
---|
| 134 | static void recvDistributedValue(CEventServer& event); |
---|
| 135 | static void recvNonDistributedValue(CEventServer& event); |
---|
| 136 | void recvIndex(int rank, CBufferIn& buffer); |
---|
| 137 | void recvDistributedValue(int rank, CBufferIn& buffer); |
---|
| 138 | void recvNonDistributedValue(int rank, CBufferIn& buffer); |
---|
[619] | 139 | |
---|
[621] | 140 | void setTransformations(const TransMapTypes&); |
---|
[676] | 141 | |
---|
[567] | 142 | private: |
---|
[219] | 143 | bool isChecked; |
---|
[567] | 144 | bool areClientAttributesChecked_; |
---|
[676] | 145 | std::set<StdString> relFiles, relFilesCompressed; |
---|
[621] | 146 | TransMapTypes transformationMap_; |
---|
[594] | 147 | bool isDistributed_; |
---|
[676] | 148 | //! True if and only if the data defined on the axis can be outputted in a compressed way |
---|
| 149 | bool isCompressible_; |
---|
[633] | 150 | std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server |
---|
| 151 | std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server |
---|
[676] | 152 | std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server |
---|
| 153 | std::vector<int> indexesToWrite; |
---|
| 154 | int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; |
---|
[633] | 155 | std::vector<int> connectedServerRank_; |
---|
| 156 | std::map<int, CArray<int,1> > indiSrv_; |
---|
| 157 | bool hasBounds_; |
---|
[540] | 158 | DECLARE_REF_FUNC(Axis,axis) |
---|
[219] | 159 | }; // class CAxis |
---|
| 160 | |
---|
| 161 | ///-------------------------------------------------------------- |
---|
| 162 | |
---|
| 163 | // Declare/Define CAxisGroup and CAxisDefinition |
---|
| 164 | DECLARE_GROUP(CAxis); |
---|
[335] | 165 | } // namespace xios |
---|
[219] | 166 | |
---|
[591] | 167 | #endif // __XIOS_CAxis__ |
---|