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

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

Changing interface of tests to make sure global index begins at zero (0)

+) In all tests, ibegin, jbegin starts at zero (0), so there are some minor changes in field_glo
+) Improve a littel bit class design

Test
+) On Curie,
+) All test passed and results are the same as before

File size: 1.9 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    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
33                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer);
34
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;
41
42  protected:
43    void defaultComputeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient,
44                                          const std::vector<CArray<size_t,1>* >& globalIndexOnServer);
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__
Note: See TracBrowser for help on using the repository browser.