Ignore:
Timestamp:
09/06/11 16:45:08 (13 years ago)
Author:
hozdoba
Message:

Corrections après tests sur titane

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/common/src/xmlio/node/grid.cpp

    r219 r266  
     1 
    12#include "grid.hpp" 
    23 
     
    100101   //--------------------------------------------------------------- 
    101102 
    102    std::vector<StdSize> CGrid::getShape(void) const 
     103   std::vector<StdSize> CGrid::getLocalShape(void) const 
    103104   { 
    104105      std::vector<StdSize> retvalue; 
    105       retvalue.push_back(this->domain->ni.getValue()); 
    106       retvalue.push_back(this->domain->nj.getValue()); 
     106      retvalue.push_back(domain->zoom_ni_loc.getValue()); 
     107      retvalue.push_back(domain->zoom_nj_loc.getValue()); 
    107108      if (this->withAxis) 
    108109         retvalue.push_back(this->axis->size.getValue()); 
     
    111112   //--------------------------------------------------------------- 
    112113    
    113    StdSize CGrid::getSize(void) const 
     114   StdSize CGrid::getLocalSize(void) const 
    114115   { 
    115116      StdSize retvalue = 1; 
    116       std::vector<StdSize> shape_ = this->getShape(); 
     117      std::vector<StdSize> shape_ = this->getLocalShape(); 
     118      for (StdSize s = 0; s < shape_.size(); s++) 
     119         retvalue *= shape_[s]; 
     120      return (retvalue); 
     121   } 
     122    
     123   //--------------------------------------------------------------- 
     124 
     125   std::vector<StdSize> CGrid::getGlobalShape(void) const 
     126   { 
     127      std::vector<StdSize> retvalue; 
     128      retvalue.push_back(domain->ni.getValue()); 
     129      retvalue.push_back(domain->nj.getValue()); 
     130      if (this->withAxis) 
     131         retvalue.push_back(this->axis->size.getValue()); 
     132      return (retvalue); 
     133   } 
     134   //--------------------------------------------------------------- 
     135    
     136   StdSize CGrid::getGlobalSize(void) const 
     137   { 
     138      StdSize retvalue = 1; 
     139      std::vector<StdSize> shape_ = this->getGlobalShape(); 
    117140      for (StdSize s = 0; s < shape_.size(); s++) 
    118141         retvalue *= shape_[s]; 
     
    129152      if (this->storeIndex.size() == 1) 
    130153      { 
     154          
    131155         this->computeIndex() ; 
    132       } 
    133       else 
    134       { 
    135          this->computeIndexServer(); 
    136       } 
     156         ARRAY_CREATE(storeIndex_ , int, 1, [0]); 
     157         ARRAY_CREATE(out_l_index_, int, 1, [0]); 
     158         ARRAY_CREATE(out_i_index_, int, 1, [0]); 
     159         ARRAY_CREATE(out_j_index_, int, 1, [0]); 
     160                  
     161         this->storeIndex .push_front(storeIndex_); 
     162         this->out_i_index.push_front(out_i_index_); 
     163         this->out_j_index.push_front(out_j_index_); 
     164         this->out_l_index.push_front(out_l_index_); 
     165      } 
     166      this->computeIndexServer(); 
    137167      this->isChecked = true; 
    138168   } 
     
    177207 
    178208   void CGrid::computeIndex(void) 
    179    {   
     209   {     
     210    
    180211      const int ni   = domain->ni.getValue() , 
    181212                nj   = domain->nj.getValue() , 
     
    200231 
    201232      ARRAY(bool, 2) mask = domain->mask.getValue() ; 
     233      ARRAY(int, 2) local_mask =  this->domain->getLocalMask(); 
    202234 
    203235      int indexCount = 0; 
     
    210242                temp_j = (data_dim == 1) ? -1 
    211243                       : (*data_j_index)[n] + data_jbegin; 
    212             i = (data_dim == 1) ? (temp_i - 2) % ni 
     244            i = (data_dim == 1) ? (temp_i - 1) % ni 
    213245                                : (temp_i - 1) ; 
    214             j = (data_dim == 1) ? (temp_i - 2) / ni 
     246            j = (data_dim == 1) ? (temp_i - 1) / ni 
    215247                                : (temp_j - 1) ; 
    216248 
     
    226258      ARRAY_ASSIGN(this->out_i_index[0], int, 1, [indexCount]); 
    227259      ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]); 
    228  
     260       
     261      // for(int count = 0, indexCount = 0,  l = 0; l < size; l++) 
     262      // for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) 
     263 
     264      //for(int n = 0, i = 0, j = 0, count = 0, indexCount = 0; n < data_n_index;  n++) 
     265      //for(int l = 0; l < size; l++, count++) 
     266       
    229267      for(int count = 0, indexCount = 0,  l = 0; l < size; l++) 
    230268      { 
     
    234272                temp_j = (data_dim == 1) ? -1 
    235273                       : (*data_j_index)[n] + data_jbegin; 
    236             i = (data_dim == 1) ? (temp_i - 2) % ni 
     274            i = (data_dim == 1) ? (temp_i - 1) % ni 
    237275                                : (temp_i - 1) ; 
    238             j = (data_dim == 1) ? (temp_i - 2) / ni 
     276            j = (data_dim == 1) ? (temp_i - 1) / ni 
    239277                                : (temp_j - 1) ; 
    240278 
     
    250288         } 
    251289      } 
     290 
     291 
     292//      if (this->storeIndex[0]->size() != 0) 
     293//         for (StdSize u = 0; u < this->storeIndex[0]->size(); u++) 
     294//            (*local_mask)[(*out_i_index[0])[u]][(*out_j_index[0])[u]] = 1; 
     295                                  
     296//      std::cout << "indexCount" << indexCount << std::endl;  
     297//      std::cout << this->getId() << " : "  << (*this->storeIndex[0]).num_elements() << std::endl; 
     298//      StdOFStream ofs2(("log_client_"+this->getId()).c_str()); 
     299//      for (StdSize h = 0; h < storeIndex[0]->size(); h++) 
     300//      { 
     301//        ofs2 << "(" << (*storeIndex[0])[h]  << ";" 
     302//             << (*out_i_index[0])[h] << "," 
     303//             << (*out_j_index[0])[h] << "," 
     304//             << (*out_l_index[0])[h] << ")" << std::endl; 
     305//      } 
     306//      ofs2.close();    
    252307   } 
    253308 
     
    282337         (const ARRAY(double, 1) stored,  ARRAY(double, 3) field) const 
    283338   { 
     339      //std::cout <<"champ : " ; 
    284340      for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) 
     341      { 
    285342         (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] = (*stored)[n] ; 
     343         /*if (storeIndex[0]->num_elements() == 31) 
     344         { 
     345            std::cout << "( " << (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] << ", " 
     346                      << (*out_i_index[0])[n] << ", " 
     347                      << (*out_j_index[0])[n] << ", " 
     348                      << (*out_l_index[0])[n] << ")"; 
     349         }*/ 
     350      } 
     351      //std::cout << std::endl; 
     352 
    286353   } 
    287354 
     
    311378      (const double * const data, ARRAY(double, 1) stored) const 
    312379   { 
    313       const StdSize size = storeIndex[0]->num_elements() ; 
     380      const StdSize size = (this->storeIndex[0])->num_elements() ; 
     381//    std::cout << this->getId() << "> size : " << size << std::endl; 
    314382      stored->resize(boost::extents[size]) ; 
    315383      for(StdSize i = 0; i < size; i++) 
     
    365433   void CGrid::computeIndexServer(void) 
    366434   { 
    367       ARRAY(int, 1) storeIndex_srv   =  this->storeIndex[0]; 
    368       ARRAY(int, 1) out_i_index_srv  =  this->out_i_index[0]; 
    369       ARRAY(int, 1) out_j_index_srv  =  this->out_j_index[0]; 
    370       ARRAY(int, 1) out_l_index_srv  =  this->out_l_index[0]; 
    371  
    372435      ARRAY(int, 2) local_mask =  this->domain->getLocalMask(); 
    373436       
     
    375438      const std::vector<int> & jbegin = this->domain->getJBeginSub(); 
    376439       
    377       const int ibegin_srv = this->domain->ibegin.getValue(); 
    378       const int jbegin_srv = this->domain->jbegin.getValue(); 
    379       const int zoom_ni_srv   = this->domain->zoom_ni_loc.getValue(); 
    380       const int zoom_nj_srv   = this->domain->zoom_nj_loc.getValue(); 
     440      const int ibegin_srv  = this->domain->ibegin.getValue(); 
     441      const int jbegin_srv  = this->domain->jbegin.getValue(); 
     442      const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue(); 
     443      const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue(); 
    381444       
    382445      const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); 
     
    387450         dn += this->out_i_index[j]->size(); 
    388451          
    389       ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]); 
    390       ARRAY_ASSIGN(out_i_index_srv, int, 1, [dn]); 
    391       ARRAY_ASSIGN(out_j_index_srv, int, 1, [dn]); 
    392       ARRAY_ASSIGN(out_l_index_srv, int, 1, [dn]); 
     452      ARRAY_CREATE(storeIndex_srv , int, 1, [dn]); 
     453      ARRAY_CREATE(out_i_index_srv, int, 1, [dn]); 
     454      ARRAY_CREATE(out_j_index_srv, int, 1, [dn]); 
     455      ARRAY_CREATE(out_l_index_srv, int, 1, [dn]); 
    393456       
    394457      for (StdSize i = 0, dn = 0; i < ibegin.size(); i++) 
     
    404467         for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    405468         { 
    406             (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn; // Faux mais inutile dans tous les cas. 
     469            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    407470            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    408471                                  + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1); 
     
    438501            (*local_mask)[(*out_i_index_srv)[u]][(*out_j_index_srv)[u]] = 1; 
    439502 
    440       //~ StdOFStream ofs(this->getId().c_str()); 
    441       //~ for (StdSize h = 0; h < storeIndex_srv->size(); h++) 
    442       //~ { 
    443         //~ ofs << "(" << (*storeIndex_srv)[h]  << ";" 
    444             //~ << (*out_i_index_srv)[h] << "," 
    445             //~ << (*out_j_index_srv)[h] << "," 
    446             //~ << (*out_l_index_srv)[h] << ")" << std::endl; 
    447       //~ } 
    448       //~ ofs.close(); 
     503//      StdOFStream ofs(("log_server_"+this->getId()).c_str()); 
     504//      for (StdSize h = 0; h < storeIndex_srv->size(); h++) 
     505//      { 
     506//        ofs << "(" << (*storeIndex_srv)[h]  << ";" 
     507//            << (*out_i_index_srv)[h] << "," 
     508//            << (*out_j_index_srv)[h] << "," 
     509//            << (*out_l_index_srv)[h] << ")" << std::endl; 
     510//      } 
     511//       ofs.close(); 
     512    
     513      this->storeIndex [0] = storeIndex_srv ; 
     514      this->out_i_index[0] = out_i_index_srv; 
     515      this->out_j_index[0] = out_j_index_srv; 
     516      this->out_l_index[0] = out_l_index_srv; 
     517       
    449518      this->storeIndex.resize(1); 
    450519      this->out_i_index.resize(1); 
     
    454523   } 
    455524    
    456    //---------------------------------------------------------------- 
    457525    
    458526   void CGrid::inputFieldServer 
Note: See TracChangeset for help on using the changeset viewer.