source: XIOS/trunk/src/server_distribution_description.hpp @ 554

Last change on this file since 554 was 554, checked in by mhnguyen, 8 years ago

Changing interface of tests to make sure global index begins at zero (0)

+) In all tests, ibegin, jbegin starts at zero (0), so there are some minor changes in field_glo
+) Improve a littel bit class design

Test
+) On Curie,
+) All test passed and results are the same as before

File size: 2.0 KB
Line 
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
16namespace xios
17{
18/*!
19   \class CServerDistributionDescription
20   This class contains information that describe distribution of servers.
21*/
22class 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
45  protected:
46    void computeBandDistribution(int nServer);
47    void computePlanDistribution(int nServer);
48
49  private:
50    std::vector<std::vector<int> > indexBegin_;     //!< Begin index of each dimension
51    std::vector<std::vector<int> > dimensionSizes_; //!< Size of each dimension
52    std::vector<int> nGlobal_; //!< Global size of each dimension
53
54    //!< General case, index describes distribution of each server (rarely use)
55    std::vector<CArray<size_t,1>* > vecGlobalIndex_;
56
57    //!< In case we need only global index of one server with specific rank
58    CArray<size_t,1>* globalIndex_;
59};
60
61} // namespace xios
62#endif // __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP
Note: See TracBrowser for help on using the repository browser.