Changeset 184 for XMLIO_V2/dev/dev_rv


Ignore:
Timestamp:
04/26/11 13:21:35 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv/src/xmlio
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/config/domain_attribute.conf

    r180 r184  
    4040 
    4141/* LOCAL */ 
     42DECLARE_ATTRIBUTE(int             , zoom_ni_loc) 
     43DECLARE_ATTRIBUTE(int             , zoom_nj_loc) 
     44DECLARE_ATTRIBUTE(int             , zoom_ibegin_loc) 
     45DECLARE_ATTRIBUTE(int             , zoom_jbegin_loc) 
     46 
     47/* LOCAL */ 
    4248DECLARE_ATTRIBUTE(int             , data_n_index) 
    4349DECLARE_ATTRIBUTE(ARRAY(int, 1)   , data_i_index) 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90

    r183 r184  
    2424      TYPE(XDate)                       :: init_date_nemo  = XDate(1985, 03, 15, 17, 35, 00) 
    2525      TYPE(XHandle)                     :: nemo_style_ctxt = NULLHANDLE 
    26       TYPE(XHandle)                     :: temp_mod   = NULLHANDLE, & 
    27                                            temp_mod_  = NULLHANDLE, & 
    28                                            temp_mod__ = NULLHANDLE 
     26      TYPE(XHandle)                     :: temp_mod    = NULLHANDLE, & 
     27                                           temp_mod_   = NULLHANDLE, & 
     28                                           temp_mod__  = NULLHANDLE, & 
     29                                           temp_mod___ = NULLHANDLE 
    2930 
    3031 
     
    130131                                long_name_     = "le champ 4", & 
    131132                                grid_ref_   = "simple_grille") 
     133                                 
     134      CALL xml_tree_add(parent_hdl  = temp_mod,        & 
     135                        parent_type = GFIELD,          & 
     136                        child_hdl   = temp_mod__,      & 
     137                        child_type  = EFIELD,          & 
     138                        child_id    = "champ_3D_k8_average_zoom") 
     139 
     140      CALL set_field_attributes(field_hdl      = temp_mod__,   & 
     141                                ftype          = EFIELD,       & 
     142                                prec_          = 8,            & 
     143                                operation_     = "average",    & 
     144                                name_          = "champ5",     & 
     145                                standard_name_ = "lechamp5",   & 
     146                                long_name_     = "le champ 5", & 
     147                                grid_ref_   = "simple_grille_zoom") 
    132148 
    133149      CALL xml_tree_add(parent_hdl  = temp_mod_,       & 
     
    158174 
    159175      ! ---------> axis_definition 
     176       
    160177      CALL handle_create(temp_mod, GAXIS,  "axis_definition") 
    161178      CALL xml_tree_add(parent_hdl  = temp_mod,   & 
     
    190207                        child_type  = GDOMAIN,    & 
    191208                        child_id    = "all_domain") 
    192  
    193       CALL xml_tree_add(parent_hdl  = temp_mod_,  & 
    194                         parent_type = GDOMAIN,    & 
    195                         child_hdl   = temp_mod & 
    196                         child_type  = EDOMAIN,    & 
    197                         child_id    = "simple_domaine0") 
     209                         
     210      CALL xml_tree_add(parent_hdl  = temp_mod_,   & 
     211                        parent_type = GDOMAIN,     & 
     212                        child_hdl   = temp_mod___, & 
     213                        child_type  = GDOMAIN,     & 
     214                        child_id    = "simple_domaine_grp") 
    198215 
    199216      IF (rankGrp .EQ. 0) THEN 
     
    211228         data_ni     = 50 
    212229         data_ibegin = 1 
    213       END IF 
    214  
    215       CALL set_domain_attributes(domain_hdl     = temp_mod,       & 
    216                                  ftype          = EDOMAIN,        & 
    217                                  name_          = "domaine0",     & 
    218                                  standard_name_ = "ledomaine0",   & 
    219                                  long_name_     = "le domaine 0", & 
     230      END IF  
     231 
     232      CALL set_domain_attributes(domain_hdl     = temp_mod___,    & 
     233                                 ftype          = GDOMAIN,        & 
    220234                                 lonvalue_      = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), & 
    221235                                 latvalue_      = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), & 
     
    228242                                 jend_          = jend,           & 
    229243                                 data_ni_       = data_ni,        & 
    230                                  data_ibegin_   = data_ibegin) 
     244                                 data_ibegin_   = data_ibegin)                        
     245 
     246      CALL xml_tree_add(parent_hdl  = temp_mod___,& 
     247                        parent_type = GDOMAIN,    & 
     248                        child_hdl   = temp_mod,   & 
     249                        child_type  = EDOMAIN,    & 
     250                        child_id    = "simple_domaine0") 
     251 
     252      CALL set_domain_attributes(domain_hdl     = temp_mod,       & 
     253                                 ftype          = EDOMAIN,        & 
     254                                 name_          = "domaine0",     & 
     255                                 standard_name_ = "ledomaine0",   & 
     256                                 long_name_     = "le domaine 0") 
     257                                  
     258      CALL xml_tree_add(parent_hdl  = temp_mod___,& 
     259                        parent_type = GDOMAIN,    & 
     260                        child_hdl   = temp_mod,   & 
     261                        child_type  = EDOMAIN,    & 
     262                        child_id    = "simple_domaine0_zoom") 
     263                         
     264      CALL set_domain_attributes(domain_hdl     = temp_mod,           & 
     265                                 ftype          = EDOMAIN,            & 
     266                                 name_          = "domaine0zoom",     & 
     267                                 standard_name_ = "ledomaine0zoom",   & 
     268                                 long_name_     = "le domaine 0 zoom",& 
     269                                 zoom_ibegin_   = 21,                 & 
     270                                 zoom_jbegin_   = 5 ,                 & 
     271                                 zoom_ni_       = 60,                 & 
     272                                 zoom_nj_       = 15) 
    231273 
    232274      CALL xml_tree_add(parent_hdl  = temp_mod_,  & 
     
    251293                                 ftype          = EDOMAIN,        & 
    252294                                 name_          = "domaine1",     & 
    253                                  standard_name_ = "ledomaine0",   & 
     295                                 standard_name_ = "ledomaine1",   & 
    254296                                 long_name_     = "le domaine 1", & 
    255297                                 lonvalue_      = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), & 
     
    277319                               domain_ref_  = "simple_domaine1", & 
    278320                               axis_ref_    = "simple_axe") 
     321                                
     322      CALL xml_tree_add(parent_hdl  = temp_mod,   & 
     323                        parent_type = GGRID,      & 
     324                        child_hdl   = temp_mod_,  & 
     325                        child_type  = EGRID,      & 
     326                        child_id    = "simple_grille_zoom") 
     327 
     328      CALL set_grid_attributes(grid_hdl     = temp_mod_,         & 
     329                               ftype        = EGRID,             & 
     330                               name_        = "grille2",         & 
     331                               description_ = "la grille 2",     & 
     332                               domain_ref_  = "simple_domaine0_zoom", & 
     333                               axis_ref_    = "simple_axe") 
    279334 
    280335      ! ---------> file_definition 
     
    299354                        child_hdl   = temp_mod__, & 
    300355                        child_type  = EFIELD) 
     356                         
     357      CALL set_field_attributes(field_hdl      = temp_mod__,       & 
     358                                ftype          = EFIELD,           & 
     359                                field_ref_     = "champ_3D_k8_average_zoom")   
     360 
     361      CALL xml_tree_add(parent_hdl  = temp_mod_,  & 
     362                        parent_type = EFILE,      & 
     363                        child_hdl   = temp_mod__, & 
     364                        child_type  = EFIELD) 
    301365 
    302366      CALL set_field_attributes(field_hdl      = temp_mod__,       & 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp

    r183 r184  
    4141   { 
    4242      return (this->relFiles); 
     43   } 
     44 
     45   //---------------------------------------------------------------- 
     46    
     47   bool CDomain::hasZoom(void) const 
     48   { 
     49      return ((this->zoom_ni.getValue() != this->ni_glo.getValue()) &&  
     50              (this->zoom_nj.getValue() != this->nj_glo.getValue())); 
     51   } 
     52    
     53   //---------------------------------------------------------------- 
     54    
     55   bool CDomain::isEmpty(void) const 
     56   { 
     57      return ((this->zoom_ni_loc.getValue() == 0) ||  
     58              (this->zoom_nj_loc.getValue() == 0)); 
    4359   } 
    4460 
     
    196212      if (!zoom_ibegin.isEmpty()) 
    197213      { 
    198          int zoom_iend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
     214         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 
    199215         int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
    200216          
     
    203219         iend_mask   = min (iend.getValue(), zoom_iend); 
    204220         jend_mask   = min (jend.getValue(), zoom_jend); 
    205           
     221                  
    206222         ibegin_mask -= ibegin.getValue(); 
    207223         jbegin_mask -= jbegin.getValue(); 
     
    211227       
    212228      //~ std::cout << "-------------------" << std::endl 
    213       //~           << "zoom : " << std::boolalpha << (!zoom_ibegin.isEmpty()) << std::endl 
    214       //~           << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl 
    215       //~           << "i : " << ibegin_mask << ", " << iend_mask << std::endl 
    216       //~           << "j : " << jbegin_mask << ", " << jend_mask << std::endl 
    217       //~           << "-------------------" << std::endl; 
     229                //~ << "zoom : " << std::boolalpha << this->hasZoom() << std::endl 
     230                //~ << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl 
     231                //~ << "it : " << ibegin.getValue() << ", " << iend.getValue() << std::endl 
     232                //~ << "jt : " << jbegin.getValue() << ", " << jend.getValue() << std::endl 
     233                //~ << "im : " << ibegin_mask << ", " << iend_mask << std::endl 
     234                //~ << "jm : " << jbegin_mask << ", " << jend_mask << std::endl 
     235                //~ << "-------------------" << std::endl; 
    218236 
    219237      if (!mask.isEmpty()) 
     
    250268            } 
    251269         } 
    252                 
    253270                
    254271         mask.setValue(__arr); 
     
    436453   void CDomain::checkZoom(void) 
    437454   { 
     455      // Résolution et vérification des données globales de zoom. 
    438456      if (!this->zoom_ni.isEmpty() || !this->zoom_nj.isEmpty() || 
    439457          !this->zoom_ibegin.isEmpty() || !this->zoom_jbegin.isEmpty()) 
     
    447465         else 
    448466         { 
    449             int zoom_iend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
     467            int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 
    450468            int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
    451469                 
    452470            if (zoom_ibegin.getValue() < 1  || zoom_jbegin.getValue() < 1 || 
    453                 zoom_iend > iend.getValue() || zoom_jend > jend.getValue()) 
     471                zoom_iend > ni_glo.getValue() || zoom_jend > nj_glo.getValue()) 
    454472               ERROR("CDomain::checkZoom(void)", 
    455473                     << "Zoom mal défini," 
    456474                     << " vérifiez les valeurs zoom_ni, zoom_nj, zoom_ibegin, zoom_ibegin") ; 
    457475         } 
    458       }    
     476      } 
     477      else 
     478      { 
     479         this->zoom_ni.setValue(this->ni_glo.getValue());  
     480         this->zoom_nj.setValue(this->nj_glo.getValue()); 
     481         this->zoom_ibegin.setValue(1); 
     482         this->zoom_jbegin.setValue(1); 
     483      } 
     484      // Résolution des données locales de zoom. 
     485      { 
     486         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 
     487         int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
     488          
     489         if ((zoom_ibegin.getValue() > iend.getValue()) ||  
     490             (zoom_iend < ibegin.getValue())) 
     491         { 
     492            zoom_ni_loc.setValue(0); 
     493            zoom_ibegin_loc.setValue(-1); 
     494         } 
     495         else 
     496         { 
     497            int zoom_ibegin_loc_ = (zoom_ibegin.getValue() > ibegin.getValue())  
     498                                 ? zoom_ibegin.getValue() 
     499                                 : ibegin.getValue(); 
     500            int zoom_iend_loc_  = (zoom_iend < iend.getValue())  
     501                                 ? zoom_iend 
     502                                 : iend.getValue(); 
     503            int zoom_ni_loc_ = zoom_iend_loc_ - zoom_ibegin_loc_ + 1; 
     504             
     505            zoom_ni_loc.setValue(zoom_ni_loc_); 
     506            zoom_ibegin_loc.setValue(zoom_ibegin_loc_-ibegin.getValue()+1); 
     507         } 
     508          
     509         if ((zoom_jbegin.getValue() > jend.getValue()) ||  
     510             (zoom_jend < jbegin.getValue())) 
     511         { 
     512            zoom_nj_loc.setValue(0); 
     513            zoom_jbegin_loc.setValue(-1); 
     514         } 
     515         else 
     516         { 
     517            int zoom_jbegin_loc_ = (zoom_jbegin.getValue() > jbegin.getValue())  
     518                                 ? zoom_jbegin.getValue() 
     519                                 : jbegin.getValue(); 
     520            int zoom_jend_loc_  = (zoom_jend < jend.getValue())  
     521                                 ? zoom_jend 
     522                                 : jend.getValue(); 
     523            int zoom_nj_loc_ = zoom_jend_loc_ - zoom_jbegin_loc_ + 1; 
     524             
     525            zoom_nj_loc.setValue(zoom_nj_loc_); 
     526            zoom_jbegin_loc.setValue(zoom_jbegin_loc_-jbegin.getValue()+1); 
     527         } 
     528      } 
    459529   } 
    460530 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp

    r183 r184  
    8383         /// Test /// 
    8484         bool IsWritten(const StdString & filename) const; 
     85         bool hasZoom(void) const; 
     86         bool isEmpty(void) const; 
    8587          
    8688      public : 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp

    r183 r184  
    148148 
    149149   void CGrid::computeIndex(void) 
    150    {     
     150   {   
    151151      const int ni   = domain->ni.getValue() , 
    152152                nj   = domain->nj.getValue() , 
     
    293293   { 
    294294      SuperClass::toBinary(os); 
    295       this->storeIndex[0]->toBinary(os); 
    296       this->out_i_index[0]->toBinary(os); 
    297       this->out_j_index[0]->toBinary(os); 
    298       this->out_l_index[0]->toBinary(os); 
     295      
     296      os.write (reinterpret_cast<const char*>(&this->isChecked), sizeof(bool));  
     297      
     298      if (this->isChecked) 
     299      { 
     300         this->storeIndex [0]->toBinary(os); 
     301         this->out_i_index[0]->toBinary(os); 
     302         this->out_j_index[0]->toBinary(os); 
     303         this->out_l_index[0]->toBinary(os); 
     304      } 
    299305   } 
    300306 
     
    303309   void CGrid::fromBinary(StdIStream & is) 
    304310   { 
    305       SuperClass::fromBinary(is); 
    306        
    307       ARRAY_CREATE(storeIndex_ , int, 1, [1]); 
    308       ARRAY_CREATE(out_l_index_, int, 1, [1]); 
    309       ARRAY_CREATE(out_i_index_, int, 1, [1]); 
    310       ARRAY_CREATE(out_j_index_, int, 1, [1]); 
    311        
    312       storeIndex_ ->fromBinary(is); 
    313       out_i_index_->fromBinary(is); 
    314       out_j_index_->fromBinary(is); 
    315       out_l_index_->fromBinary(is); 
    316        
    317       this->storeIndex .push_back(storeIndex_); 
    318       this->out_i_index.push_back(out_i_index_); 
    319       this->out_j_index.push_back(out_j_index_); 
    320       this->out_l_index.push_back(out_l_index_); 
     311      bool hasIndex = false; 
     312      SuperClass::fromBinary(is);             
     313      is.read (reinterpret_cast<char*>(&hasIndex), sizeof(bool));  
     314       
     315      if (hasIndex) 
     316      { 
     317         ARRAY_CREATE(storeIndex_ , int, 1, [0]); 
     318         ARRAY_CREATE(out_l_index_, int, 1, [0]); 
     319         ARRAY_CREATE(out_i_index_, int, 1, [0]); 
     320         ARRAY_CREATE(out_j_index_, int, 1, [0]); 
     321          
     322         storeIndex_ ->fromBinary(is); 
     323         out_i_index_->fromBinary(is); 
     324         out_j_index_->fromBinary(is); 
     325         out_l_index_->fromBinary(is); 
     326          
     327         this->storeIndex .push_back(storeIndex_); 
     328         this->out_i_index.push_back(out_i_index_); 
     329         this->out_j_index.push_back(out_j_index_); 
     330         this->out_l_index.push_back(out_l_index_); 
     331      } 
    321332   } 
    322333    
     
    336347      const int jbegin_srv = this->domain->jbegin.getValue(); 
    337348       
     349      const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); 
     350      const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue(); 
     351            
    338352      StdSize dn = 0;       
    339353      for (StdSize j = 1; j < this->out_i_index.size(); j++) 
    340354         dn += this->out_i_index[j]->size(); 
    341355          
    342       ARRAY_ASSIGN(storeIndex_srv, int, 1, [dn]); 
     356      ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]); 
    343357      ARRAY_ASSIGN(out_i_index_srv, int, 1, [dn]); 
    344358      ARRAY_ASSIGN(out_j_index_srv, int, 1, [dn]); 
     
    347361      for (StdSize i = 0, dn = 0; i < ibegin.size(); i++) 
    348362      { 
    349          ARRAY(int, 1) storeIndex_cl   =  this->storeIndex[i+1]; 
    350          ARRAY(int, 1) out_i_index_cl  =  this->out_i_index[i+1]; 
    351          ARRAY(int, 1) out_j_index_cl  =  this->out_j_index[i+1]; 
    352          ARRAY(int, 1) out_l_index_cl  =  this->out_l_index[i+1]; 
     363         ARRAY(int, 1) storeIndex_cl   =  this->storeIndex [i + 1]; 
     364         ARRAY(int, 1) out_i_index_cl  =  this->out_i_index[i + 1]; 
     365         ARRAY(int, 1) out_j_index_cl  =  this->out_j_index[i + 1]; 
     366         ARRAY(int, 1) out_l_index_cl  =  this->out_l_index[i + 1]; 
    353367          
    354368         const int ibegin_cl = ibegin[i]; 
     
    357371         for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    358372         { 
    359             (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn; 
    360             (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + (ibegin_cl - 1) - (ibegin_srv - 1); 
    361             (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + (jbegin_cl - 1) - (jbegin_srv - 1); 
     373            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn; // Faux mais inutile dans tous les cas. 
     374            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
     375                                  + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1); 
     376            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
     377                                  + (jbegin_cl - 1) - (jbegin_srv - 1) - (jbegin_zoom_srv - 1); 
    362378            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    363379         } 
     
    367383      } 
    368384       
    369       //~ StdOFStream ofs(this->getId().c_str()); 
    370       //~ for (StdSize h = 0; h < storeIndex_srv->size(); h++) 
    371       //~ { 
    372       //~   ofs << "(" << (*storeIndex_srv)[h]  << ";" 
    373       //~       << (*out_i_index_srv)[h] << "," 
    374       //~       << (*out_j_index_srv)[h] << "," 
    375       //~       << (*out_l_index_srv)[h] << ")" << std::endl; 
    376       //~ } 
    377       //~ ofs.close(); 
     385      StdOFStream ofs(this->getId().c_str()); 
     386      for (StdSize h = 0; h < storeIndex_srv->size(); h++) 
     387      { 
     388        ofs << "(" << (*storeIndex_srv)[h]  << ";" 
     389            << (*out_i_index_srv)[h] << "," 
     390            << (*out_j_index_srv)[h] << "," 
     391            << (*out_l_index_srv)[h] << ")" << std::endl; 
     392      } 
     393      ofs.close(); 
    378394       
    379395   } 
     
    385401                           ARRAY(double, 1)  storedServer) const 
    386402   { 
    387       if (this->storeIndex.size()-1 != storedClient.size()) 
     403      if ((this->storeIndex.size() -1 ) != storedClient.size()) 
    388404         ERROR("CGrid::inputFieldServer(...)", 
    389405                << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", " 
Note: See TracChangeset for help on using the changeset viewer.