New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
field.hpp in vendors/XIOS/current/src/node – NEMO

source: vendors/XIOS/current/src/node/field.hpp @ 3428

Last change on this file since 3428 was 3428, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

File size: 4.7 KB
Line 
1#ifndef __XMLIO_CField__
2#define __XMLIO_CField__
3
4/// xios headers ///
5#include "xmlioserver_spl.hpp"
6#include "group_factory.hpp"
7#include "functor.hpp"
8#include "functor_type.hpp"
9#include "duration.hpp"
10#include "date.hpp"
11#include "declare_group.hpp"
12#include "calendar_util.hpp"
13//#include "context.hpp"
14
15
16namespace xios {
17   
18   /// ////////////////////// Déclarations ////////////////////// ///
19
20   class CFieldGroup;
21   class CFieldAttributes;
22   class CField;
23
24   class CFile;
25   class CGrid;
26   class CContext ;
27   ///--------------------------------------------------------------
28
29   // Declare/Define CFieldAttribute
30   BEGIN_DECLARE_ATTRIBUTE_MAP(CField)
31#  include "field_attribute.conf"
32   END_DECLARE_ATTRIBUTE_MAP(CField)
33
34   ///--------------------------------------------------------------
35   class CField
36      : public CObjectTemplate<CField>
37      , public CFieldAttributes
38   {
39         /// friend ///
40         friend class CFile;
41
42         /// typedef ///
43         typedef CObjectTemplate<CField>   SuperClass;
44         typedef CFieldAttributes SuperClassAttribute;
45
46      public :
47
48         typedef CFieldAttributes RelAttributes;
49         typedef CFieldGroup      RelGroup;
50
51         enum EEventId
52         {
53           EVENT_ID_UPDATE_DATA
54         } ;
55         
56         /// Constructeurs ///
57         CField(void);
58         explicit CField(const StdString & id);
59         CField(const CField & field);       // Not implemented yet.
60         CField(const CField * const field); // Not implemented yet.
61
62         /// Accesseurs ///
63         CField* getDirectFieldReference(void) const;
64         CField* getBaseFieldReference(void)   const;
65         const std::vector<CField*> & getAllReference(void) const;
66
67         CGrid* getRelGrid(void) const ;
68         CFile* getRelFile(void) const ;
69
70      public :
71
72         StdSize getNStep(void) const;
73
74         const CDuration & getFreqOperation(void) const;
75         const CDuration & getFreqWrite(void) const;
76
77         boost::shared_ptr<CDate> getLastWriteDate(void) const;
78         boost::shared_ptr<CDate> getLastOperationDate(void) const;
79
80         boost::shared_ptr<func::CFunctor> getFieldOperation(void) const;
81         
82         ARRAY(double, 1) getData(void) const;
83
84         const StdString & getBaseFieldId(void) const;
85
86         /// Mutateur ///
87         void setRelFile(CFile* _file);
88         void incrementNStep(void);
89         void resetNStep() ;
90
91         template <StdSize N> bool updateData(const ARRAY(double, N)   data);
92         
93         bool updateDataServer
94               (const CDate & currDate,
95                const std::deque<ARRAY(double, 1)> storedClient);
96 
97       public :
98
99         /// Test ///
100         bool hasDirectFieldReference(void) const;
101         bool isActive(void) const;
102
103         /// Traitements ///
104         void solveRefInheritance(void);
105         void solveGridReference(void);
106         void solveOperation(void);
107
108         virtual void fromBinary(StdIStream & is);
109
110         /// Destructeur ///
111         virtual ~CField(void);
112
113         /// Accesseurs statiques ///
114         static StdString GetName(void);
115         static StdString GetDefName(void);
116         
117         static ENodeType GetType(void);
118         
119        template <StdSize N> void setData(const ARRAY(double, N) _data) ;
120        static bool dispatchEvent(CEventServer& event) ;
121        void sendUpdateData(void) ;
122        static void recvUpdateData(CEventServer& event) ;
123        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ;
124        void writeField(void) ;
125        void outputField(ARRAY(double,3) fieldOut) ;
126        void outputField(ARRAY(double,2) fieldOut) ;
127       
128      public :
129
130         /// Propriétés privées ///
131         
132         std::vector<CField*> refObject;
133         CField* baseRefObject;
134         CGrid*  grid ;
135         CFile*  file;
136
137         CDuration freq_operation, freq_write;
138         CDuration freq_operation_srv, freq_write_srv;
139
140         StdSize nstep;
141         boost::shared_ptr<CDate>    last_Write, last_operation;
142         boost::shared_ptr<CDate>    lastlast_Write_srv,last_Write_srv, last_operation_srv;
143         
144         boost::shared_ptr<func::CFunctor> foperation;
145         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv;
146         
147         ARRAY(double, 1) data;
148         map<int,ARRAY(double,1)> data_srv ;
149
150   }; // class CField
151
152   ///--------------------------------------------------------------
153
154   // Declare/Define CFieldGroup and CFieldDefinition
155   DECLARE_GROUP(CField);
156
157   ///-----------------------------------------------------------------
158
159   template <>
160      void CGroupTemplate<CField, CFieldGroup, CFieldAttributes>::solveRefInheritance(void);
161
162   ///-----------------------------------------------------------------
163} // namespace xios
164
165
166#endif // __XMLIO_CField__
Note: See TracBrowser for help on using the repository browser.