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 | /** Default constructor */ |
---|
31 | CTransformationMapping(CGrid* destination, CGrid* source); |
---|
32 | CTransformationMapping(CAxis* destination, CAxis* source); |
---|
33 | |
---|
34 | ~CTransformationMapping(); |
---|
35 | |
---|
36 | void computeTransformationMapping(const std::map<size_t, std::vector<std::pair<size_t,double> > >& globaIndexMapFromDestToSource); |
---|
37 | const std::map<int,std::vector<std::vector<std::pair<size_t,double> > > >& getGlobalIndexReceivedOnGridDestMapping() const; |
---|
38 | const std::map<int,std::vector<size_t> >& getGlobalIndexSendToGridDestMapping() const; |
---|
39 | |
---|
40 | protected: |
---|
41 | CGrid* gridSource_; // Grid source |
---|
42 | CGrid* gridDestination_; // Grid destination demande the necessary global index from grid source |
---|
43 | |
---|
44 | //! Global index mapping of grid source and grid destination between two clients |
---|
45 | CClientServerMappingDistributed* gridIndexClientClientMapping_; |
---|
46 | |
---|
47 | //! Mapping of client rank of grid source and global index received in grid destination |
---|
48 | std::map<int,std::vector<std::vector<std::pair<size_t,double> > > > globalIndexReceivedOnGridDestMapping_; |
---|
49 | |
---|
50 | //! Mapping of client rank of grid destination and global index to send from grid source |
---|
51 | std::map<int,std::vector<size_t> > globalIndexSendToGridDestMapping_; |
---|
52 | }; |
---|
53 | |
---|
54 | } |
---|
55 | #endif // __XIOS_TRANSFORMATION_MAPPING_HPP__ |
---|