[553] | 1 | /*! |
---|
| 2 | \file client_server_mapping.hpp |
---|
| 3 | \author Ha NGUYEN |
---|
| 4 | \since 04 Feb 2015 |
---|
[569] | 5 | \date 09 Mars 2015 |
---|
[553] | 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 | |
---|
[591] | 12 | #include "xios_spl.hpp" |
---|
[553] | 13 | #include "array_new.hpp" |
---|
| 14 | #include "mpi.hpp" |
---|
[829] | 15 | #include <boost/unordered_map.hpp> |
---|
[1037] | 16 | #ifdef _usingEP |
---|
| 17 | #include "ep_declaration.hpp" |
---|
| 18 | #endif |
---|
[553] | 19 | |
---|
[1037] | 20 | |
---|
[553] | 21 | namespace xios { |
---|
| 22 | |
---|
| 23 | /*! |
---|
| 24 | \class CClientServerMapping |
---|
| 25 | This class computes index of data which are sent to server as well as index of data |
---|
| 26 | on server side. |
---|
| 27 | */ |
---|
| 28 | class CClientServerMapping |
---|
| 29 | { |
---|
[829] | 30 | public: |
---|
| 31 | typedef boost::unordered_map<int, std::vector<size_t> > GlobalIndexMap; |
---|
[553] | 32 | public: |
---|
| 33 | /** Default constructor */ |
---|
| 34 | CClientServerMapping(); |
---|
| 35 | |
---|
| 36 | /** Default destructor */ |
---|
| 37 | virtual ~CClientServerMapping(); |
---|
| 38 | |
---|
[569] | 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 | |
---|
[598] | 42 | static std::map<int,int> computeConnectedClients(int nbServer, int nbClient, |
---|
| 43 | MPI_Comm& clientIntraComm, |
---|
| 44 | const std::vector<int>& connectedServerRank); |
---|
[553] | 45 | |
---|
[829] | 46 | const GlobalIndexMap& getGlobalIndexOnServer() const; |
---|
[554] | 47 | |
---|
[553] | 48 | protected: |
---|
| 49 | //! Global index of data on SERVER, which are calculated by client(s) |
---|
[829] | 50 | GlobalIndexMap indexGlobalOnServer_; |
---|
[553] | 51 | }; |
---|
| 52 | |
---|
| 53 | } // namespace xios |
---|
| 54 | #endif // __XIOS_CLIENT_SERVER_MAPPING_HPP__ |
---|