source: XIOS/dev/branch_yushan_merged/src/client_server_mapping.hpp @ 1205

Last change on this file since 1205 was 1134, checked in by yushan, 7 years ago

branch merged with trunk r1130

File size: 1.5 KB
Line 
1/*!
2   \file client_server_mapping.hpp
3   \author Ha NGUYEN
4   \since 04 Feb 2015
5   \date 09 Mars 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 "xios_spl.hpp"
13#include "array_new.hpp"
14#include "mpi.hpp"
15#include <boost/unordered_map.hpp>
16#ifdef _usingEP
17#include "ep_declaration.hpp"
18#endif
19
20
21namespace xios {
22
23/*!
24  \class CClientServerMapping
25  This class computes index of data which are sent to server as well as index of data
26on server side.
27*/
28class CClientServerMapping
29{
30public:
31  typedef boost::unordered_map<int, std::vector<size_t> > GlobalIndexMap;
32  public:
33    /** Default constructor */
34    CClientServerMapping();
35
36    /** Default destructor */
37    virtual ~CClientServerMapping();
38
39    // Only need global index on client to calculate mapping (supposed client has info of distribution)
40    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) = 0;
41
42    static std::map<int,int> computeConnectedClients(int nbServer, int nbClient,
43                                                     ep_lib::MPI_Comm& clientIntraComm,
44                                                     const std::vector<int>& connectedServerRank);
45
46    const GlobalIndexMap& getGlobalIndexOnServer() const;
47
48  protected:
49    //! Global index of data on SERVER, which are calculated by client(s)
50    GlobalIndexMap indexGlobalOnServer_;
51};
52
53} // namespace xios
54#endif // __XIOS_CLIENT_SERVER_MAPPING_HPP__
Note: See TracBrowser for help on using the repository browser.