Ignore:
Timestamp:
11/13/14 15:09:14 (10 years ago)
Author:
mhnguyen
Message:

Implementing buffer size auto-detection for mode client -server

+) Process xml tree in client side then send all the information to server
+) Only information enabled fields in enabled files are sent to server
+) Some important change in structure of code which must be refactored

Test
+) On Curie
+) Only mode client-server
+) Passed for all tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/file.hpp

    r501 r509  
    1515 
    1616namespace xios { 
    17     
     17 
    1818   /// ////////////////////// Déclarations ////////////////////// /// 
    1919 
     
    3131   ///-------------------------------------------------------------- 
    3232 
     33   /*! 
     34   \class CFile 
     35   This class corresponds to file component of the xml. 
     36   The class contains all the nessceary information to write data into a netcdf file: The most important thing 
     37   is the field(s) which will be written into file. Besides, there are some options to write 
     38   data into file, e.g: writting into only one file or multiple file; splitting a running into several files. 
     39   Moreover, there are some other attributes of netcdf file which are also stored in this class 
     40   */ 
    3341   class CFile 
    3442      : public CObjectTemplate<CFile> 
     
    3846         typedef CObjectTemplate<CFile>   SuperClass; 
    3947         typedef CFileAttributes SuperClassAttribute; 
    40        
     48 
    4149      public : 
    4250         enum EEventId 
    4351         { 
    44            EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP, EVENT_ID_ADD_VARIABLE,EVENT_ID_ADD_VARIABLE_GROUP 
     52           EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP, EVENT_ID_ADD_VARIABLE, 
     53           EVENT_ID_ADD_VARIABLE_GROUP, EVENT_ID_CREATE_ENABLED_FIELDS 
    4554         } ; 
    46           
     55 
    4756         typedef CFileAttributes RelAttributes; 
    4857         typedef CFileGroup      RelGroup; 
     
    5463         CFile(const CFile * const file); // Not implemented yet. 
    5564 
     65         /// Destructeur /// 
     66         virtual ~CFile(void); 
     67 
     68      public: 
    5669         /// Accesseurs /// 
    5770         boost::shared_ptr<CDataOutput> getDataOutput(void) const; 
     
    6679 
    6780      public : 
    68  
    69          /// Mutateurs /// 
    70          void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); 
    71          void setVirtualFieldGroup(void); 
    72          void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); 
    73          void setVirtualVariableGroup(void); 
    74          void processEnabledFile(void) ; 
    75          void processEnabledFields(void) ; 
    76          void createHeader(void); 
    77          void close(void) ; 
    78           
    79          /// Traitements /// 
    80          virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
    81          void solveFieldRefInheritance(bool apply); 
    82          void solveEFGridRef(void); 
    83          void solveEFOperation(void); 
    84          void solveEFExpression(void); 
    85  
    86          /// Destructeur /// 
    87          virtual ~CFile(void); 
    88  
    89          /// Autres /// 
    90          virtual void parse(xml::CXMLNode & node); 
    91          virtual StdString toString(void) const; 
    92           
    93 //         virtual void toBinary  (StdOStream & os) const; 
    94 //         virtual void fromBinary(StdIStream & is); 
    95  
    96          /// Accesseurs statiques /// 
    97          static StdString GetName(void); 
    98          static StdString GetDefName(void); 
    99           
    100          static ENodeType GetType(void); 
    101           
    102          bool allDomainEmpty ; 
    103          CField* addField(const string& id="") ; 
    104          CFieldGroup* addFieldGroup(const string& id="") ; 
    105          CVariable* addVariable(const string& id="") ; 
    106          CVariableGroup* addVariableGroup(const string& id="") ; 
    107          void sendAddField(const string& id="") ; 
    108          void sendAddFieldGroup(const string& id="") ; 
    109          static void recvAddField(CEventServer& event) ; 
    110          void recvAddField(CBufferIn& buffer) ; 
    111          static void recvAddFieldGroup(CEventServer& event) ; 
    112          void recvAddFieldGroup(CBufferIn& buffer) ; 
    113           
    114          void sendAddVariable(const string& id="") ; 
    115          void sendAddVariableGroup(const string& id="") ; 
    116          static void recvAddVariable(CEventServer& event) ; 
    117          void recvAddVariable(CBufferIn& buffer) ; 
    118          static void recvAddVariableGroup(CEventServer& event) ; 
    119          void recvAddVariableGroup(CBufferIn& buffer) ; 
    120          static bool dispatchEvent(CEventServer& event) ; 
    121           
     81         // Some functions to verify state of file 
    12282         bool isSyncTime(void) ; 
    12383         bool checkSplit(void) ; 
     
    12585         void checkFile(void) ; 
    12686         void initFile(void) ; 
     87 
     88         /// Mutateurs /// 
     89         // Set some root definitions in a file 
     90         void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); 
     91         void setVirtualFieldGroup(void); 
     92         void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); 
     93         void setVirtualVariableGroup(void); 
     94 
     95         void createHeader(void); 
     96         void close(void) ; 
     97 
     98         // Some processing on file 
     99         void solveFieldRefInheritance(bool apply); 
     100         void solveEFGridRef(void); 
     101         void solveEFOperation(void); 
     102         void solveEFExpression(void); 
     103         void processEnabledFile(void) ; 
     104         void processEnabledFields(void) ; 
     105         void solveAllRefOfEnabledFields(bool sendToServer); 
     106         void buildAllExpressionOfEnabledFields(); 
     107 
     108         // Add component into file 
     109         CField* addField(const string& id="") ; 
     110         CFieldGroup* addFieldGroup(const string& id="") ; 
     111         CVariable* addVariable(const string& id="") ; 
     112         CVariableGroup* addVariableGroup(const string& id="") ; 
     113 
     114         // Send info to serever 
     115         void sendEnabledFields(); 
     116         void sendAddField(const string& id="") ; 
     117         void sendAddFieldGroup(const string& id="") ; 
     118         void sendAddAllVariables(); 
     119         void sendAddVariable(const string& id="") ; 
     120         void sendAddVariableGroup(const string& id="") ; 
     121 
     122         // Receive info from client 
     123         static void recvAddField(CEventServer& event) ; 
     124         void recvAddField(CBufferIn& buffer) ; 
     125         static void recvAddFieldGroup(CEventServer& event) ; 
     126         void recvAddFieldGroup(CBufferIn& buffer) ; 
     127         static void recvAddVariable(CEventServer& event) ; 
     128         void recvAddVariable(CBufferIn& buffer) ; 
     129         static void recvAddVariableGroup(CEventServer& event) ; 
     130         void recvAddVariableGroup(CBufferIn& buffer) ; 
     131 
     132         // Dispatch event 
     133         static bool dispatchEvent(CEventServer& event) ; 
     134 
     135      public: 
     136         /// Accesseurs statiques /// 
     137         static StdString GetName(void); 
     138         static StdString GetDefName(void); 
     139 
     140         static ENodeType GetType(void); 
     141      public: 
     142         /// Traitements /// 
     143         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
     144 
     145          /// Autres /// 
     146         virtual void parse(xml::CXMLNode & node); 
     147         virtual StdString toString(void) const; 
     148      public: 
     149 
    127150         CDate* lastSync ; 
    128151         CDate* lastSplit ; 
     
    132155         int nbDomain ; 
    133156         bool isOpen ; 
     157         bool allDomainEmpty ; 
    134158         MPI_Comm fileComm ; 
     159 
    135160      private : 
    136  
    137161         /// Propriétés privées /// 
    138162         CFieldGroup* vFieldGroup; 
     
    140164         boost::shared_ptr<CDataOutput> data_out; 
    141165         std::vector<CField*> enabledFields; 
     166 
     167      public: 
     168        //         virtual void toBinary  (StdOStream & os) const; 
     169        //         virtual void fromBinary(StdIStream & is); 
    142170 
    143171   }; // class CFile 
Note: See TracChangeset for help on using the changeset viewer.