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

Location:
XIOS/trunk/src/interface/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/c/icdata.cpp

    r501 r509  
    9292     CTimer::get("XIOS close definition").resume() ; 
    9393     CContext* context = CContext::getCurrent() ; 
     94//     context->setClientServerBuffer(); 
    9495     context->closeDefinition() ; 
    9596     CTimer::get("XIOS close definition").suspend() ; 
     
    257258      { 
    258259        CVariable::get(context->getId(),varIdStr)->setData<double>(data); 
    259         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     260        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    260261      } 
    261262 
     
    278279      { 
    279280        CVariable::get(context->getId(),varIdStr)->setData<float>(data); 
    280         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     281        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    281282      } 
    282283 
     
    299300      { 
    300301        CVariable::get(context->getId(),varIdStr)->setData<int>(data); 
    301         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     302        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    302303      } 
    303304 
     
    321322      { 
    322323        CVariable::get(context->getId(),varIdStr)->setData<bool>(data); 
    323         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     324        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    324325      } 
    325326 
     
    347348      { 
    348349        CVariable::get(context->getId(),varIdStr)->setData<string>(dataStr); 
    349         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     350        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    350351      } 
    351352 
  • XIOS/trunk/src/interface/c/icdate.cpp

    r501 r509  
    3131         CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second, 0}; 
    3232         xios::CContext* context = CContext::getCurrent() ; 
    33           
    34             context->timestep.setValue(dur.toString()); 
    35             context->sendAttributToServer("timestep") ; 
    36           CTimer::get("XIOS").suspend() ; 
     33         context->timestep.setValue(dur.toString()); 
     34         CTimer::get("XIOS").suspend() ; 
    3735      } 
    3836      catch (xios::CException & exc) 
     
    4240      } 
    4341   } 
    44     
     42 
    4543   void cxios_update_calendar(int step) 
    4644   { 
     
    5149      context->sendUpdateCalendar(step) ; 
    5250      CTimer::get("XIOS").suspend() ; 
    53        
    5451   } 
    5552 
  • XIOS/trunk/src/interface/c/icxml_tree.cpp

    r501 r509  
    4444   typedef xios::CAxis      * XAxisPtr; 
    4545   typedef xios::CAxisGroup * XAxisGroupPtr; 
    46   
     46 
    4747   typedef xios::CVariable      *  XVariablePtr; 
    4848   typedef xios::CVariableGroup *  XVariableGroupPtr; 
    49    
     49 
    5050   // ----------------------- Ajout d'enfant à un parent ----------------------- 
    51     
     51 
    5252   void cxios_xml_tree_add_field 
    5353      (XFieldGroupPtr  parent_, XFieldPtr * child_, const char * child_id, int child_id_size) 
    5454   { 
    55       std::string child_id_str;  
    56       CTimer::get("XIOS").resume() ; 
    57       if (cstr2string(child_id, child_id_size, child_id_str)) 
    58       { 
    59          *child_ = parent_->createChild(child_id_str) ; 
    60          parent_->sendCreateChild(child_id_str) ; 
    61       } 
    62       else 
    63       { 
    64          *child_ = parent_->createChild() ; 
    65          parent_->sendCreateChild() ; 
     55      std::string child_id_str; 
     56      CTimer::get("XIOS").resume() ; 
     57      if (cstr2string(child_id, child_id_size, child_id_str)) 
     58      { 
     59         *child_ = parent_->createChild(child_id_str) ; 
     60      } 
     61      else 
     62      { 
     63         *child_ = parent_->createChild() ; 
    6664      } 
    6765      CTimer::get("XIOS").suspend() ; 
    6866  } 
    69     
     67 
    7068   void cxios_xml_tree_add_grid 
    7169      (XGridGroupPtr   parent_, XGridPtr * child_, const char * child_id, int child_id_size) 
    7270   { 
    73       std::string child_id_str;  
    74       CTimer::get("XIOS").resume() ; 
    75       if (cstr2string(child_id, child_id_size, child_id_str)) 
    76       { 
    77          *child_ = parent_->createChild(child_id_str) ; 
    78          parent_->sendCreateChild(child_id_str) ; 
    79       } 
    80       else 
    81       { 
    82          *child_ = parent_->createChild() ; 
    83          parent_->sendCreateChild() ; 
    84       } 
    85       CTimer::get("XIOS").suspend() ; 
    86    } 
    87     
     71      std::string child_id_str; 
     72      CTimer::get("XIOS").resume() ; 
     73      if (cstr2string(child_id, child_id_size, child_id_str)) 
     74      { 
     75         *child_ = parent_->createChild(child_id_str) ; 
     76      } 
     77      else 
     78      { 
     79         *child_ = parent_->createChild() ; 
     80      } 
     81      CTimer::get("XIOS").suspend() ; 
     82   } 
     83 
    8884   void cxios_xml_tree_add_file 
    8985      (XFileGroupPtr parent_, XFilePtr * child_, const char * child_id, int child_id_size) 
    9086   { 
    91       std::string child_id_str;  
    92       CTimer::get("XIOS").resume() ; 
    93       if (cstr2string(child_id, child_id_size, child_id_str)) 
    94       { 
    95          *child_ = parent_->createChild(child_id_str) ; 
    96          parent_->sendCreateChild(child_id_str) ; 
    97       } 
    98       else 
    99       { 
    100          *child_ = parent_->createChild() ; 
    101          parent_->sendCreateChild() ; 
    102       } 
    103       CTimer::get("XIOS").suspend() ; 
    104    } 
    105     
     87      std::string child_id_str; 
     88      CTimer::get("XIOS").resume() ; 
     89      if (cstr2string(child_id, child_id_size, child_id_str)) 
     90      { 
     91         *child_ = parent_->createChild(child_id_str) ; 
     92      } 
     93      else 
     94      { 
     95         *child_ = parent_->createChild() ; 
     96      } 
     97      CTimer::get("XIOS").suspend() ; 
     98   } 
     99 
    106100   void cxios_xml_tree_add_axis 
    107101      (XAxisGroupPtr parent_, XAxisPtr * child_, const char * child_id, int child_id_size) 
    108102   { 
    109       std::string child_id_str;  
    110       CTimer::get("XIOS").resume() ; 
    111       if (cstr2string(child_id, child_id_size, child_id_str)) 
    112       { 
    113          *child_ = parent_->createChild(child_id_str) ; 
    114          parent_->sendCreateChild(child_id_str) ; 
    115       } 
    116       else 
    117       { 
    118          *child_ = parent_->createChild() ; 
    119          parent_->sendCreateChild() ; 
    120       } 
    121       CTimer::get("XIOS").suspend() ; 
    122    } 
    123     
     103      std::string child_id_str; 
     104      CTimer::get("XIOS").resume() ; 
     105      if (cstr2string(child_id, child_id_size, child_id_str)) 
     106      { 
     107         *child_ = parent_->createChild(child_id_str) ; 
     108      } 
     109      else 
     110      { 
     111         *child_ = parent_->createChild() ; 
     112      } 
     113      CTimer::get("XIOS").suspend() ; 
     114   } 
     115 
    124116   void cxios_xml_tree_add_domain 
    125117      (XDomainGroupPtr parent_, XDomainPtr * child_, const char * child_id, int child_id_size) 
     
    130122      { 
    131123         *child_ = parent_->createChild(child_id_str) ; 
    132          parent_->sendCreateChild(child_id_str) ; 
    133       } 
    134       else 
    135       { 
    136          *child_ = parent_->createChild() ; 
    137          parent_->sendCreateChild() ; 
    138       } 
    139       CTimer::get("XIOS").suspend() ; 
    140    } 
    141     
     124      } 
     125      else 
     126      { 
     127         *child_ = parent_->createChild() ; 
     128      } 
     129      CTimer::get("XIOS").suspend() ; 
     130   } 
     131 
    142132   void cxios_xml_tree_add_fieldtofile 
    143133      (XFilePtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) 
     
    145135      std::string child_id_str; 
    146136      CTimer::get("XIOS").resume() ; 
    147   
     137 
    148138      if (cstr2string(child_id, child_id_size, child_id_str)) 
    149139      { 
    150140         *child_ = parent_->addField(child_id_str); 
    151          parent_->sendAddField(child_id_str) ; 
    152141      } 
    153142      else 
    154143      { 
    155144         *child_ = parent_->addField(); 
    156          parent_->sendAddField() ; 
    157145      } 
    158146      CTimer::get("XIOS").suspend() ; 
     
    164152      std::string child_id_str; 
    165153      CTimer::get("XIOS").resume() ; 
    166   
     154 
    167155      if (cstr2string(child_id, child_id_size, child_id_str)) 
    168156      { 
    169157         *child_ = parent_->addVariable(child_id_str); 
    170          parent_->sendAddVariable(child_id_str) ; 
    171158      } 
    172159      else 
    173160      { 
    174161         *child_ = parent_->addVariable(); 
    175          parent_->sendAddVariable() ; 
    176       } 
    177       CTimer::get("XIOS").suspend() ; 
    178    } 
    179     
     162      } 
     163      CTimer::get("XIOS").suspend() ; 
     164   } 
     165 
    180166    void cxios_xml_tree_add_variabletofield 
    181167      (XFieldPtr parent_, XVariablePtr * child_, const char * child_id, int child_id_size) 
     
    183169      std::string child_id_str; 
    184170      CTimer::get("XIOS").resume() ; 
    185   
     171 
    186172      if (cstr2string(child_id, child_id_size, child_id_str)) 
    187173      { 
    188174         *child_ = parent_->addVariable(child_id_str); 
    189          parent_->sendAddVariable(child_id_str) ; 
    190175      } 
    191176      else 
    192177      { 
    193178         *child_ = parent_->addVariable(); 
    194          parent_->sendAddVariable() ; 
    195       } 
    196       CTimer::get("XIOS").suspend() ; 
    197    }   
     179      } 
     180      CTimer::get("XIOS").suspend() ; 
     181   } 
    198182   // ----------------------- Ajout de groupe à un parent ---------------------- 
    199183 
     
    201185      (XFieldGroupPtr  parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) 
    202186   { 
    203      std::string child_id_str;  
    204       CTimer::get("XIOS").resume() ; 
    205       if (cstr2string(child_id, child_id_size, child_id_str)) 
    206       { 
    207          *child_ = parent_->createChildGroup(child_id_str) ; 
    208          parent_->sendCreateChildGroup(child_id_str) ; 
    209       } 
    210       else 
    211       { 
    212          *child_ = parent_->createChildGroup() ; 
    213          parent_->sendCreateChildGroup(child_id_str) ; 
     187     std::string child_id_str; 
     188      CTimer::get("XIOS").resume() ; 
     189      if (cstr2string(child_id, child_id_size, child_id_str)) 
     190      { 
     191         *child_ = parent_->createChildGroup(child_id_str) ; 
     192      } 
     193      else 
     194      { 
     195         *child_ = parent_->createChildGroup() ; 
    214196      } 
    215197      CTimer::get("XIOS").suspend() ; 
     
    224206      { 
    225207         *child_ = parent_->createChildGroup(child_id_str) ; 
    226          parent_->sendCreateChildGroup(child_id_str) ; 
    227       } 
    228       else 
    229       { 
    230          *child_ = parent_->createChildGroup() ; 
    231          parent_->sendCreateChildGroup(child_id_str) ; 
     208      } 
     209      else 
     210      { 
     211         *child_ = parent_->createChildGroup() ; 
    232212      } 
    233213      CTimer::get("XIOS").suspend() ; 
     
    242222      { 
    243223         *child_ = parent_->createChildGroup(child_id_str) ; 
    244          parent_->sendCreateChildGroup(child_id_str) ; 
    245       } 
    246       else 
    247       { 
    248          *child_ = parent_->createChildGroup() ; 
    249          parent_->sendCreateChildGroup(child_id_str) ; 
     224      } 
     225      else 
     226      { 
     227         *child_ = parent_->createChildGroup() ; 
    250228      } 
    251229      CTimer::get("XIOS").suspend() ; 
     
    260238      { 
    261239         *child_ = parent_->createChildGroup(child_id_str) ; 
    262          parent_->sendCreateChildGroup(child_id_str) ; 
    263       } 
    264       else 
    265       { 
    266          *child_ = parent_->createChildGroup() ; 
    267          parent_->sendCreateChildGroup(child_id_str) ; 
     240      } 
     241      else 
     242      { 
     243         *child_ = parent_->createChildGroup() ; 
    268244      } 
    269245      CTimer::get("XIOS").suspend() ; 
     
    278254      { 
    279255         *child_ = parent_->createChildGroup(child_id_str) ; 
    280          parent_->sendCreateChildGroup(child_id_str) ; 
    281       } 
    282       else 
    283       { 
    284          *child_ = parent_->createChildGroup() ; 
    285          parent_->sendCreateChildGroup(child_id_str) ; 
     256      } 
     257      else 
     258      { 
     259         *child_ = parent_->createChildGroup() ; 
    286260      } 
    287261      CTimer::get("XIOS").suspend() ; 
     
    291265      (XFilePtr parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) 
    292266   { 
    293       std::string child_id_str;  
     267      std::string child_id_str; 
    294268      CTimer::get("XIOS").resume() ; 
    295269      if (cstr2string(child_id, child_id_size, child_id_str)) 
    296270      { 
    297271         *child_ = parent_->addFieldGroup(child_id_str); 
    298          parent_->sendAddFieldGroup(child_id_str) ; 
    299272      } 
    300273      else 
    301274      { 
    302275         *child_ = parent_->addFieldGroup(); 
    303          parent_->sendAddFieldGroup() ; 
    304       } 
    305       CTimer::get("XIOS").suspend() ; 
    306    } 
    307     
     276      } 
     277      CTimer::get("XIOS").suspend() ; 
     278   } 
     279 
    308280   void cxios_xml_tree_add_variablegrouptofile 
    309281      (XFilePtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) 
    310282   { 
    311       std::string child_id_str;  
     283      std::string child_id_str; 
    312284      CTimer::get("XIOS").resume() ; 
    313285      if (cstr2string(child_id, child_id_size, child_id_str)) 
    314286      { 
    315287         *child_ = parent_->addVariableGroup(child_id_str); 
    316          parent_->sendAddVariableGroup(child_id_str) ; 
    317288      } 
    318289      else 
    319290      { 
    320291         *child_ = parent_->addVariableGroup(); 
    321          parent_->sendAddVariableGroup() ; 
    322       } 
    323       CTimer::get("XIOS").suspend() ; 
    324    } 
    325     
     292      } 
     293      CTimer::get("XIOS").suspend() ; 
     294   } 
     295 
    326296   void cxios_xml_tree_add_variablegrouptofield 
    327297      (XFieldPtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) 
    328298   { 
    329       std::string child_id_str;  
     299      std::string child_id_str; 
    330300      CTimer::get("XIOS").resume() ; 
    331301      if (cstr2string(child_id, child_id_size, child_id_str)) 
    332302      { 
    333303         *child_ = parent_->addVariableGroup(child_id_str); 
    334          parent_->sendAddVariableGroup(child_id_str) ; 
    335304      } 
    336305      else 
    337306      { 
    338307         *child_ = parent_->addVariableGroup(); 
    339          parent_->sendAddVariableGroup() ; 
    340       } 
    341       CTimer::get("XIOS").suspend() ; 
    342    }    
    343     
    344     
     308      } 
     309      CTimer::get("XIOS").suspend() ; 
     310   } 
     311 
     312 
    345313   // ----------------------- Affichage de l'arborescence ---------------------- 
    346     
    347 //   void cxios_xml_tree_show   (const char * filename, int filename_size)  
     314 
     315//   void cxios_xml_tree_show   (const char * filename, int filename_size) 
    348316//   { 
    349317//      std::string filename_str; 
     
    361329//      } 
    362330//  } 
    363       
    364     
     331 
     332 
    365333   // ----------------------- Parsing de document xml -------------------------- 
    366     
     334 
    367335//   void cxios_xml_parse_file  (const char * filename  , int filename_size)// 
    368336//   { 
    369 //      std::string filename_str;  
     337//      std::string filename_str; 
    370338//      if (!cstr2string(filename, filename_size, filename_str)) return; 
    371339// 
     
    380348//      } 
    381349//   } 
    382     
     350 
    383351//   void cxios_xml_parse_string(const char * xmlcontent, int xmlcontent_size) 
    384352//   { 
    385 //      std::string xmlcontent_str;  
     353//      std::string xmlcontent_str; 
    386354//      if (!cstr2string(xmlcontent, xmlcontent_size, xmlcontent_str)) return; 
    387355// 
     
    396364//      } 
    397365//   } 
    398     
     366 
    399367 
    400368 
Note: See TracChangeset for help on using the changeset viewer.