[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" |
---|
[821] | 31 | # include "axis_attribute_private.conf" |
---|
[219] | 32 | END_DECLARE_ATTRIBUTE_MAP(CAxis) |
---|
| 33 | |
---|
| 34 | ///-------------------------------------------------------------- |
---|
| 35 | |
---|
| 36 | class CAxis |
---|
| 37 | : public CObjectTemplate<CAxis> |
---|
| 38 | , public CAxisAttributes |
---|
| 39 | { |
---|
[567] | 40 | enum EEventId |
---|
| 41 | { |
---|
[633] | 42 | EVENT_ID_SERVER_ATTRIBUT, |
---|
| 43 | EVENT_ID_INDEX, |
---|
| 44 | EVENT_ID_DISTRIBUTED_VALUE, |
---|
| 45 | EVENT_ID_NON_DISTRIBUTED_VALUE |
---|
[567] | 46 | } ; |
---|
| 47 | |
---|
[219] | 48 | /// typedef /// |
---|
| 49 | typedef CObjectTemplate<CAxis> SuperClass; |
---|
| 50 | typedef CAxisAttributes SuperClassAttribute; |
---|
| 51 | |
---|
| 52 | public : |
---|
| 53 | |
---|
| 54 | typedef CAxisAttributes RelAttributes; |
---|
| 55 | typedef CAxisGroup RelGroup; |
---|
[621] | 56 | typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes; |
---|
[219] | 57 | |
---|
[621] | 58 | public: |
---|
[219] | 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 | |
---|
[622] | 65 | static CAxis* createAxis(); |
---|
| 66 | |
---|
[219] | 67 | /// Accesseurs /// |
---|
| 68 | const std::set<StdString> & getRelFiles(void) const; |
---|
| 69 | |
---|
[676] | 70 | const std::vector<int>& getIndexesToWrite(void) const; |
---|
| 71 | int getNumberWrittenIndexes() const; |
---|
| 72 | int getTotalNumberWrittenIndexes() const; |
---|
| 73 | int getOffsetWrittenIndexes() const; |
---|
| 74 | |
---|
[731] | 75 | std::map<int, StdSize> getAttributesBufferSize(); |
---|
| 76 | |
---|
[219] | 77 | /// Test /// |
---|
| 78 | bool IsWritten(const StdString & filename) const; |
---|
[676] | 79 | bool isWrittenCompressed(const StdString& filename) const; |
---|
[594] | 80 | bool isDistributed(void) const; |
---|
[676] | 81 | bool isCompressible(void) const; |
---|
[219] | 82 | |
---|
| 83 | /// Mutateur /// |
---|
| 84 | void addRelFile(const StdString & filename); |
---|
[676] | 85 | void addRelFileCompressed(const StdString& filename); |
---|
[219] | 86 | |
---|
| 87 | /// Vérifications /// |
---|
| 88 | void checkAttributes(void); |
---|
| 89 | |
---|
| 90 | /// Destructeur /// |
---|
| 91 | virtual ~CAxis(void); |
---|
| 92 | |
---|
[619] | 93 | virtual void parse(xml::CXMLNode & node); |
---|
| 94 | |
---|
[219] | 95 | /// Accesseurs statiques /// |
---|
| 96 | static StdString GetName(void); |
---|
| 97 | static StdString GetDefName(void); |
---|
| 98 | static ENodeType GetType(void); |
---|
| 99 | |
---|
[595] | 100 | void sendServerAttribut(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 101 | CServerDistributionDescription::ServerDistributionType distType); |
---|
[567] | 102 | static bool dispatchEvent(CEventServer& event); |
---|
| 103 | static void recvServerAttribut(CEventServer& event); |
---|
| 104 | void recvServerAttribut(CBufferIn& buffer) ; |
---|
[742] | 105 | void checkAttributesOnClient(); |
---|
[567] | 106 | void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 107 | CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); |
---|
[619] | 108 | |
---|
[676] | 109 | void checkEligibilityForCompressedOutput(); |
---|
| 110 | |
---|
[619] | 111 | bool hasTransformation(); |
---|
| 112 | void solveInheritanceTransformation(); |
---|
[621] | 113 | TransMapTypes getAllTransformations(); |
---|
[775] | 114 | void fillInValues(const CArray<double,1>& values); |
---|
[836] | 115 | void duplicateTransformation(CAxis*); |
---|
| 116 | CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id=""); |
---|
[619] | 117 | |
---|
[567] | 118 | public: |
---|
| 119 | int zoom_begin_srv, zoom_end_srv, zoom_size_srv; |
---|
| 120 | int ni_srv, begin_srv, end_srv; |
---|
[633] | 121 | CArray<double,1> value_srv; |
---|
| 122 | CArray<double,2> bound_srv; |
---|
[816] | 123 | bool hasValue; |
---|
[676] | 124 | |
---|
| 125 | private: |
---|
[551] | 126 | void checkData(); |
---|
| 127 | void checkMask(); |
---|
[631] | 128 | void checkZoom(); |
---|
[633] | 129 | void checkBounds(); |
---|
[621] | 130 | void checkTransformations(); |
---|
| 131 | void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 132 | CServerDistributionDescription::ServerDistributionType disType); |
---|
[815] | 133 | void sendValue(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 134 | CServerDistributionDescription::ServerDistributionType distType); |
---|
| 135 | void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid, |
---|
| 136 | CServerDistributionDescription::ServerDistributionType distType); |
---|
[633] | 137 | void sendDistributedValue(); |
---|
| 138 | void sendNonDistributedValue(); |
---|
[595] | 139 | |
---|
[633] | 140 | static void recvIndex(CEventServer& event); |
---|
| 141 | static void recvDistributedValue(CEventServer& event); |
---|
| 142 | static void recvNonDistributedValue(CEventServer& event); |
---|
| 143 | void recvIndex(int rank, CBufferIn& buffer); |
---|
| 144 | void recvDistributedValue(int rank, CBufferIn& buffer); |
---|
| 145 | void recvNonDistributedValue(int rank, CBufferIn& buffer); |
---|
[619] | 146 | |
---|
[621] | 147 | void setTransformations(const TransMapTypes&); |
---|
[676] | 148 | |
---|
[567] | 149 | private: |
---|
[219] | 150 | bool isChecked; |
---|
[567] | 151 | bool areClientAttributesChecked_; |
---|
[676] | 152 | std::set<StdString> relFiles, relFilesCompressed; |
---|
[621] | 153 | TransMapTypes transformationMap_; |
---|
[594] | 154 | bool isDistributed_; |
---|
[676] | 155 | //! True if and only if the data defined on the axis can be outputted in a compressed way |
---|
| 156 | bool isCompressible_; |
---|
[633] | 157 | std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server |
---|
| 158 | std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server |
---|
[676] | 159 | std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server |
---|
| 160 | std::vector<int> indexesToWrite; |
---|
| 161 | int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; |
---|
[633] | 162 | std::vector<int> connectedServerRank_; |
---|
| 163 | std::map<int, CArray<int,1> > indiSrv_; |
---|
| 164 | bool hasBounds_; |
---|
[836] | 165 | |
---|
| 166 | private: |
---|
| 167 | static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); |
---|
| 168 | static std::map<StdString, ETranformationType> transformationMapList_; |
---|
| 169 | static bool dummyTransformationMapList_; |
---|
| 170 | |
---|
[540] | 171 | DECLARE_REF_FUNC(Axis,axis) |
---|
[219] | 172 | }; // class CAxis |
---|
| 173 | |
---|
| 174 | ///-------------------------------------------------------------- |
---|
| 175 | |
---|
| 176 | // Declare/Define CAxisGroup and CAxisDefinition |
---|
| 177 | DECLARE_GROUP(CAxis); |
---|
[335] | 178 | } // namespace xios |
---|
[219] | 179 | |
---|
[591] | 180 | #endif // __XIOS_CAxis__ |
---|