Ignore:
Timestamp:
10/21/11 19:01:35 (13 years ago)
Author:
ymipsl
Message:

reprise en main de la version de H. Ozdoba. Correction de différentes erreurs de conception et bug.
Version NEMO operationnel en client/server, interoperabilita avec OASIS, reconstition de fichiers via netcdf4/HDF5

YM

File:
1 edited

Legend:

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

    r278 r286  
    55#include "object_template_impl.hpp" 
    66#include "group_template_impl.hpp" 
     7#include <iostream> 
     8#include "mpi_manager.hpp" 
    79 
    810namespace xmlioserver { 
     
    140142      for (StdSize s = 0; s < shape_.size(); s++) 
    141143         retvalue *= shape_[s]; 
     144      return (retvalue); 
     145   } 
     146 
     147   StdSize CGrid::getDataSize(void) const 
     148   { 
     149      StdSize retvalue ; 
     150      retvalue=domain->data_ni.getValue() ; 
     151      if (domain->data_dim.getValue()==2) retvalue*=domain->data_nj.getValue() ; 
     152      if (this->withAxis) retvalue*=this->axis->size.getValue() ; 
     153 
    142154      return (retvalue); 
    143155   } 
     
    437449      const std::vector<int> & ibegin = this->domain->getIBeginSub(); 
    438450      const std::vector<int> & jbegin = this->domain->getJBeginSub(); 
     451      const std::vector<int> & iend = this->domain->getIEndSub(); 
     452      const std::vector<int> & jend = this->domain->getJEndSub(); 
    439453      const std::vector<int> & ibegin_zoom = this->domain->getIBeginZoomSub(); 
    440454      const std::vector<int> & jbegin_zoom = this->domain->getJBeginZoomSub(); 
     455      const std::vector<int> & ni_zoom = this->domain->getNiZoomSub(); 
     456      const std::vector<int> & nj_zoom = this->domain->getNjZoomSub(); 
    441457       
    442458      const int ibegin_srv  = this->domain->ibegin.getValue(); 
    443459      const int jbegin_srv  = this->domain->jbegin.getValue(); 
     460      const int iend_srv  = this->domain->iend.getValue(); 
     461      const int jend_srv  = this->domain->jend.getValue(); 
    444462      const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue(); 
    445463      const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue(); 
     
    447465      const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); 
    448466      const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue(); 
    449             
     467       const int iend_zoom_srv = ibegin_zoom_srv + zoom_ni_srv-1 ; 
     468      const int  jend_zoom_srv = jbegin_zoom_srv + zoom_nj_srv-1 ; 
     469         
     470//      std::cout<<"----> computeIndexServer !!"<<std::endl ; 
    450471      StdSize dn = 0;       
    451472      for (StdSize j = 1; j < this->out_i_index.size(); j++) 
     
    466487         int ibegin_zoom_cl = ibegin[i]; //ibegin_zoom[i]; 
    467488         int jbegin_zoom_cl = jbegin[i]; //jbegin_zoom[i]; 
     489         int iend_zoom_cl = iend[i]; //ibegin_zoom[i]; 
     490         int jend_zoom_cl = jend[i]; //jbegin_zoom[i]; 
     491 
     492         int ibegin_cl = ibegin[i]; //ibegin[i]; 
     493         int jbegin_cl = jbegin[i]; //jbegin[i]; 
     494         int iend_cl = iend[i]; //ibegin[i]; 
     495         int jend_cl = jend[i]; //jbegin[i]; 
    468496          
    469497         if (ibegin_zoom.size() != 0) 
     
    471499            ibegin_zoom_cl = ibegin_zoom[i]; 
    472500            jbegin_zoom_cl = jbegin_zoom[i]; 
     501            iend_zoom_cl = ibegin_zoom[i]+ni_zoom[i]-1; 
     502            jend_zoom_cl = jbegin_zoom[i]+nj_zoom[i]-1; 
    473503         } 
    474504          
    475          for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    476          { 
    477             (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
     505//         std::cout<<"--> client No "<<i<<std::endl ; 
     506//         std::cout<<" ibegin "<<ibegin[i]<<" iend "<<iend[i]<<" jbegin "<<jbegin[i]<<" jend "<<jend[i]<<std::endl ; 
     507//         std::cout<<"zoom cl : ibegin "<<ibegin_zoom_cl<<" iend "<<iend_zoom_cl<<" jbegin "<<jbegin_zoom_cl<<" jend "<<jend_zoom_cl<<std::endl ; 
     508//         std::cout<<"--> server "<<std::endl ; 
     509//         std::cout<<" ibegin "<<ibegin_srv<<" iend "<<iend_srv<<" jbegin "<<jbegin_srv<<" jend "<<jend_srv<<std::endl ; 
     510//        std::cout<<"zoom : ibegin "<<ibegin_zoom_srv<<" iend "<<iend_zoom_srv<< " ni "<<zoom_ni_srv<<" jbegin "<<jbegin_zoom_srv<<" jend "<<jend_zoom_srv<<" nj "<<zoom_nj_srv<<std::endl ; 
     511//         std::cout<<"zoom_size "<<ibegin_zoom.size()<<std::endl ; 
     512 
     513         if (comm::CMPIManager::IsClient()) 
     514         { 
     515           for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
     516           { 
     517              (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
     518 
     519//            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
     520//                                  /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
     521//            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
     522//                                  /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
     523//            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
     524              (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + ibegin_cl - 1 - (ibegin_srv + ibegin_zoom_srv - 1) + 1 ; 
     525              (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + jbegin_cl - 1 - (jbegin_srv + jbegin_zoom_srv - 1) + 1 ; 
     526              (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
     527           } 
     528         } 
     529         else 
     530         { 
     531           for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
     532           { 
     533              (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    478534            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    479                                   /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
     535                                   + (ibegin_cl - 1) - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
    480536            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
    481                                   /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
     537                                   + (jbegin_cl - 1) - (jbegin_srv - 1) + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
    482538            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
     539           }          
     540             
    483541         } 
    484542                   
    485          dn += storeIndex_cl->size();                  
    486       } 
    487             
     543         dn += storeIndex_cl->size();  
     544//         std::cout<<"storeIndex_cl->size() "<<storeIndex_cl->size()<<std::endl;                
     545       
     546//         std::cout<<"storeIndex_srv->size() "<<storeIndex_srv->size()<<std::endl;                
     547      } 
     548       
    488549      if (storeIndex_srv->size() != 0) 
    489550      { 
     
    496557         const int jend_t   = 
    497558            *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end()); 
    498              
     559                
     560//                std::cout<< "[ grille = "      << this->getId() 
     561//                         << ", ibegin_t = "    << ibegin_t 
     562//                         << ", jbegin_t = "    << jbegin_t 
     563//                         << ", iend_t = "      << iend_t 
     564//                         << ", jend_t = "      << jend_t 
     565//                         << ", zoom_ni_srv = " << zoom_ni_srv 
     566//                         << ", zoom_nj_srv = " << zoom_nj_srv 
     567//                         << ", nb subdomain = "   << out_i_index.size()-1<<std::endl   ;   
     568                                  
    499569         if ((ibegin_t < 0) || (jbegin_t < 0) || 
    500570             (iend_t >= zoom_ni_srv) || (jend_t >= zoom_nj_srv)) 
     
    508578                  << ", zoom_ni_srv = " << zoom_ni_srv 
    509579                  << ", zoom_nj_srv = " << zoom_nj_srv 
     580                  << ", nb subdomain = "   << out_i_index.size()-1 
    510581                  <<" ] Erreur d'indexation de la grille au niveau du serveur") ; 
    511582         } 
Note: See TracChangeset for help on using the changeset viewer.