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 | |
---|
10 | #ifndef __XIOS_DISTRIBUTION_SERVER_HPP__ |
---|
11 | #define __XIOS_DISTRIBUTION_SERVER_HPP__ |
---|
12 | |
---|
13 | #include "distribution.hpp" |
---|
14 | |
---|
15 | namespace xios { |
---|
16 | |
---|
17 | /*! |
---|
18 | \class CDistributionServer |
---|
19 | The class, for now, plays a role of computing local index for writing data on server |
---|
20 | */ |
---|
21 | class CDistributionServer : public CDistribution |
---|
22 | { |
---|
23 | public: |
---|
24 | /** Default constructor */ |
---|
25 | CDistributionServer(int rank, int dims, const CArray<size_t,1>& globalIndex = CArray<size_t,1>()); |
---|
26 | CDistributionServer(int rank, const std::vector<int>& nBeginServer, |
---|
27 | const std::vector<int>& nSizeServer, const std::vector<int>& nGlobal); |
---|
28 | CDistributionServer(int rank, const std::vector<int>& nBeginServer, |
---|
29 | const std::vector<int>& nSizeServer, |
---|
30 | const std::vector<int>& nBeginGlobal, |
---|
31 | const std::vector<int>& nGlobal); |
---|
32 | |
---|
33 | CDistributionServer(int rank, |
---|
34 | const std::vector<CArray<int,1> >& globalIndexElements, |
---|
35 | const CArray<int,1>& elementOrder, |
---|
36 | const std::vector<int>& nBeginServer, |
---|
37 | const std::vector<int>& nSizeServer, |
---|
38 | const std::vector<int>& nBeginGlobal, |
---|
39 | const std::vector<int>& nGlobal); |
---|
40 | |
---|
41 | /** Default destructor */ |
---|
42 | virtual ~CDistributionServer(); |
---|
43 | |
---|
44 | const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; } |
---|
45 | int getGridSize() const; |
---|
46 | |
---|
47 | virtual void computeLocalIndex(CArray<size_t,1>& globalIndex); |
---|
48 | virtual void computeGlobalIndex(CArray<int,1>& indexes) const; |
---|
49 | virtual void partialClear(void); //! clear heavy sized attibutes |
---|
50 | |
---|
51 | protected: |
---|
52 | virtual void createGlobalIndex(); |
---|
53 | void createGlobalIndex(const std::vector<CArray<int,1> >& globalIndexElements, |
---|
54 | const CArray<int,1>& elementOrder); |
---|
55 | |
---|
56 | protected: |
---|
57 | GlobalLocalMap globalLocalIndexMap_; |
---|
58 | |
---|
59 | private: |
---|
60 | std::vector<int> nGlobal_; |
---|
61 | std::vector<int> nBeginGlobal_; |
---|
62 | std::vector<int> nSize_; |
---|
63 | std::vector<int> nBegin_; |
---|
64 | |
---|
65 | }; |
---|
66 | |
---|
67 | } // namespace xios |
---|
68 | #endif // __XIOS_DISTRIBUTION_SERVER_HPP__ |
---|