source: XIOS/trunk/src/client_server_mapping.hpp @ 567

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

Implementing a grid formed by only one axis or group of axis

+) Add several new attributes to axis. From now on, each axis can be distributed on client side
+) Modify mask of grid to make it more flexible to different dimension
+) Fix some bugs relating to calculation of local data index on client
+) Clean some redundant codes

Test
+) On Curie, only test_new_features.f90
+) Test cases:

  • Grid composed of: 1 domain and 1 axis, 3 axis, 1 axis
  • Mode: Attached and connected
  • No of client-server: 6-2(Connected), 2 (Attached)

+) All tests passed and results are correct

File size: 2.2 KB
Line 
1/*!
2   \file client_server_mapping.hpp
3   \author Ha NGUYEN
4   \since 04 Feb 2015
5   \date 06 Feb 2015
6
7   \brief Mapping between index client and server.
8 */
9#ifndef __XIOS_CLIENT_SERVER_MAPPING_HPP__
10#define __XIOS_CLIENT_SERVER_MAPPING_HPP__
11
12#include "xmlioserver_spl.hpp"
13#include "array_new.hpp"
14#include "mpi.hpp"
15
16namespace xios {
17
18/*!
19  \class CClientServerMapping
20  This class computes index of data which are sent to server as well as index of data
21on server side.
22*/
23class CClientServerMapping
24{
25  public:
26    /** Default constructor */
27    CClientServerMapping();
28
29    /** Default destructor */
30    virtual ~CClientServerMapping();
31
32    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
33                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer);
34
35    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
36                                           const CArray<int,1>& localIndexOnClient,
37                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer);
38
39    std::map<int,int> computeConnectedClients(int nbServer, int nbClient,
40                                              MPI_Comm& clientIntraComm,
41                                              const std::vector<int>& connectedServerRank);
42
43    const std::map<int, std::vector<size_t> >& getGlobalIndexOnServer() const;
44    const std::map<int, std::vector<int> >& getLocalIndexSendToServer() const;
45
46  protected:
47    void defaultComputeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
48                                          const std::vector<CArray<size_t,1>* >& globalIndexOnServer,
49                                          const CArray<int,1>* localIndexOnClient = 0);
50
51  private:
52    //! Global index of data on SERVER, which are calculated by client(s)
53    std::map<int, std::vector<size_t> > indexGlobalOnServer_;
54
55    //! Index of the local data which will be sent to the corresponding server(s)
56    std::map<int, std::vector<int> >  localIndexSend2Server_;
57
58    //!< Number of clients connected to a server
59    std::map<int, int> connectedClients_;
60};
61
62} // namespace xios
63#endif // __XIOS_CLIENT_SERVER_MAPPING_HPP__
Note: See TracBrowser for help on using the repository browser.