Changeset 611 for XIOS/branchs/xios-1.0/src/node/domain.cpp
- Timestamp:
- 06/10/15 10:39:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/branchs/xios-1.0/src/node/domain.cpp
r610 r611 21 21 CDomain::CDomain(void) 22 22 : CObjectTemplate<CDomain>(), CDomainAttributes() 23 , isChecked(false), relFiles()23 , isChecked(false), hasBounds(false), hasArea(false), relFiles() 24 24 { /* Ne rien faire de plus */ } 25 25 26 26 CDomain::CDomain(const StdString & id) 27 27 : CObjectTemplate<CDomain>(id), CDomainAttributes() 28 , isChecked(false), relFiles()28 , isChecked(false), hasBounds(false), hasArea(false), relFiles() 29 29 { /* Ne rien faire de plus */ } 30 30 … … 108 108 for(int j=0;j<nj;j++) mask(0,j)=mask_tmp(j,0) ; 109 109 } 110 111 if (!area.isEmpty()) 112 area.transposeSelf(1, 0); 113 110 114 ni=1 ; 111 115 ibegin=1 ; … … 533 537 } 534 538 539 void CDomain::checkArea(void) 540 { 541 hasArea = !area.isEmpty(); 542 if (hasArea) 543 { 544 if (area.extent(0) != ni || area.extent(1) != nj) 545 { 546 ERROR("void CDomain::checkArea(void)", 547 "The area attribute must be of size ni x nj."); 548 } 549 } 550 } 551 535 552 //---------------------------------------------------------------- 536 553 … … 543 560 this->checkZoom(); 544 561 this->checkBounds(); 562 this->checkArea(); 545 563 546 564 if (context->hasClient) … … 561 579 computeConnectedServer() ; 562 580 sendServerAttribut() ; 563 sendLonLat ();581 sendLonLatArea(); 564 582 } 565 583 … … 701 719 702 720 703 void CDomain::sendLonLat (void)721 void CDomain::sendLonLatArea(void) 704 722 { 705 723 int ns,n,i,j,ind,nv; … … 709 727 // send lon lat for each connected server 710 728 CEventClient event(getType(), EVENT_ID_LON_LAT); 729 CEventClient eventArea(getType(), EVENT_ID_AREA); 711 730 712 731 list<CMessage> list_msg; 732 list<CMessage> list_msgArea; 713 733 list<CArray<int,1> > list_indi,list_indj; 714 734 list<CArray<double,1> >list_lon,list_lat; 715 735 list<CArray<double,2> >list_boundslon,list_boundslat; 736 list<CArray<double,1> > list_area; 716 737 717 738 for (int ns = 0; ns < connectedServer.size(); ns++) … … 729 750 list_boundslat.push_back(CArray<double,2>(nvertex, nbData)); 730 751 } 752 if (hasArea) 753 list_area.push_back(CArray<double,1>(nbData)); 731 754 732 755 CArray<int,1>& indi = list_indi.back(); … … 758 781 indi(n) = ibegin + i_index(i - ibegin + 1, j - jbegin + 1) - 1; 759 782 indj(n) = jbegin + j_index(i - ibegin + 1, j - jbegin + 1) - 1; 783 784 if (hasArea) 785 list_area.back()(n) = area(i - ibegin + 1, j - jbegin + 1); 760 786 } 761 787 … … 768 794 769 795 event.push(connectedServer[ns], nbSenders[ns], list_msg.back()); 796 797 if (hasArea) 798 { 799 list_msgArea.push_back(CMessage()); 800 list_msgArea.back() << this->getId() << list_area.back(); 801 eventArea.push(connectedServer[ns], nbSenders[ns], list_msgArea.back()); 802 } 770 803 } 771 804 772 805 client->sendEvent(event); 806 if (hasArea) 807 client->sendEvent(eventArea); 773 808 } 774 809 … … 787 822 case EVENT_ID_LON_LAT: 788 823 recvLonLat(event); 824 return true; 825 break; 826 case EVENT_ID_AREA: 827 recvArea(event); 789 828 return true; 790 829 break; … … 837 876 bounds_lat_srv = 0. ; 838 877 } 878 879 if (hasArea) 880 area_srv.resize(zoom_ni_srv * zoom_nj_srv); 839 881 } 840 882 … … 882 924 } 883 925 } 884 //---------------------------------------------------------------- 885 886 887 888 ///--------------------------------------------------------------- 889 926 927 void CDomain::recvArea(CEventServer& event) 928 { 929 list<CEventServer::SSubEvent>::iterator it; 930 for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) 931 { 932 CBufferIn* buffer = it->buffer; 933 string domainId; 934 *buffer >> domainId; 935 get(domainId)->recvArea(it->rank, *buffer); 936 } 937 } 938 939 void CDomain::recvArea(int rank, CBufferIn& buffer) 940 { 941 CArray<int,1> &indi = indiSrv[rank], &indj = indjSrv[rank]; 942 CArray<double,1> clientArea; 943 944 buffer >> clientArea; 945 946 int i, j, ind_srv; 947 for (int ind = 0; ind < indi.numElements(); ind++) 948 { 949 i = indi(ind); j = indj(ind); 950 ind_srv = (i - (zoom_ibegin_srv - 1)) + (j - (zoom_jbegin_srv - 1)) * zoom_ni_srv; 951 area_srv(ind_srv) = clientArea(ind); 952 } 953 } 890 954 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.