[342] | 1 | #ifndef __CLIENT_HPP__ |
---|
| 2 | #define __CLIENT_HPP__ |
---|
[300] | 3 | |
---|
[591] | 4 | #include "xios_spl.hpp" |
---|
[382] | 5 | #include "mpi.hpp" |
---|
[300] | 6 | |
---|
[335] | 7 | namespace xios |
---|
[490] | 8 | { |
---|
[300] | 9 | class CClient |
---|
| 10 | { |
---|
[523] | 11 | public: |
---|
| 12 | static void initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm); |
---|
| 13 | static void finalize(void); |
---|
| 14 | static void registerContext(const string& id, MPI_Comm contextComm); |
---|
[490] | 15 | |
---|
[523] | 16 | static MPI_Comm intraComm; |
---|
| 17 | static MPI_Comm interComm; |
---|
[655] | 18 | static std::list<MPI_Comm> contextInterComms; |
---|
[1148] | 19 | static int serverLeader; |
---|
[523] | 20 | static bool is_MPI_Initialized ; |
---|
[300] | 21 | |
---|
[992] | 22 | static MPI_Comm& getInterComm(); |
---|
| 23 | |
---|
[1243] | 24 | //! Get global rank without oasis and current rank in model intraComm in case of oasis |
---|
[490] | 25 | static int getRank(); |
---|
| 26 | |
---|
[523] | 27 | //! Open a file stream to write the info logs |
---|
[490] | 28 | static void openInfoStream(const StdString& fileName); |
---|
[523] | 29 | //! Write the info logs to standard output |
---|
[490] | 30 | static void openInfoStream(); |
---|
[523] | 31 | //! Close the info logs file if it opens |
---|
[490] | 32 | static void closeInfoStream(); |
---|
| 33 | |
---|
[523] | 34 | //! Open a file stream to write the error log |
---|
| 35 | static void openErrorStream(const StdString& fileName); |
---|
| 36 | //! Write the error log to standard error output |
---|
| 37 | static void openErrorStream(); |
---|
| 38 | //! Close the error log file if it opens |
---|
| 39 | static void closeErrorStream(); |
---|
[490] | 40 | |
---|
[523] | 41 | protected: |
---|
[1148] | 42 | static int rank_; //!< Rank in model intraComm |
---|
[523] | 43 | static StdOFStream m_infoStream; |
---|
| 44 | static StdOFStream m_errorStream; |
---|
[490] | 45 | |
---|
[523] | 46 | static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); |
---|
| 47 | }; |
---|
[300] | 48 | } |
---|
| 49 | |
---|
| 50 | #endif |
---|