[553] | 1 | /*! |
---|
| 2 | \file distribution_server.hpp |
---|
| 3 | \author Ha NGUYEN |
---|
| 4 | \since 13 Jan 2015 |
---|
| 5 | \date 04 Feb 2015 |
---|
| 6 | |
---|
| 7 | \brief Index distribution on server side. |
---|
| 8 | */ |
---|
| 9 | |
---|
[551] | 10 | #ifndef __XIOS_DISTRIBUTION_SERVER_HPP__ |
---|
| 11 | #define __XIOS_DISTRIBUTION_SERVER_HPP__ |
---|
| 12 | |
---|
| 13 | #include "distribution.hpp" |
---|
| 14 | |
---|
| 15 | namespace xios { |
---|
[553] | 16 | |
---|
[552] | 17 | /*! |
---|
[553] | 18 | \class CDistributionServer |
---|
| 19 | The class, for now, plays a role of computing local index for writing data on server |
---|
[552] | 20 | */ |
---|
[551] | 21 | class CDistributionServer : public CDistribution |
---|
| 22 | { |
---|
| 23 | public: |
---|
| 24 | /** Default constructor */ |
---|
[653] | 25 | CDistributionServer(int rank, int dims, const CArray<size_t,1>& globalIndex = CArray<size_t,1>()); |
---|
[567] | 26 | CDistributionServer(int rank, const std::vector<int>& nZoomBeginServer, |
---|
| 27 | const std::vector<int>& nZoomSizeServer, const std::vector<int>& nGlobal); |
---|
| 28 | CDistributionServer(int rank, const std::vector<int>& nZoomBeginServer, |
---|
| 29 | const std::vector<int>& nZoomSizeServer, |
---|
| 30 | const std::vector<int>& nZoomBeginGlobal, |
---|
| 31 | const std::vector<int>& nGlobal); |
---|
[1025] | 32 | CDistributionServer(int rank, |
---|
| 33 | const std::vector<CArray<int,1> >& globalIndexEachDimension, |
---|
| 34 | const std::vector<int>& nGlobal); |
---|
[551] | 35 | |
---|
| 36 | /** Default destructor */ |
---|
| 37 | virtual ~CDistributionServer(); |
---|
| 38 | |
---|
[676] | 39 | const std::vector<int>& getZoomBeginGlobal() const; |
---|
| 40 | const std::vector<int>& getZoomBeginServer() const; |
---|
| 41 | const std::vector<int>& getZoomSizeServer() const; |
---|
[983] | 42 | const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; } |
---|
[1054] | 43 | const std::vector<CArray<int,1> >& getGlobalIndexEachDimension() const {return globalIndexEachDimension_;} |
---|
[1099] | 44 | int getGridSize() const; |
---|
[567] | 45 | |
---|
[554] | 46 | virtual CArray<size_t,1> computeLocalIndex(const CArray<size_t,1>& globalIndex); |
---|
| 47 | virtual void computeLocalIndex(CArray<size_t,1>& globalIndex); |
---|
[676] | 48 | virtual void computeGlobalIndex(CArray<int,1>& indexes) const; |
---|
[552] | 49 | |
---|
[551] | 50 | protected: |
---|
| 51 | virtual void createGlobalIndex(); |
---|
[930] | 52 | |
---|
[1025] | 53 | void createGlobalIndexFromIndex(const std::vector<CArray<int,1> >& globalIndexOnEachDimension, |
---|
| 54 | const std::vector<int>& nbGlobal); |
---|
| 55 | |
---|
[930] | 56 | protected: |
---|
| 57 | GlobalLocalMap globalLocalIndexMap_; |
---|
| 58 | |
---|
[551] | 59 | private: |
---|
| 60 | std::vector<int> nGlobal_; |
---|
[567] | 61 | std::vector<int> nZoomBeginGlobal_; |
---|
[552] | 62 | std::vector<int> nZoomSize_; |
---|
| 63 | std::vector<int> nZoomBegin_; |
---|
[1025] | 64 | std::vector<CArray<int, 1> > globalIndexEachDimension_; |
---|
[567] | 65 | |
---|
[551] | 66 | }; |
---|
| 67 | |
---|
[552] | 68 | } // namespace xios |
---|
[551] | 69 | #endif // __XIOS_DISTRIBUTION_SERVER_HPP__ |
---|