Changeset 665 for XIOS/trunk/src/node
- Timestamp:
- 08/24/15 14:53:23 (9 years ago)
- Location:
- XIOS/trunk/src/node
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/domain.cpp
r664 r665 28 28 , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isUnstructed_(false) 29 29 , global_zoom_ni(0), global_zoom_ibegin(0), global_zoom_nj(0), global_zoom_jbegin(0) 30 , isClientAfterTransformationChecked(false) 30 , isClientAfterTransformationChecked(false), hasLonLat(false) 31 31 , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() 32 32 { /* Ne rien faire de plus */ } … … 37 37 , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isUnstructed_(false) 38 38 , global_zoom_ni(0), global_zoom_ibegin(0), global_zoom_nj(0), global_zoom_jbegin(0) 39 , isClientAfterTransformationChecked(false) 39 , isClientAfterTransformationChecked(false), hasLonLat(false) 40 40 , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() 41 41 { /* Ne rien faire de plus */ } … … 574 574 575 575 //---------------------------------------------------------------- 576 577 576 void CDomain::completeLonLatClient(void) 578 577 { 579 578 completeLonClient(); 580 579 completeLatClient(); 581 // int i,j,k ; 582 // CArray<double,1> lonvalue_temp(ni*nj) ; 583 // CArray<double,1> latvalue_temp(ni*nj) ; 584 // CArray<double,2> bounds_lon_temp(nvertex,ni*nj); 585 // CArray<double,2> bounds_lat_temp(nvertex,ni*nj); 586 // 587 // if (type.isEmpty()) 588 // { 589 // if ( lonvalue.numElements() == ni*nj && latvalue.numElements() == ni*nj ) 590 // { 591 // type.setValue(type_attr::curvilinear) ; 592 // isCurvilinear=true ; 593 // } 594 // else if ( lonvalue.numElements() == ni && latvalue.numElements() == nj ) 595 // { 596 // type.setValue(type_attr::regular) ; 597 // isCurvilinear=false ; 598 // } 599 // else ERROR("void CDomain::completeLonLatClient(void)",<<"the grid is nor curvilinear, nor cartesian, because the size of longitude and latitude array is not coherent with the domain size"<<endl 600 // <<"lonvalue size = " << lonvalue.numElements() << "different of ni or ni*nj"<<endl 601 // <<"latvalue size = " << latvalue.numElements() << "different of nj or ni*nj" ) ; 602 // } 603 // if (type==type_attr::curvilinear || type==type_attr::unstructured) 604 // { 605 // lonvalue_temp=lonvalue ; 606 // latvalue_temp=latvalue ; 607 // if (hasBounds) bounds_lon_temp=bounds_lon ; 608 // if (hasBounds) bounds_lat_temp=bounds_lat ; 609 // }checkBounds 610 // else 611 // { 612 // for(j=0;j<nj;j++) 613 // for(i=0;i<ni;i++) 614 // { 615 // k=j*ni+i ; 616 // lonvalue_temp(k)=lonvalue(i) ; 617 // latvalue_temp(k)=latvalue(j) ; 618 // if (hasBounds) 619 // { 620 // for(int n=0;n<nvertex;n++) 621 // { 622 // bounds_lon_temp(n,k)=bounds_lon(n,i) ; 623 // bounds_lat_temp(n,k)=bounds_lat(n,j) ; 624 // } 625 // } 626 // } 627 // } 628 // 629 // StdSize dm = zoom_ni_client * zoom_nj_client; 630 // 631 // // Make sure that this attribute is non-empty for every client. 632 // if (0 != dm) 633 // { 634 // lonvalue.resize(dm); 635 // latvalue.resize(dm); 636 // } 637 // 638 // 639 // for (int i = 0; i < zoom_ni_client; i++) 640 // { 641 // for (int j = 0; j < zoom_nj_client; j++) 642 // { 643 // lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client-ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 644 // latvalue(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client - jbegin)*ni ); 645 // if (hasBounds) 646 // { 647 // for(int n=0;n<nvertex;n++) 648 // { 649 // bounds_lon(n,i + j * zoom_ni_client) = bounds_lon_temp( n, (i + zoom_ibegin_client - ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 650 // bounds_lat(n,i + j * zoom_ni_client) = bounds_lat_temp( n, (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client -jbegin)*ni ); 651 // } 652 // } 653 // } 654 // } 655 } 580 } 656 581 657 582 658 583 //---------------------------------------------------------------- 659 660 584 void CDomain::checkZoom(void) 661 585 { … … 763 687 } 764 688 689 void CDomain::checkLonLat() 690 { 691 hasLonLat = (!latvalue_1d.isEmpty() && !lonvalue_1d.isEmpty()) || 692 (!latvalue_2d.isEmpty() && !lonvalue_2d.isEmpty()); 693 } 694 765 695 void CDomain::checkAttributesOnClientAfterTransformation() 766 696 { … … 772 702 { 773 703 this->checkMask(); 774 this->computeConnectedServer();775 this->completeLonLatClient();704 if (hasLonLat || hasArea) this->computeConnectedServer(); 705 if (hasLonLat) this->completeLonLatClient(); 776 706 } 777 707 … … 790 720 this->checkBounds(); 791 721 this->checkArea(); 722 this->checkLonLat(); 792 723 793 724 if (context->hasClient) … … 815 746 if (context->hasClient) 816 747 { 817 sendServerAttribut() 818 sendLonLatArea();748 sendServerAttribut(); 749 if (hasLonLat || hasArea) sendLonLatArea(); 819 750 } 820 751 … … 829 760 this->checkDomain(); 830 761 this->checkZoom(); 762 this->checkLonLat(); 831 763 this->checkBounds(); 832 764 this->checkArea(); … … 1015 947 } 1016 948 1017 void CDomain::send LonLatArea(void)949 void CDomain::sendIndex() 1018 950 { 1019 951 int ns, n, i, j, ind, nv, idx; … … 1021 953 CContextClient* client=context->client; 1022 954 1023 // send lon lat for each connected server1024 955 CEventClient eventIndex(getType(), EVENT_ID_INDEX); 1025 CEventClient eventLon(getType(), EVENT_ID_LON); 1026 CEventClient eventLat(getType(), EVENT_ID_LAT); 1027 CEventClient eventArea(getType(), EVENT_ID_AREA); 1028 1029 list<CMessage> list_msgsIndex, list_msgsLon, list_msgsLat, list_msgsArea; 956 957 list<CMessage> list_msgsIndex; 1030 958 list<CArray<int,1> > list_indi, list_indj; 1031 list<CArray<double,1> > list_lon, list_lat;1032 list<CArray<double,2> > list_boundslon, list_boundslat;1033 list<CArray<double,1> > list_area;1034 959 1035 960 std::map<int, std::vector<size_t> >::const_iterator it, iteMap; … … 1045 970 list_indi.push_back(CArray<int,1>(nbData)); 1046 971 list_indj.push_back(CArray<int,1>(nbData)); 972 973 CArray<int,1>& indi = list_indi.back(); 974 CArray<int,1>& indj = list_indj.back(); 975 const std::vector<size_t>& temp = it->second; 976 for (n = 0; n < nbData; ++n) 977 { 978 idx = static_cast<int>(it->second[n]); 979 indi(n) = i_index(idx); 980 indj(n) = j_index(idx); 981 } 982 983 list_msgsIndex.push_back(CMessage()); 984 985 list_msgsIndex.back() << this->getId() << (int)type; // enum ne fonctionne pour les message => ToFix 986 list_msgsIndex.back() << isCurvilinear; 987 list_msgsIndex.back() << list_indi.back() << list_indj.back(); 988 989 eventIndex.push(rank, nbConnectedClients_[rank], list_msgsIndex.back()); 990 } 991 992 client->sendEvent(eventIndex); 993 } 994 995 void CDomain::sendArea() 996 { 997 if (!hasArea) return; 998 999 int ns, n, i, j, ind, nv, idx; 1000 CContext* context = CContext::getCurrent(); 1001 CContextClient* client=context->client; 1002 1003 // send area for each connected server 1004 CEventClient eventArea(getType(), EVENT_ID_AREA); 1005 1006 list<CMessage> list_msgsArea; 1007 list<CArray<double,1> > list_area; 1008 1009 std::map<int, std::vector<size_t> >::const_iterator it, iteMap; 1010 iteMap = indSrv_.end(); 1011 for (int k = 0; k < connectedServerRank_.size(); ++k) 1012 { 1013 int nbData = 0; 1014 int rank = connectedServerRank_[k]; 1015 it = indSrv_.find(rank); 1016 if (iteMap != it) 1017 nbData = it->second.size(); 1018 list_area.push_back(CArray<double,1>(nbData)); 1019 1020 const std::vector<size_t>& temp = it->second; 1021 for (n = 0; n < nbData; ++n) 1022 { 1023 idx = static_cast<int>(it->second[n]); 1024 i = i_index(idx); 1025 j = j_index(idx); 1026 if (hasArea) 1027 list_area.back()(n) = area(i - ibegin, j - jbegin); 1028 } 1029 1030 list_msgsArea.push_back(CMessage()); 1031 list_msgsArea.back() << this->getId() << list_area.back(); 1032 eventArea.push(rank, nbConnectedClients_[rank], list_msgsArea.back()); 1033 } 1034 client->sendEvent(eventArea); 1035 } 1036 1037 void CDomain::sendLonLat() 1038 { 1039 if (!hasLonLat) return; 1040 1041 int ns, n, i, j, ind, nv, idx; 1042 CContext* context = CContext::getCurrent(); 1043 CContextClient* client=context->client; 1044 1045 // send lon lat for each connected server 1046 CEventClient eventLon(getType(), EVENT_ID_LON); 1047 CEventClient eventLat(getType(), EVENT_ID_LAT); 1048 1049 list<CMessage> list_msgsLon, list_msgsLat; 1050 list<CArray<double,1> > list_lon, list_lat; 1051 list<CArray<double,2> > list_boundslon, list_boundslat; 1052 1053 std::map<int, std::vector<size_t> >::const_iterator it, iteMap; 1054 iteMap = indSrv_.end(); 1055 for (int k = 0; k < connectedServerRank_.size(); ++k) 1056 { 1057 int nbData = 0; 1058 int rank = connectedServerRank_[k]; 1059 it = indSrv_.find(rank); 1060 if (iteMap != it) 1061 nbData = it->second.size(); 1062 1047 1063 list_lon.push_back(CArray<double,1>(nbData)); 1048 1064 list_lat.push_back(CArray<double,1>(nbData)); … … 1053 1069 list_boundslat.push_back(CArray<double,2>(nvertex, nbData)); 1054 1070 } 1055 if (hasArea) 1056 list_area.push_back(CArray<double,1>(nbData)); 1057 1058 CArray<int,1>& indi = list_indi.back(); 1059 CArray<int,1>& indj = list_indj.back(); 1071 1060 1072 CArray<double,1>& lon = list_lon.back(); 1061 1073 CArray<double,1>& lat = list_lat.back(); … … 1082 1094 } 1083 1095 } 1084 1085 indi(n) = i; 1086 indj(n) = j; 1087 1088 if (hasArea) 1089 list_area.back()(n) = area(i - ibegin, j - jbegin); 1090 } 1091 1092 list_msgsIndex.push_back(CMessage()); 1093 1094 list_msgsIndex.back() << this->getId() << (int)type; // enum ne fonctionne pour les message => ToFix 1095 list_msgsIndex.back() << isCurvilinear; 1096 list_msgsIndex.back() << list_indi.back() << list_indj.back(); 1096 } 1097 1097 1098 1098 list_msgsLon.push_back(CMessage()); … … 1108 1108 } 1109 1109 1110 eventIndex.push(rank, nbConnectedClients_[rank], list_msgsIndex.back());1111 1110 eventLon.push(rank, nbConnectedClients_[rank], list_msgsLon.back()); 1112 1111 eventLat.push(rank, nbConnectedClients_[rank], list_msgsLat.back()); 1113 1114 if (hasArea) 1115 { 1116 list_msgsArea.push_back(CMessage()); 1117 list_msgsArea.back() << this->getId() << list_area.back(); 1118 eventArea.push(rank, nbConnectedClients_[rank], list_msgsArea.back()); 1119 } 1120 } 1121 1122 client->sendEvent(eventIndex); 1112 } 1113 1123 1114 client->sendEvent(eventLon); 1124 1115 client->sendEvent(eventLat); 1125 if (hasArea) 1126 client->sendEvent(eventArea); 1116 } 1117 1118 1119 void CDomain::sendLonLatArea(void) 1120 { 1121 sendIndex(); 1122 sendLonLat(); 1123 sendArea(); 1127 1124 } 1128 1125 -
XIOS/trunk/src/node/domain.hpp
r664 r665 90 90 void checkBounds(void); 91 91 void checkArea(void); 92 void checkLonLat(); 92 93 93 94 … … 172 173 bool hasBounds ; 173 174 bool hasArea; 175 bool hasLonLat; 174 176 private: 175 177 void checkTransformations(); … … 178 180 void completeLonClient(); 179 181 void completeLatClient(); 182 183 void sendIndex(); 184 void sendArea(); 185 void sendLonLat(); 180 186 181 187 private :
Note: See TracChangeset
for help on using the changeset viewer.