1 | #ifndef __SERVER_HPP__ |
---|
2 | #define __SERVER_HPP__ |
---|
3 | |
---|
4 | #include "xmlioserver_spl.hpp" |
---|
5 | #include "context.hpp" |
---|
6 | #include "mpi.hpp" |
---|
7 | #include "event_scheduler.hpp" |
---|
8 | |
---|
9 | namespace xios |
---|
10 | { |
---|
11 | class CServer |
---|
12 | { |
---|
13 | public: |
---|
14 | |
---|
15 | static void initialize(void) ; |
---|
16 | static void finalize(void) ; |
---|
17 | static void eventLoop(void) ; |
---|
18 | static void contextEventLoop(void) ; |
---|
19 | static void listenContext(void) ; |
---|
20 | static void listenFinalize(void) ; |
---|
21 | static void recvContextMessage(void* buff,int count) ; |
---|
22 | static void listenRootContext(void) ; |
---|
23 | static void listenRootFinalize(void) ; |
---|
24 | static void registerContext(void* buff,int count, int leaderRank=0) ; |
---|
25 | |
---|
26 | static MPI_Comm intraComm ; |
---|
27 | static list<MPI_Comm> interComm ; |
---|
28 | static CEventScheduler* eventScheduler ; |
---|
29 | |
---|
30 | struct contextMessage |
---|
31 | { |
---|
32 | int nbRecv ; |
---|
33 | int leaderRank ; |
---|
34 | } ; |
---|
35 | |
---|
36 | static bool isRoot ; |
---|
37 | |
---|
38 | static map<string,CContext*> contextList ; |
---|
39 | static bool finished ; |
---|
40 | static bool is_MPI_Initialized ; |
---|
41 | |
---|
42 | public: |
---|
43 | //! Get rank of the current process |
---|
44 | static int getRank(); |
---|
45 | |
---|
46 | //! Print Information into a file |
---|
47 | static void openInfoStream(const StdString& fileName); |
---|
48 | |
---|
49 | //! Print information to standard output |
---|
50 | static void openInfoStream(); |
---|
51 | |
---|
52 | //! Close Info stream (closing file) |
---|
53 | static void closeInfoStream(); |
---|
54 | |
---|
55 | private: |
---|
56 | static StdOFStream m_infoStream; |
---|
57 | static int rank ; |
---|
58 | } ; |
---|
59 | } |
---|
60 | |
---|
61 | #endif |
---|