source: XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/server_to_client_store_filter.hpp @ 2130

Last change on this file since 2130 was 2130, checked in by ymipsl, 3 years ago

New management of client-server buffers.

  • buffers can grow automatically in intialization phase
  • buffers is evaluated after the close context definition phase and fixed at optimal value.

YM

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#ifndef __XIOS_SERVER_TO_CLIENT_FILTER_HPP__
2#define __XIOS_SERVER_TO_CLIENT_FILTER_HPP__
3
4#include "input_pin.hpp"
5
6namespace xios
7{
8  class CField;
9  class CGrid ;
10  class CContextClient ;
11
12  /*!
13   * A terminal filter which transmits the packets it receives to a field for writting in a file.
14   */
15  class CServerToClientStoreFilter : public CInputPin
16  {
17    public:
18      /*!
19       * Constructs the filter (with one input slot) associated to the specified field
20       * and a garbage collector.
21       *
22       * \param gc the associated garbage collector
23       * \param field the associated field
24       */
25      CServerToClientStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client);
26
27      /*!
28       * Get the size of data transfered by call. Needed for context client buffer size evaluation
29       *
30       * \param size : map returning the size for each server rank 
31       * \return the associated context client
32       */
33      CContextClient* getTransferedDataSize(map<int,int>& size) ;
34
35      /*!
36       * Tests if the filter must auto-trigger.
37       *
38       * \return true if the filter must auto-trigger
39       */
40      bool virtual mustAutoTrigger() const;
41
42      /*!
43       * Tests whether data is expected for the specified date.
44       *
45       * \param date the date associated to the data
46       */
47      bool virtual isDataExpected(const CDate& date) const;
48
49    protected:
50      /*!
51       * Callbacks a field to write a packet to a file.
52       *
53       * \param data a vector of packets corresponding to each slot
54       */
55      void virtual onInputReady(std::vector<CDataPacketPtr> data);
56
57    private:
58      CField* field_; //<! The associated field
59      CGrid* grid_; //<! The associated grid
60      CContextClient* client_ ; //! the associated context client
61      std::map<Time, CDataPacketPtr> packets; //<! The stored packets
62      int nStep_ = 0 ;
63  }; // class CServerToClientStoreFilter
64} // namespace xios
65
66#endif // XIOS_SERVER_TO_CLIENT_FILTER_HPP
Note: See TracBrowser for help on using the repository browser.