1 | #ifndef __COUPLER_MANAGER_HPP__ |
---|
2 | #define __COUPLER_MANAGER_HPP__ |
---|
3 | |
---|
4 | #include "xios_spl.hpp" |
---|
5 | #include "mpi.hpp" |
---|
6 | #include "buffer_in.hpp" |
---|
7 | #include "buffer_out.hpp" |
---|
8 | |
---|
9 | #include <string> |
---|
10 | #include <map> |
---|
11 | #include "window_manager.hpp" |
---|
12 | |
---|
13 | |
---|
14 | namespace xios |
---|
15 | { |
---|
16 | // the rule of this manager is to schedule intercommunicator creation between two or more coupling context |
---|
17 | |
---|
18 | class CCouplerManager |
---|
19 | { |
---|
20 | |
---|
21 | public: |
---|
22 | CCouplerManager(bool isXiosServer); |
---|
23 | ~CCouplerManager() ; |
---|
24 | void registerCoupling(std::string srcCoupling, std::string dstCoupling) ; |
---|
25 | bool isNextCoupling(string srcCoupling, string dstCoupling) ; |
---|
26 | private : |
---|
27 | void registredCouplingDumpOut(CBufferOut& buffer) ; |
---|
28 | void registredCouplingDumpIn(CBufferIn& buffer) ; |
---|
29 | void nextCouplingDumpOut(CBufferOut& buffer); |
---|
30 | void nextCouplingDumpIn(CBufferIn& buffer); |
---|
31 | |
---|
32 | const std::string getStrCoupling(std::string srcCoupling, std::string dstCoupling) { return std::string("__"+srcCoupling+"__to__"+dstCoupling+"__") ; } |
---|
33 | /** windows containing a set of coupling (hash) registred by at least one context */ |
---|
34 | CWindowManager* winRegistredCoupling_ ; |
---|
35 | |
---|
36 | /** windows containing a list of coupling fully registred by two context. The first coupling of the list will be the next candidate for intercommunicator creation */ |
---|
37 | CWindowManager* winNextCoupling_ ; |
---|
38 | |
---|
39 | /** size of the windows, ie around 1024 coupling context can be registred at the time */ |
---|
40 | const size_t maxBufferSize_=1024*8 ; |
---|
41 | |
---|
42 | std::set<size_t> registredCoupling_ ; |
---|
43 | std::list<pair<size_t,int>> nextCoupling_ ; |
---|
44 | |
---|
45 | /** the rank of the mpi proc where the data are kept in memory*/ |
---|
46 | int managerGlobalLeader_ ; |
---|
47 | } ; |
---|
48 | |
---|
49 | |
---|
50 | } |
---|
51 | |
---|
52 | #endif |
---|