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

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

Implementing discovering algorithm of server index

+) Implement the algorithm with only one level
+) Remove some redundant functions, corrects some interface

Test
+) On Curie
+) Test passed and results are correct

File size: 2.4 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#include <boost/unordered_map.hpp>
16
17namespace xios {
18
19/*!
20  \class CClientServerMapping
21  This class computes index of data which are sent to server as well as index of data
22on server side.
23*/
24class CClientServerMapping
25{
26  public:
27    /** Default constructor */
28    CClientServerMapping();
29
30    /** Default destructor */
31    virtual ~CClientServerMapping();
32
33    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
34                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer);
35
36    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
37                                           const CArray<int,1>& localIndexOnClient);
38
39//    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
40//                                           const CArray<int,1>& localIndexOnClient,
41//                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer);
42
43    std::map<int,int> computeConnectedClients(int nbServer, int nbClient,
44                                              MPI_Comm& clientIntraComm,
45                                              const std::vector<int>& connectedServerRank);
46
47    const std::map<int, std::vector<size_t> >& getGlobalIndexOnServer() const;
48    const std::map<int, std::vector<int> >& getLocalIndexSendToServer() const;
49
50  protected:
51    void defaultComputeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
52                                          const std::vector<CArray<size_t,1>* >& globalIndexOnServer,
53                                          const CArray<int,1>* localIndexOnClient = 0);
54
55  protected:
56    //! Global index of data on SERVER, which are calculated by client(s)
57    std::map<int, std::vector<size_t> > indexGlobalOnServer_;
58
59    //! Index of the local data which will be sent to the corresponding server(s)
60    std::map<int, std::vector<int> >  localIndexSend2Server_;
61
62    //!< Number of clients connected to a server
63    std::map<int, int> connectedClients_;
64};
65
66} // namespace xios
67#endif // __XIOS_CLIENT_SERVER_MAPPING_HPP__
Note: See TracBrowser for help on using the repository browser.