1 | /*! |
---|
2 | \file server_distribution_description.hpp |
---|
3 | \author Ha NGUYEN |
---|
4 | \since 04 Jan 2015 |
---|
5 | \date 09 Feb 2015 |
---|
6 | |
---|
7 | \brief Description of index distribution on server(s). |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP |
---|
11 | #define __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP |
---|
12 | |
---|
13 | #include "xmlioserver_spl.hpp" |
---|
14 | #include "array_new.hpp" |
---|
15 | |
---|
16 | namespace xios |
---|
17 | { |
---|
18 | /*! |
---|
19 | \class CServerDistributionDescription |
---|
20 | This class contains information that describe distribution of servers. |
---|
21 | */ |
---|
22 | class CServerDistributionDescription |
---|
23 | { |
---|
24 | public: |
---|
25 | enum ServerDistributionType |
---|
26 | { |
---|
27 | BAND_DISTRIBUTION, PLAN_DISTRIBUTION |
---|
28 | }; |
---|
29 | |
---|
30 | /** Default constructor */ |
---|
31 | CServerDistributionDescription(const std::vector<int>& globalDimensionSize); |
---|
32 | /** Default destructor */ |
---|
33 | virtual ~CServerDistributionDescription(); |
---|
34 | |
---|
35 | void computeServerDistribution(int nServer, bool doComputeGlobalIndex = false, |
---|
36 | ServerDistributionType type = BAND_DISTRIBUTION); |
---|
37 | |
---|
38 | const CArray<size_t,1>& computeServerGlobalIndex(int nServer, int serverRank, |
---|
39 | ServerDistributionType = BAND_DISTRIBUTION); |
---|
40 | |
---|
41 | std::vector<std::vector<int> > getServerIndexBegin() const; |
---|
42 | std::vector<std::vector<int> > getServerDimensionSizes() const; |
---|
43 | const std::vector<CArray<size_t,1>* >& getGlobalIndex() const; |
---|
44 | protected: |
---|
45 | void computeBandDistribution(int nServer); |
---|
46 | void computePlanDistribution(int nServer); |
---|
47 | |
---|
48 | private: |
---|
49 | std::vector<std::vector<int> > indexBegin_; //!< Begin index of each dimension |
---|
50 | std::vector<std::vector<int> > dimensionSizes_; //!< Size of each dimension |
---|
51 | std::vector<int> nGlobal_; //!< Global size of each dimension |
---|
52 | |
---|
53 | //!< General case, index describes distribution of each server (rarely use) |
---|
54 | std::vector<CArray<size_t,1>* > vecGlobalIndex_; |
---|
55 | |
---|
56 | //!< In case we need only global index of one server with specific rank |
---|
57 | CArray<size_t,1>* globalIndex_; |
---|
58 | }; |
---|
59 | |
---|
60 | } // namespace xios |
---|
61 | #endif // __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP |
---|