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

Last change on this file since 553 was 553, checked in by mhnguyen, 9 years ago

Seperating global index computation on client and server side

+) Create a class which do mapping in general manner, between client and server index global
+) Remove some redundant functions and variables
+) Add some comments to code

Test
+) On Curie. Only test_new_features.f90
+) Test passes and results are correct.
+) Need to change index from 1 to 0

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