Ignore:
Timestamp:
02/11/15 16:23:02 (9 years ago)
Author:
mhnguyen
Message:

Redesigning grid structure

+) Add an intermediate class to calculate distribution on client and servers
+) Change all index of attributes to zero (0), instead of one(1)

Test
+) On Curie
+) Test new features passes but some data are still shifted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/domain.cpp

    r540 r551  
    109109         } 
    110110         ni=1 ; 
    111          ibegin=1 ; 
    112          iend=1 ; 
     111         ibegin=0 ; 
     112         iend=0 ; 
    113113 
    114114      } 
     
    169169 
    170170      if (ni.getValue() < 0 || ibegin.getValue() > iend.getValue() || 
    171           ibegin.getValue() < 1 || iend.getValue() > ni_glo.getValue()) 
     171          ibegin.getValue() < 0 || iend.getValue() > (ni_glo.getValue()-1)) 
    172172          { 
    173173 
     
    207207 
    208208      if (nj.getValue() < 0 || jbegin.getValue() > jend.getValue() || 
    209           jbegin.getValue() < 1 || jend.getValue() > nj_glo.getValue()) 
     209          jbegin.getValue() < 0 || jend.getValue() > (nj_glo.getValue()-1)) 
    210210         ERROR("CDomain::checkAttributes(void)", 
    211211               << "Domain is wrong defined," 
     
    488488            int zoom_jend = zoom_jbegin + zoom_nj - 1; 
    489489 
    490             if (zoom_ibegin < 1  || zoom_jbegin < 1 || zoom_iend > ni_glo || zoom_jend > nj_glo) 
     490            if (zoom_ibegin < 0  || zoom_jbegin < 0 || zoom_iend > (ni_glo-1) || zoom_jend > (nj_glo-1)) 
    491491               ERROR("CDomain::checkZoom(void)", 
    492492                     << "Zoom is wrong defined," 
     
    498498         zoom_ni = ni_glo; 
    499499         zoom_nj = nj_glo; 
    500          zoom_ibegin = 1; 
    501          zoom_jbegin = 1; 
     500         zoom_ibegin = 0; 
     501         zoom_jbegin = 0; 
    502502      } 
    503503 
     
    613613  { 
    614614    int ni_srv=ni_glo.getValue() ; 
    615     int ibegin_srv=1 ; 
     615    int ibegin_srv=0 ; 
    616616    int iend_srv=ni_glo.getValue() ; 
    617617 
     
    625625    int serverRank=client->getServerLeader() ; 
    626626 
    627     jend_srv=0 ; 
     627//    jend_srv=0 ; 
     628    jend_srv= -1 ; 
    628629    for(int i=0;i<=serverRank;i++) 
    629630    { 
     
    664665    int ns=nj_glo%nbServer ; 
    665666    int pos=ns*(blockSize+1) ; 
     667//    int pos=ns*(blockSize) ; 
    666668    int serverNum ; 
    667669 
     
    674676      for(i=0;i<ni;i++) 
    675677      { 
    676         i_ind=ibegin+i_index(i,j)-1 ; 
    677         j_ind=jbegin+j_index(i,j)-1 ; 
     678        i_ind=ibegin+i_index(i,j) ; 
     679        j_ind=jbegin+j_index(i,j) ; 
    678680 
    679681        if (j_ind<pos) serverNum=j_ind/(blockSize+1) ; 
     
    681683        IsConnected[serverNum]=true ; 
    682684 
    683         if (i_ind >= zoom_ibegin-1 && i_ind <= zoom_iend-1 && j_ind >= zoom_jbegin-1 && j_ind <= zoom_jend-1) 
     685        if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 
    684686        { 
    685687          mapConnectedServer(i,j)=serverNum ; 
     
    709711          ns=indServer[mapConnectedServer(i,j)] ; 
    710712          mapConnectedServer(i,j)= ns ; 
    711           i_indSrv[ns].push_back(i+ibegin-1) ; 
    712           j_indSrv[ns].push_back(j+jbegin-1) ; 
     713          i_indSrv[ns].push_back(i+ibegin) ; 
     714          j_indSrv[ns].push_back(j+jbegin) ; 
    713715        } 
    714716      } 
     
    743745  } 
    744746 
     747 
     748//  void CDomain::sendLonLat(void) 
     749//  { 
     750//    int ns,n,i,j,ind,nv ; 
     751//    CContext* context = CContext::getCurrent() ; 
     752//    CContextClient* client=context->client ; 
     753//    // send lon lat for each connected server 
     754// 
     755//    CEventClient eventLon(getType(),EVENT_ID_LON) ; 
     756//    CEventClient eventLat(getType(),EVENT_ID_LAT) ; 
     757// 
     758//    list<shared_ptr<CMessage> > list_msgLon ; 
     759//    list<shared_ptr<CMessage> > list_msgLat ; 
     760//    list< CArray<int,1>* > list_indi,list_indj ; 
     761//    list< CArray<double,1>* >list_lon,list_lat ; 
     762//    list< CArray<double,2>* >list_boundslon,list_boundslat ; 
     763// 
     764//    for(int ns=0;ns<connectedServer.size();ns++) 
     765//    { 
     766//      int nbData = nbDataSrv[ns] ; 
     767//      CArray<int,1> indi(nbData) ; 
     768//      CArray<int,1> indj(nbData) ; 
     769//      CArray<double,1> lon(nbData) ; 
     770//      CArray<double,1> lat(nbData) ; 
     771//      CArray<double,2> boundslon(nvertex,nbData) ; 
     772//      CArray<double,2> boundslat(nvertex,nbData) ; 
     773// 
     774//      for(n=0;n<nbData;n++) 
     775//      { 
     776//        i=i_indSrv[ns][n] ; 
     777//        j=j_indSrv[ns][n] ; 
     778//        ind=(i-(zoom_ibegin_client-1))+(j-(zoom_jbegin_client-1))*zoom_ni_client ; 
     779// 
     780//        lon(n)=lonvalue(ind) ; 
     781//        lat(n)=latvalue(ind) ; 
     782//        if (hasBounds) 
     783//        { 
     784//          for(nv=0;nv<nvertex;nv++) 
     785//          { 
     786//            boundslon(nv,n)=bounds_lon(nv,ind); 
     787//            boundslat(nv,n)=bounds_lat(nv,ind); 
     788//          } 
     789//        } 
     790//        indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1  ; 
     791//        indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1  ; 
     792//      } 
     793// 
     794//      list_indi.push_back(new CArray<int,1>(indi.copy())) ; 
     795//      list_indj.push_back(new CArray<int,1>(indj.copy())) ; 
     796//      list_lon.push_back(new CArray<double,1>(lon.copy())) ; 
     797//      list_lat.push_back(new CArray<double,1>(lat.copy())) ; 
     798//      if (hasBounds) list_boundslon.push_back(new CArray<double,2>(boundslon.copy())) ; 
     799//      if (hasBounds) list_boundslat.push_back(new CArray<double,2>(boundslat.copy())) ; 
     800// 
     801//      list_msgLon.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     802//      list_msgLat.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     803// 
     804//      *list_msgLon.back()<<this->getId()<<(int)type ; // enum ne fonctionne pour les message => ToFix 
     805//      *list_msgLat.back()<<this->getId()<<(int)type ; 
     806//      *list_msgLon.back()<<isCurvilinear ; 
     807//      *list_msgLat.back()<<isCurvilinear ; 
     808//      *list_msgLon.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back() ; 
     809//      *list_msgLat.back()<<*list_indi.back()<<*list_indj.back()<<*list_lat.back() ; 
     810// 
     811//      if (hasBounds) 
     812//      { 
     813//        *list_msgLon.back()<<*list_boundslon.back(); 
     814//        *list_msgLat.back()<<*list_boundslat.back(); 
     815//      } 
     816//      eventLon.push(connectedServer[ns],nbSenders[ns],*list_msgLon.back()) ; 
     817//      eventLat.push(connectedServer[ns],nbSenders[ns],*list_msgLat.back()) ; 
     818//    } 
     819// 
     820//    client->sendEvent(eventLon) ; 
     821//    client->sendEvent(eventLat) ; 
     822// 
     823// 
     824//    for(list<CArray<int,1>* >::iterator it=list_indi.begin();it!=list_indi.end();it++) delete *it; 
     825//    for(list<CArray<int,1>* >::iterator it=list_indj.begin();it!=list_indj.end();it++) delete *it; 
     826//    for(list<CArray<double,1>* >::iterator it=list_lon.begin();it!=list_lon.end();it++)   delete *it; 
     827//    for(list<CArray<double,1>* >::iterator it=list_lat.begin();it!=list_lat.end();it++)   delete *it; 
     828//    if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslon.begin();it!=list_boundslon.end();it++)   delete *it; 
     829//    if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslat.begin();it!=list_boundslat.end();it++)   delete *it; 
     830// 
     831//  } 
    745832 
    746833  void CDomain::sendLonLat(void) 
     
    774861        i=i_indSrv[ns][n] ; 
    775862        j=j_indSrv[ns][n] ; 
    776         ind=(i-(zoom_ibegin_client-1))+(j-(zoom_jbegin_client-1))*zoom_ni_client ; 
     863//        ind=(i-(zoom_ibegin_client))+(j-(zoom_jbegin_client-1))*zoom_ni_client ; 
     864        ind=(i-(zoom_ibegin_client))+(j-(zoom_jbegin_client))*zoom_ni_client ; 
    777865 
    778866        lon(n)=lonvalue(ind) ; 
     
    786874          } 
    787875        } 
    788         indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1  ; 
    789         indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1  ; 
     876        indi(n)=ibegin+i_index(i-ibegin,j-jbegin)  ; 
     877        indj(n)=jbegin+j_index(i-ibegin,j-jbegin)  ; 
     878//        indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1  ; 
     879//        indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1  ; 
    790880      } 
    791881 
     
    828918 
    829919  } 
    830  
    831920 
    832921  bool CDomain::dispatchEvent(CEventServer& event) 
     
    884973    if (zoom_ni_srv<=0 || zoom_nj_srv<=0) 
    885974    { 
    886       zoom_ibegin_srv=1 ; zoom_iend_srv=0 ; zoom_ni_srv=0 ; 
    887       zoom_jbegin_srv=1 ; zoom_jend_srv=0 ; zoom_nj_srv=0 ; 
     975      zoom_ibegin_srv=0 ; zoom_iend_srv=0 ; zoom_ni_srv=0 ; 
     976      zoom_jbegin_srv=0 ; zoom_jend_srv=0 ; zoom_nj_srv=0 ; 
    888977    } 
    889978    lonvalue_srv.resize(zoom_ni_srv*zoom_nj_srv) ; 
     
    9281017    { 
    9291018      i=indi(ind) ; j=indj(ind) ; 
    930       ind_srv=(i-(zoom_ibegin_srv-1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ; 
     1019      ind_srv=(i-(zoom_ibegin_srv))+(j-(zoom_jbegin_srv))*zoom_ni_srv ; 
    9311020      lonvalue_srv(ind_srv)=lon(ind) ; 
    9321021      if (hasBounds) 
     
    9681057    { 
    9691058      i=indi(ind) ; j=indj(ind) ; 
    970       ind_srv=(i-(zoom_ibegin_srv-1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ; 
     1059      ind_srv=(i-(zoom_ibegin_srv))+(j-(zoom_jbegin_srv))*zoom_ni_srv ; 
    9711060      latvalue_srv(ind_srv)=lat(ind) ; 
    9721061      if (hasBounds) 
Note: See TracChangeset for help on using the changeset viewer.