source: XIOS/dev/branch_yushan/src/context_client.hpp @ 1144

Last change on this file since 1144 was 1081, checked in by yushan, 7 years ago

save current modifications

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.8 KB
Line 
1#ifndef __CONTEXT_CLIENT_HPP__
2#define __CONTEXT_CLIENT_HPP__
3
4#include "xios_spl.hpp"
5#include "buffer_out.hpp"
6#include "buffer_in.hpp"
7#include "buffer_client.hpp"
8#include "event_client.hpp"
9#include "event_server.hpp"
10#include "mpi.hpp"
11#include "registry.hpp"
12#ifdef _usingEP
13//#include "ep_declaration.hpp"
14#endif
15
16
17namespace xios
18{
19  class CContext;
20
21  /*!
22  \class CContextClient
23  A context can be both on client and on server side. In order to differenciate the role of
24  context on each side, e.x client sending events, server receiving and processing events, there is a need of
25  concrete "context" classes for both sides.
26  CContextClient processes and sends events from client to server where CContextServer receives these events
27  and processes them.
28  */
29  class CContextClient
30  {
31    public:
32      // Contructor
33      CContextClient();
34      CContextClient(CContext* parent, ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* parentServer = 0);
35
36      // Send event to server
37      void sendEvent(CEventClient& event);
38      void waitEvent(list<int>& ranks);
39
40      // Functions relates to set/get buffers
41      list<CBufferOut*> getBuffers(list<int>& serverlist, list<int>& sizeList);
42      void newBuffer(int rank);
43      bool checkBuffers(list<int>& ranks);
44      bool checkBuffers(void);
45      void releaseBuffers(void);
46
47      bool isServerLeader(void) const;
48      const std::list<int>& getRanksServerLeader(void) const;
49
50      bool isAttachedModeEnabled() const;
51
52      // Close and finalize context client
53      void closeContext(void);
54      void finalize(void);
55
56      void setBufferSize(const std::map<int,StdSize>& mapSize, const std::map<int,StdSize>& maxEventSize);
57
58    public:
59      CContext* context; //!< Context for client
60
61      size_t timeLine; //!< Timeline of each event
62
63      int clientRank; //!< Rank of current client
64
65      int clientSize; //!< Size of client group
66
67      int serverSize; //!< Size of server group
68
69      ep_lib::MPI_Comm interComm; //!< Communicator of server group
70
71      ep_lib::MPI_Comm intraComm; //!< Communicator of client group
72
73      map<int,CClientBuffer*> buffers; //!< Buffers for connection to servers
74
75    private:
76      //! Mapping of server and buffer size for each connection to server
77      std::map<int,StdSize> mapBufferSize_;
78      //! Maximum number of events that can be buffered
79      StdSize maxBufferedEvents;
80
81      //! Context for server (Only used in attached mode)
82      CContext* parentServer;
83
84      //! List of server ranks for which the client is leader
85      std::list<int> ranksServerLeader;
86
87    public: // Some function should be removed in the future
88      //    void registerEvent(CEventClient& event);
89//    list<CBufferOut*> newEvent(CEventClient& event,list<int>& sizes);
90//    bool locked;
91//    set<int> connectedServer;
92
93  };
94}
95
96#endif // __CONTEXT_CLIENT_HPP__
Note: See TracBrowser for help on using the repository browser.