1 | #ifndef __XIOS_CCouplerIn__ |
---|
2 | #define __XIOS_CCouplerIn__ |
---|
3 | |
---|
4 | /// XIOS headers /// |
---|
5 | #include "xios_spl.hpp" |
---|
6 | #include "field.hpp" |
---|
7 | #include "declare_group.hpp" |
---|
8 | #include "date.hpp" |
---|
9 | #include "attribute_enum.hpp" |
---|
10 | #include "attribute_enum_impl.hpp" |
---|
11 | #include "context_client.hpp" |
---|
12 | #include "mpi.hpp" |
---|
13 | #include "string_tools.hpp" |
---|
14 | |
---|
15 | namespace xios |
---|
16 | { |
---|
17 | |
---|
18 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
19 | |
---|
20 | class CCouplerInGroup; |
---|
21 | class CCouplerInAttributes; |
---|
22 | class CCouplerIn; |
---|
23 | |
---|
24 | class CGarbageCollector; |
---|
25 | |
---|
26 | ///-------------------------------------------------------------- |
---|
27 | |
---|
28 | // Declare/Define CCouplerInAttribute |
---|
29 | BEGIN_DECLARE_ATTRIBUTE_MAP(CCouplerIn) |
---|
30 | # include "coupler_in_attribute.conf" |
---|
31 | END_DECLARE_ATTRIBUTE_MAP(CCouplerIn) |
---|
32 | |
---|
33 | ///-------------------------------------------------------------- |
---|
34 | |
---|
35 | /*! |
---|
36 | \class CCouplerIn |
---|
37 | This class corresponds to file component of the xml. |
---|
38 | The class contains all the nessceary information to write data into a netcdf file: The most important thing |
---|
39 | is the field(s) which will be written into file. Besides, there are some options to write |
---|
40 | data into file, e.g: writting into only one file or multiple file; splitting a running into several files. |
---|
41 | Moreover, there are some other attributes of netcdf file which are also stored in this class |
---|
42 | */ |
---|
43 | class CCouplerIn |
---|
44 | : public CObjectTemplate<CCouplerIn> |
---|
45 | , public CCouplerInAttributes |
---|
46 | { |
---|
47 | /// typedef /// |
---|
48 | typedef CObjectTemplate<CCouplerIn> SuperClass; |
---|
49 | typedef CCouplerInAttributes SuperClassAttribute; |
---|
50 | |
---|
51 | public : |
---|
52 | enum EEventId |
---|
53 | { |
---|
54 | EVENT_ID_COLLECTIVE=100, |
---|
55 | NO_EVENT, |
---|
56 | EVENT_ID_NO_COLLECTIVE=1000, |
---|
57 | }; |
---|
58 | |
---|
59 | typedef CCouplerInAttributes RelAttributes; |
---|
60 | typedef CCouplerInGroup RelGroup; |
---|
61 | |
---|
62 | /// Constructeurs /// |
---|
63 | CCouplerIn(void); |
---|
64 | explicit CCouplerIn(const StdString& id); |
---|
65 | CCouplerIn(const CCouplerIn& couplerIn); // Not implemented yet. |
---|
66 | CCouplerIn(const CCouplerIn* const couplerIn); // Not implemented yet. |
---|
67 | |
---|
68 | /// Destructeur /// |
---|
69 | virtual ~CCouplerIn(void); |
---|
70 | |
---|
71 | public: |
---|
72 | /// Accesseurs /// |
---|
73 | CFieldGroup* getVirtualFieldGroup(void) const; |
---|
74 | std::vector<CField*> getAllFields(void) const; |
---|
75 | std::vector<CField* > getEnabledFields(void); |
---|
76 | |
---|
77 | StdString dumpClassAttributes(void); |
---|
78 | |
---|
79 | public : |
---|
80 | void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); |
---|
81 | |
---|
82 | // Add component into coupler |
---|
83 | CField* addField(const string& id = ""); |
---|
84 | CFieldGroup* addFieldGroup(const string& id = ""); |
---|
85 | |
---|
86 | public: |
---|
87 | /// Accesseurs statiques /// |
---|
88 | static StdString GetName(void); |
---|
89 | static StdString GetDefName(void); |
---|
90 | static ENodeType GetType(void); |
---|
91 | public: |
---|
92 | /// Traitements /// |
---|
93 | virtual void parse(xml::CXMLNode& node); |
---|
94 | // virtual StdString toString(void) const; |
---|
95 | |
---|
96 | public: |
---|
97 | virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); |
---|
98 | void solveFieldRefInheritance(bool apply); |
---|
99 | void createInterCommunicator(void) ; |
---|
100 | void assignContext(void) ; |
---|
101 | |
---|
102 | private: |
---|
103 | CContextClient* client_=nullptr ; |
---|
104 | public: |
---|
105 | CContextClient* getContextClient(void) {return client_; } |
---|
106 | |
---|
107 | private: |
---|
108 | string couplingContextId_ ; |
---|
109 | public: |
---|
110 | const string& getCouplingContextId(void) ; |
---|
111 | |
---|
112 | private : |
---|
113 | |
---|
114 | CFieldGroup* virtualFieldGroup; |
---|
115 | |
---|
116 | // std::shared_ptr<CDataOutput> data_out; |
---|
117 | // std::shared_ptr<CDataInput> data_in; |
---|
118 | std::vector<CField*> enabledFields; |
---|
119 | |
---|
120 | |
---|
121 | public: |
---|
122 | |
---|
123 | }; // class CCouplerIn |
---|
124 | |
---|
125 | ///-------------------------------------------------------------- |
---|
126 | |
---|
127 | // Declare/Define CCouplerInGroup and CCouplerInDefinition |
---|
128 | DECLARE_GROUP(CCouplerIn); |
---|
129 | |
---|
130 | ///-------------------------------------------------------------- |
---|
131 | |
---|
132 | } // namespace xios |
---|
133 | |
---|
134 | #endif // __XIOS_CCouplingIn__ |
---|