source: XIOS/dev/dev_olga/src/distribution_server.hpp @ 1132

Last change on this file since 1132 was 1099, checked in by mhnguyen, 7 years ago

Updating 2-level server

+) Make some changes in the way data rebuilt on each level of server
+) Make some changes in the order of functions call during close context to make sure that each server receives the global indexes before calculating index to send to next level
+) Modify some functions to make sure data sent to the correct server pool

Test
+) On Curie
+) Only test_client

File size: 2.4 KB
Line 
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
15namespace xios {
16
17/*!
18  \class CDistributionServer
19  The class, for now, plays a role of computing local index for writing data on server
20*/
21class 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>& 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);
32    CDistributionServer(int rank, 
33                        const std::vector<CArray<int,1> >& globalIndexEachDimension,
34                        const std::vector<int>& nGlobal);
35
36    /** Default destructor */
37    virtual ~CDistributionServer();
38
39    const std::vector<int>& getZoomBeginGlobal() const;
40    const std::vector<int>& getZoomBeginServer() const;
41    const std::vector<int>& getZoomSizeServer() const;
42    const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; }
43    const std::vector<CArray<int,1> >& getGlobalIndexEachDimension() const {return globalIndexEachDimension_;}
44    int getGridSize() const;
45
46    virtual CArray<size_t,1> computeLocalIndex(const CArray<size_t,1>& globalIndex);
47    virtual void computeLocalIndex(CArray<size_t,1>& globalIndex);
48    virtual void computeGlobalIndex(CArray<int,1>& indexes) const;
49
50  protected:
51    virtual void createGlobalIndex();
52
53    void createGlobalIndexFromIndex(const std::vector<CArray<int,1> >& globalIndexOnEachDimension,
54                                    const std::vector<int>& nbGlobal);
55
56  protected:
57    GlobalLocalMap globalLocalIndexMap_;
58
59  private:
60    std::vector<int> nGlobal_;
61    std::vector<int> nZoomBeginGlobal_;
62    std::vector<int> nZoomSize_;
63    std::vector<int> nZoomBegin_;
64    std::vector<CArray<int, 1> > globalIndexEachDimension_;
65
66};
67
68} // namespace xios
69#endif // __XIOS_DISTRIBUTION_SERVER_HPP__
Note: See TracBrowser for help on using the repository browser.