/*! \file client_server_mapping.hpp \author Ha NGUYEN \since 04 Feb 2015 \date 06 Feb 2015 \brief Mapping between index client and server. */ #ifndef __XIOS_CLIENT_SERVER_MAPPING_HPP__ #define __XIOS_CLIENT_SERVER_MAPPING_HPP__ #include "xmlioserver_spl.hpp" #include "array_new.hpp" #include "mpi.hpp" namespace xios { /*! \class CClientServerMapping This class computes index of data which are sent to server as well as index of data on server side. */ class CClientServerMapping { public: /** Default constructor */ CClientServerMapping(); /** Default destructor */ virtual ~CClientServerMapping(); virtual void computeServerIndexMapping(const CArray& globalIndexOnClient, const std::vector* >& globalIndexOnServer); std::map computeConnectedClients(int nbServer, int nbClient, MPI_Comm& clientIntraComm, const std::vector& connectedServerRank); const std::map >& getGlobalIndexOnServer() const; const std::map >& getLocalIndexSendToServer() const; protected: void defaultComputeServerIndexMapping(const CArray& globalIndexOnClient, const std::vector* >& globalIndexOnServer); private: //! Global index of data on SERVER, which are calculated by client(s) std::map > indexGlobalOnServer_; //! Index of the local data which will be sent to the corresponding server(s) std::map > localIndexSend2Server_; //!< Number of clients connected to a server std::map connectedClients_; }; } // namespace xios #endif // __XIOS_CLIENT_SERVER_MAPPING_HPP__