source: XIOS/trunk/src/node/field.hpp @ 646

Last change on this file since 646 was 646, checked in by rlacroix, 9 years ago

Fix compilation after r645.

Partial recompilation was hidding the problem.

  • 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
  • Property svn:executable set to *
File size: 7.5 KB
RevLine 
[591]1#ifndef __XIOS_CField__
2#define __XIOS_CField__
[219]3
[591]4/// XIOS headers ///
5#include "xios_spl.hpp"
[219]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"
[231]12#include "calendar_util.hpp"
[369]13#include "array_new.hpp"
14#include "attribute_array.hpp"
[540]15#include "declare_ref_func.hpp"
[619]16#include "transformation_enum.hpp"
[646]17#include "variable.hpp"
[219]18
[300]19
[335]20namespace xios {
[509]21
[219]22   /// ////////////////////// Déclarations ////////////////////// ///
23
24   class CFieldGroup;
25   class CFieldAttributes;
26   class CField;
27
28   class CFile;
29   class CGrid;
[640]30   class CContext;
[619]31   class CGenericFilter;
32
[640]33   class CGarbageCollector;
34   class COutputPin;
35   class CSourceFilter;
36   class CStoreFilter;
37   class CFileWriterFilter;
38
[219]39   ///--------------------------------------------------------------
40
41   // Declare/Define CFieldAttribute
42   BEGIN_DECLARE_ATTRIBUTE_MAP(CField)
43#  include "field_attribute.conf"
44   END_DECLARE_ATTRIBUTE_MAP(CField)
45
46   ///--------------------------------------------------------------
47   class CField
48      : public CObjectTemplate<CField>
49      , public CFieldAttributes
50   {
51         /// friend ///
52         friend class CFile;
53
54         /// typedef ///
55         typedef CObjectTemplate<CField>   SuperClass;
56         typedef CFieldAttributes SuperClassAttribute;
57
58      public :
59
60         typedef CFieldAttributes RelAttributes;
61         typedef CFieldGroup      RelGroup;
62
[300]63         enum EEventId
64         {
[598]65           EVENT_ID_UPDATE_DATA, EVENT_ID_READ_DATA, EVENT_ID_READ_DATA_READY,
66           EVENT_ID_ADD_VARIABLE, EVENT_ID_ADD_VARIABLE_GROUP
[300]67         } ;
[509]68
[219]69         /// Constructeurs ///
70         CField(void);
71         explicit CField(const StdString & id);
72         CField(const CField & field);       // Not implemented yet.
73         CField(const CField * const field); // Not implemented yet.
74
75         /// Accesseurs ///
76
[347]77         CGrid* getRelGrid(void) const ;
78         CFile* getRelFile(void) const ;
[219]79
[645]80         func::CFunctor::ETimeType getOperationTimeType() const;
81
[219]82      public :
83
[266]84         StdSize getNStep(void) const;
85
[593]86         template <int N> void getData(CArray<double, N>& _data) const;
[219]87
[641]88         boost::shared_ptr<COutputPin> getInstantDataFilter();
[219]89
90         /// Mutateur ///
[347]91         void setRelFile(CFile* _file);
[266]92         void incrementNStep(void);
[321]93         void resetNStep() ;
[599]94         void resetNStepMax();
[219]95
[509]96         std::map<int, StdSize> getGridDataSize();
97
[300]98       public :
[310]99         bool isActive(void) const;
[459]100         bool hasOutputFile ;
[219]101
102         /// Traitements ///
103         void solveGridReference(void);
[645]104         void solveServerOperation(void);
[509]105         void solveCheckMaskIndex(bool doSendingIndex);
106         void solveAllReferenceEnabledField(bool doSending2Sever);
107         void solveGridDomainAxisRef(bool checkAtt);
[619]108         void solveTransformedGrid();
[219]109
[640]110         void buildFilterGraph(CGarbageCollector& gc, bool enableOutput);
[642]111         boost::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc);
[643]112         boost::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq);
[640]113
[369]114//         virtual void fromBinary(StdIStream & is);
[219]115
116         /// Destructeur ///
117         virtual ~CField(void);
118
119         /// Accesseurs statiques ///
120         static StdString GetName(void);
121         static StdString GetDefName(void);
[509]122
[219]123         static ENodeType GetType(void);
[509]124
[369]125        template <int N> void setData(const CArray<double, N>& _data) ;
[300]126        static bool dispatchEvent(CEventServer& event) ;
[638]127        void sendUpdateData(const CArray<double,1>& data);
[300]128        static void recvUpdateData(CEventServer& event) ;
129        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ;
130        void writeField(void) ;
[598]131        void sendReadDataRequest(void);
132        bool sendReadDataRequestIfNeeded(void);
133        static void recvReadDataRequest(CEventServer& event);
134        void recvReadDataRequest(void);
[599]135        bool readField(void);
[598]136        static void recvReadDataReady(CEventServer& event);
137        void recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers);
[369]138        void outputField(CArray<double,3>& fieldOut) ;
139        void outputField(CArray<double,2>& fieldOut) ;
[567]140        void outputField(CArray<double,1>& fieldOut) ;
[599]141        void inputField(CArray<double,3>& fieldOut);
142        void inputField(CArray<double,2>& fieldOut);
143        void inputField(CArray<double,1>& fieldOut);
[464]144        void scaleFactorAddOffset(double scaleFactor, double addOffset) ;
[599]145        void invertScaleFactorAddOffset(double scaleFactor, double addOffset);
[459]146        void parse(xml::CXMLNode & node) ;
[509]147
[472]148        void setVirtualVariableGroup(CVariableGroup* newVVariableGroup);
149        void setVirtualVariableGroup(void);
150        CVariableGroup* getVirtualVariableGroup(void) const;
151        vector<CVariable*> getAllVariables(void) const;
152        virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
[509]153
[472]154        CVariable* addVariable(const string& id="") ;
155        CVariableGroup* addVariableGroup(const string& id="") ;
156        void sendAddVariable(const string& id="") ;
157        void sendAddVariableGroup(const string& id="") ;
158        static void recvAddVariable(CEventServer& event) ;
159        void recvAddVariable(CBufferIn& buffer) ;
160        static void recvAddVariableGroup(CEventServer& event) ;
161        void recvAddVariableGroup(CBufferIn& buffer) ;
[509]162        void sendAddAllVariables();
163
164
[569]165        const std::pair<StdString, StdString>& getRefDomainAxisIds();
[619]166
[300]167      public :
[219]168         /// Propriétés privées ///
[472]169         CVariableGroup* vVariableGroup ;
[509]170
[347]171         CGrid*  grid ;
172         CFile*  file;
[219]173
[343]174         CDuration freq_operation_srv, freq_write_srv;
[219]175
[599]176         StdSize nstep, nstepMax;
177         bool isEOF;
[645]178         boost::shared_ptr<CDate> lastlast_Write_srv, last_Write_srv, last_operation_srv;
[598]179         CDate lastDataRequestedFromServer;
[509]180
[300]181         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv;
[509]182
[369]183         map<int, CArray<double,1>* > data_srv ;
[459]184         string content ;
[509]185
186         bool areAllReferenceSolved;
187         std::pair<StdString,StdString> domAxisIds_;
[598]188         bool isReadDataRequestPending;
[645]189
[540]190         DECLARE_REF_FUNC(Field,field)
[219]191
[640]192      private:
[645]193         //! The type of operation attached to the field
194         func::CFunctor::ETimeType operationTimeType;
195
[640]196         //! The output pin of the filter providing the instant data for the field
197         boost::shared_ptr<COutputPin> instantDataFilter;
[643]198         //! The output pin of the filters providing the result of the field's temporal operation
199         std::map<CDuration, boost::shared_ptr<COutputPin>, DurationFakeLessComparator> temporalDataFilters;
[640]200         //! The source filter for data provided by the client
201         boost::shared_ptr<CSourceFilter> clientSourceFilter;
202         //! The source filter for data provided by the server
203         boost::shared_ptr<CSourceFilter> serverSourceFilter;
204         //! The terminal filter which stores the instant data
205         boost::shared_ptr<CStoreFilter> storeFilter;
206         //! The terminal filter which writes the data to file
207         boost::shared_ptr<CFileWriterFilter> fileWriterFilter;
[219]208   }; // class CField
209
210   ///--------------------------------------------------------------
211
212   // Declare/Define CFieldGroup and CFieldDefinition
213   DECLARE_GROUP(CField);
214
215   ///-----------------------------------------------------------------
216
217   template <>
218      void CGroupTemplate<CField, CFieldGroup, CFieldAttributes>::solveRefInheritance(void);
219
220   ///-----------------------------------------------------------------
[335]221} // namespace xios
[219]222
223
[591]224#endif // __XIOS_CField__
Note: See TracBrowser for help on using the repository browser.