Changeset 611 for XIOS/trunk/src/node/domain.cpp
- Timestamp:
- 06/10/15 10:39:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/domain.cpp
r610 r611 24 24 : CObjectTemplate<CDomain>(), CDomainAttributes() 25 25 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 26 , isDistributed_(false)26 , hasBounds(false), hasArea(false), isDistributed_(false) 27 27 { /* Ne rien faire de plus */ } 28 28 … … 30 30 : CObjectTemplate<CDomain>(id), CDomainAttributes() 31 31 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 32 , isDistributed_(false)32 , hasBounds(false), hasArea(false), isDistributed_(false) 33 33 { /* Ne rien faire de plus */ } 34 34 … … 119 119 for(int j=0;j<nj;j++) mask(0,j)=mask_tmp(j,0) ; 120 120 } 121 122 if (!area.isEmpty()) 123 area.transposeSelf(1, 0); 124 121 125 ni=1 ; 122 126 ibegin=0 ; … … 553 557 { 554 558 hasBounds=true ; 555 556 559 } 557 560 else … … 562 565 } 563 566 567 void CDomain::checkArea(void) 568 { 569 hasArea = !area.isEmpty(); 570 if (hasArea) 571 { 572 if (area.extent(0) != ni || area.extent(1) != nj) 573 { 574 ERROR("void CDomain::checkArea(void)", 575 "The area attribute must be of size ni x nj."); 576 } 577 } 578 } 579 564 580 //---------------------------------------------------------------- 565 581 // Divide function checkAttributes into 2 seperate ones … … 573 589 this->checkZoom(); 574 590 this->checkBounds(); 591 this->checkArea(); 575 592 576 593 if (context->hasClient) … … 601 618 { 602 619 sendServerAttribut() ; 603 sendLonLat () ;620 sendLonLatArea() ; 604 621 } 605 622 … … 615 632 this->checkZoom(); 616 633 this->checkBounds(); 634 this->checkArea(); 617 635 618 636 if (context->hasClient) … … 633 651 computeConnectedServer() ; 634 652 sendServerAttribut() ; 635 sendLonLat () ;653 sendLonLatArea() ; 636 654 } 637 655 … … 790 808 } 791 809 792 void CDomain::sendLonLat (void)810 void CDomain::sendLonLatArea(void) 793 811 { 794 812 int ns, n, i, j, ind, nv, idx; … … 800 818 CEventClient eventLon(getType(), EVENT_ID_LON); 801 819 CEventClient eventLat(getType(), EVENT_ID_LAT); 802 803 list<CMessage> list_msgsIndex, list_msgsLon, list_msgsLat; 820 CEventClient eventArea(getType(), EVENT_ID_AREA); 821 822 list<CMessage> list_msgsIndex, list_msgsLon, list_msgsLat, list_msgsArea; 804 823 list<CArray<int,1> > list_indi, list_indj; 805 824 list<CArray<double,1> > list_lon, list_lat; 806 825 list<CArray<double,2> > list_boundslon, list_boundslat; 826 list<CArray<double,1> > list_area; 807 827 808 828 std::map<int, std::vector<size_t> >::const_iterator it, iteMap; … … 826 846 list_boundslat.push_back(CArray<double,2>(nvertex, nbData)); 827 847 } 848 if (hasArea) 849 list_area.push_back(CArray<double,1>(nbData)); 828 850 829 851 CArray<int,1>& indi = list_indi.back(); … … 856 878 indi(n) = ibegin + i_index(i - ibegin, j - jbegin); 857 879 indj(n) = jbegin + j_index(i - ibegin, j - jbegin); 880 881 if (hasArea) 882 list_area.back()(n) = area(i - ibegin, j - jbegin); 858 883 } 859 884 … … 879 904 eventLon.push(rank, nbConnectedClients_[rank], list_msgsLon.back()); 880 905 eventLat.push(rank, nbConnectedClients_[rank], list_msgsLat.back()); 906 907 if (hasArea) 908 { 909 list_msgsArea.push_back(CMessage()); 910 list_msgsArea.back() << this->getId() << list_area.back(); 911 eventArea.push(rank, nbConnectedClients_[rank], list_msgsArea.back()); 912 } 881 913 } 882 914 … … 884 916 client->sendEvent(eventLon); 885 917 client->sendEvent(eventLat); 918 if (hasArea) 919 client->sendEvent(eventArea); 886 920 } 887 921 … … 909 943 return true; 910 944 break; 945 case EVENT_ID_AREA: 946 recvArea(event); 947 return true; 948 break; 911 949 default: 912 950 ERROR("bool CContext::dispatchEvent(CEventServer& event)", … … 956 994 bounds_lat_srv = 0. ; 957 995 } 996 997 if (hasArea) 998 area_srv.resize(zoom_ni_srv * zoom_nj_srv); 958 999 } 959 1000 … … 1047 1088 } 1048 1089 1090 void CDomain::recvArea(CEventServer& event) 1091 { 1092 list<CEventServer::SSubEvent>::iterator it; 1093 for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) 1094 { 1095 CBufferIn* buffer = it->buffer; 1096 string domainId; 1097 *buffer >> domainId; 1098 get(domainId)->recvArea(it->rank, *buffer); 1099 } 1100 } 1101 1102 void CDomain::recvArea(int rank, CBufferIn& buffer) 1103 { 1104 CArray<int,1> &indi = indiSrv[rank], &indj = indjSrv[rank]; 1105 CArray<double,1> clientArea; 1106 1107 buffer >> clientArea; 1108 1109 int i, j, ind_srv; 1110 for (int ind = 0; ind < indi.numElements(); ind++) 1111 { 1112 i = indi(ind); j = indj(ind); 1113 ind_srv = (i - zoom_ibegin_srv) + (j - zoom_jbegin_srv) * zoom_ni_srv; 1114 area_srv(ind_srv) = clientArea(ind); 1115 } 1116 } 1117 1049 1118 //---------------------------------------------------------------- 1050 1119
Note: See TracChangeset
for help on using the changeset viewer.