Ignore:
Timestamp:
04/26/11 13:21:35 (13 years ago)
Author:
hozdoba
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.