Ignore:
Timestamp:
11/26/14 15:12:12 (9 years ago)
Author:
mhnguyen
Message:

Fixing bug of automatic dection of buffer size

+) Split sending of longtitude and latitude event message to decrease its size into 2
+) Correct size of buffer on client and server side
+) Do some cleaning code

Test
+) On Curie
+) Test only on domain (without axis), all passed

File:
1 edited

Legend:

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

    r509 r518  
    750750    CContextClient* client=context->client ; 
    751751    // send lon lat for each connected server 
    752     CEventClient event(getType(),EVENT_ID_LON_LAT) ; 
    753  
    754     list<shared_ptr<CMessage> > list_msg ; 
     752 
     753    CEventClient eventLon(getType(),EVENT_ID_LON) ; 
     754    CEventClient eventLat(getType(),EVENT_ID_LAT) ; 
     755 
     756    list<shared_ptr<CMessage> > list_msgLon ; 
     757    list<shared_ptr<CMessage> > list_msgLat ; 
    755758    list< CArray<int,1>* > list_indi,list_indj ; 
    756759    list< CArray<double,1>* >list_lon,list_lat ; 
     
    794797      if (hasBounds) list_boundslat.push_back(new CArray<double,2>(boundslat.copy())) ; 
    795798 
    796       list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
    797  
    798       *list_msg.back()<<this->getId()<<(int)type ; // enum ne fonctionne pour les message => ToFix 
    799       *list_msg.back()<<isCurvilinear ; 
    800       *list_msg.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back()<<*list_lat.back() ; 
    801       if (hasBounds) *list_msg.back()<<*list_boundslon.back()<<*list_boundslat.back(); 
    802       event.push(connectedServer[ns],nbSenders[ns],*list_msg.back()) ; 
     799      list_msgLon.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     800      list_msgLat.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     801 
     802      *list_msgLon.back()<<this->getId()<<(int)type ; // enum ne fonctionne pour les message => ToFix 
     803      *list_msgLat.back()<<this->getId()<<(int)type ; 
     804      *list_msgLon.back()<<isCurvilinear ; 
     805      *list_msgLat.back()<<isCurvilinear ; 
     806      *list_msgLon.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back() ; 
     807      *list_msgLat.back()<<*list_indi.back()<<*list_indj.back()<<*list_lat.back() ; 
     808 
     809      if (hasBounds) 
     810      { 
     811        *list_msgLon.back()<<*list_boundslon.back(); 
     812        *list_msgLat.back()<<*list_boundslat.back(); 
     813      } 
     814      eventLon.push(connectedServer[ns],nbSenders[ns],*list_msgLon.back()) ; 
     815      eventLat.push(connectedServer[ns],nbSenders[ns],*list_msgLat.back()) ; 
    803816    } 
    804817 
    805     client->sendEvent(event) ; 
     818    client->sendEvent(eventLon) ; 
     819    client->sendEvent(eventLat) ; 
    806820 
    807821 
     
    828842             return true ; 
    829843             break ; 
    830            case EVENT_ID_LON_LAT : 
    831              recvLonLat(event) ; 
     844           case EVENT_ID_LON : 
     845             recvLon(event) ; 
     846             return true ; 
     847             break ; 
     848           case EVENT_ID_LAT : 
     849             recvLat(event) ; 
    832850             return true ; 
    833851             break ; 
     
    882900  } 
    883901 
    884   void CDomain::recvLonLat(CEventServer& event) 
     902  void CDomain::recvLon(CEventServer& event) 
    885903  { 
    886904    list<CEventServer::SSubEvent>::iterator it ; 
     
    890908      string domainId ; 
    891909      *buffer>>domainId ; 
    892       get(domainId)->recvLonLat(*buffer) ; 
     910      get(domainId)->recvLon(*buffer) ; 
    893911    } 
    894912  } 
    895913 
    896   void CDomain::recvLonLat(CBufferIn& buffer) 
     914  void CDomain::recvLon(CBufferIn& buffer) 
    897915  { 
    898916    CArray<int,1> indi ; 
    899917    CArray<int,1> indj ; 
    900918    CArray<double,1> lon ; 
    901     CArray<double,1> lat ; 
    902919    CArray<double,2> boundslon ; 
    903     CArray<double,2> boundslat ; 
    904920 
    905921    int type_int ; 
    906     buffer>>type_int>>isCurvilinear>>indi>>indj>>lon>>lat ; 
    907     if (hasBounds) buffer>>boundslon>>boundslat ; 
     922    buffer>>type_int>>isCurvilinear>>indi>>indj>>lon ; 
     923    if (hasBounds) buffer>>boundslon ; 
    908924    type.setValue((type_attr::t_enum)type_int) ; // probleme des type enum avec les buffers : ToFix 
    909925 
     
    914930      ind_srv=(i-(zoom_ibegin_srv-1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ; 
    915931      lonvalue_srv(ind_srv)=lon(ind) ; 
    916       latvalue_srv(ind_srv)=lat(ind) ; 
    917932      if (hasBounds) 
    918933      { 
     
    920935        { 
    921936          bounds_lon_srv(nv,ind_srv)=boundslon(nv,ind) ; 
     937        } 
     938      } 
     939    } 
     940  } 
     941 
     942  void CDomain::recvLat(CEventServer& event) 
     943  { 
     944    list<CEventServer::SSubEvent>::iterator it ; 
     945    for (it=event.subEvents.begin();it!=event.subEvents.end();++it) 
     946    { 
     947      CBufferIn* buffer=it->buffer; 
     948      string domainId ; 
     949      *buffer>>domainId ; 
     950      get(domainId)->recvLat(*buffer) ; 
     951    } 
     952  } 
     953 
     954  void CDomain::recvLat(CBufferIn& buffer) 
     955  { 
     956    CArray<int,1> indi ; 
     957    CArray<int,1> indj ; 
     958    CArray<double,1> lat ; 
     959    CArray<double,2> boundslat ; 
     960 
     961    int type_int ; 
     962    buffer>>type_int>>isCurvilinear>>indi>>indj>>lat ; 
     963    if (hasBounds) buffer>>boundslat ; 
     964    type.setValue((type_attr::t_enum)type_int) ; // probleme des type enum avec les buffers : ToFix 
     965 
     966    int i,j,ind_srv ; 
     967    for(int ind=0;ind<indi.numElements();ind++) 
     968    { 
     969      i=indi(ind) ; j=indj(ind) ; 
     970      ind_srv=(i-(zoom_ibegin_srv-1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ; 
     971      latvalue_srv(ind_srv)=lat(ind) ; 
     972      if (hasBounds) 
     973      { 
     974        for(int nv=0;nv<nvertex;nv++) 
     975        { 
    922976          bounds_lat_srv(nv,ind_srv)=boundslat(nv,ind) ; 
    923977        } 
     
    925979    } 
    926980  } 
     981//  void CDomain::recvLonLat(CEventServer& event) 
     982//  { 
     983//    list<CEventServer::SSubEvent>::iterator it ; 
     984//    for (it=event.subEvents.begin();it!=event.subEvents.end();++it) 
     985//    { 
     986//      CBufferIn* buffer=it->buffer; 
     987//      string domainId ; 
     988//      *buffer>>domainId ; 
     989//      get(domainId)->recvLonLat(*buffer) ; 
     990//    } 
     991//  } 
     992// 
     993//  void CDomain::recvLonLat(CBufferIn& buffer) 
     994//  { 
     995//    CArray<int,1> indi ; 
     996//    CArray<int,1> indj ; 
     997//    CArray<double,1> lon ; 
     998//    CArray<double,1> lat ; 
     999//    CArray<double,2> boundslon ; 
     1000//    CArray<double,2> boundslat ; 
     1001// 
     1002//    int type_int ; 
     1003//    buffer>>type_int>>isCurvilinear>>indi>>indj>>lon>>lat ; 
     1004//    if (hasBounds) buffer>>boundslon>>boundslat ; 
     1005//    type.setValue((type_attr::t_enum)type_int) ; // probleme des type enum avec les buffers : ToFix 
     1006// 
     1007//    int i,j,ind_srv ; 
     1008//    for(int ind=0;ind<indi.numElements();ind++) 
     1009//    { 
     1010//      i=indi(ind) ; j=indj(ind) ; 
     1011//      ind_srv=(i-(zoom_ibegin_srv-1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ; 
     1012//      lonvalue_srv(ind_srv)=lon(ind) ; 
     1013//      latvalue_srv(ind_srv)=lat(ind) ; 
     1014//      if (hasBounds) 
     1015//      { 
     1016//        for(int nv=0;nv<nvertex;nv++) 
     1017//        { 
     1018//          bounds_lon_srv(nv,ind_srv)=boundslon(nv,ind) ; 
     1019//          bounds_lat_srv(nv,ind_srv)=boundslat(nv,ind) ; 
     1020//        } 
     1021//      } 
     1022//    } 
     1023//  } 
    9271024   //---------------------------------------------------------------- 
    9281025 
Note: See TracChangeset for help on using the changeset viewer.