1 | /*! |
---|
2 | \file transformation_mapping.hpp |
---|
3 | \author Ha NGUYEN |
---|
4 | \since 14 May 2015 |
---|
5 | \date 09 June 2015 |
---|
6 | |
---|
7 | \brief Take charge of communication among clients to exchange transformed data. |
---|
8 | */ |
---|
9 | #ifndef __XIOS_TRANSFORMATION_MAPPING_HPP__ |
---|
10 | #define __XIOS_TRANSFORMATION_MAPPING_HPP__ |
---|
11 | |
---|
12 | #include <map> |
---|
13 | #include <set> |
---|
14 | #include "grid.hpp" |
---|
15 | #include "axis.hpp" |
---|
16 | #include "array_new.hpp" |
---|
17 | #include "client_server_mapping_distributed.hpp" |
---|
18 | |
---|
19 | namespace xios { |
---|
20 | |
---|
21 | /*! |
---|
22 | \class CTransformationMapping |
---|
23 | This class is in charge of transfer the global index form grid from grid source to grid destination in a rather generic way. |
---|
24 | In order to make a transformation, the grid destination will make a request to grid source about the global indexes which it needs. |
---|
25 | The same discovering algorithm as the case of client-server is applied to find the corresponding client which contains the demanding global index. |
---|
26 | */ |
---|
27 | class CTransformationMapping |
---|
28 | { |
---|
29 | public: |
---|
30 | typedef boost::unordered_map<size_t, std::vector<std::pair<int, std::pair<size_t,double> > > > DestinationIndexMap; |
---|
31 | typedef boost::unordered_map<int,std::vector<std::vector<std::pair<int, std::pair<size_t,double> > > > > ReceivedIndexMap; |
---|
32 | typedef boost::unordered_map<int,std::vector<std::pair<int, size_t> > > SentIndexMap; |
---|
33 | |
---|
34 | public: |
---|
35 | /** Default constructor */ |
---|
36 | CTransformationMapping(CGrid* destination, CGrid* source); |
---|
37 | CTransformationMapping(CAxis* destination, CAxis* source); |
---|
38 | |
---|
39 | ~CTransformationMapping(); |
---|
40 | |
---|
41 | void computeTransformationMapping(const DestinationIndexMap& globaIndexMapFromDestToSource); |
---|
42 | const ReceivedIndexMap& getGlobalIndexReceivedOnGridDestMapping() const; |
---|
43 | const SentIndexMap& getGlobalIndexSendToGridDestMapping() const; |
---|
44 | |
---|
45 | protected: |
---|
46 | CGrid* gridSource_; // Grid source |
---|
47 | CGrid* gridDestination_; // Grid destination demande the necessary global index from grid source |
---|
48 | |
---|
49 | //! Global index mapping of grid source and grid destination between two clients |
---|
50 | CClientClientDHTPairIntInt* gridIndexClientClientMapping_; |
---|
51 | |
---|
52 | //! Mapping of client rank of grid source and global index received in grid destination |
---|
53 | ReceivedIndexMap globalIndexReceivedOnGridDestMapping_; |
---|
54 | |
---|
55 | //! Mapping of client rank of grid destination and global index to send from grid source |
---|
56 | SentIndexMap globalIndexSendToGridDestMapping_; |
---|
57 | }; |
---|
58 | |
---|
59 | } |
---|
60 | #endif // __XIOS_TRANSFORMATION_MAPPING_HPP__ |
---|