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

Last change on this file since 553 was 553, checked in by mhnguyen, 9 years ago

Seperating global index computation on client and server side

+) Create a class which do mapping in general manner, between client and server index global
+) Remove some redundant functions and variables
+) Add some comments to code

Test
+) On Curie. Only test_new_features.f90
+) Test passes and results are correct.
+) Need to change index from 1 to 0

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  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
Note: See TracBrowser for help on using the repository browser.