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