Changeset 584 for XIOS/trunk/src/node/domain.cpp
- Timestamp:
- 04/01/15 17:52:53 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/domain.cpp
r569 r584 23 23 CDomain::CDomain(void) 24 24 : CObjectTemplate<CDomain>(), CDomainAttributes() 25 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_() 25 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 26 26 { /* Ne rien faire de plus */ } 27 27 28 28 CDomain::CDomain(const StdString & id) 29 29 : CObjectTemplate<CDomain>(id), CDomainAttributes() 30 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_() 30 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 31 31 { /* Ne rien faire de plus */ } 32 32 … … 449 449 StdSize dm = zoom_ni_client * zoom_nj_client; 450 450 451 lonvalue.resize(dm); 452 latvalue.resize(dm); 451 // Make sure that this attribute is non-empty for every client. 452 if (0 != dm) 453 { 454 lonvalue.resize(dm); 455 latvalue.resize(dm); 456 } 457 453 458 454 459 for (int i = 0; i < zoom_ni_client; i++) … … 668 673 int zoom_jend=zoom_jbegin+zoom_nj-1 ; 669 674 670 671 675 // Precompute number of index 672 int globalIndexCount = 0;676 int globalIndexCountZoom = 0; 673 677 for(j=0;j<nj;j++) 674 678 for(i=0;i<ni;i++) … … 679 683 if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 680 684 { 681 ++globalIndexCount ;685 ++globalIndexCountZoom; 682 686 } 683 687 } 684 688 685 689 // Fill in index 686 CArray<size_t,1> globalIndexDomain(globalIndexCount); 690 CArray<size_t,1> globalIndexDomainZoom(globalIndexCountZoom); 691 CArray<size_t,1> globalIndexDomain(ni*nj); 687 692 size_t globalIndex; 688 globalIndexCount = 0; 693 int globalIndexCount = 0; 694 globalIndexCountZoom = 0; 689 695 690 696 for(j=0;j<nj;j++) … … 694 700 j_ind=jbegin+j_index(i,j) ; 695 701 702 globalIndex = i_ind + j_ind * ni_glo; 703 globalIndexDomain(globalIndexCount) = globalIndex; 704 ++globalIndexCount; 696 705 if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 697 706 { 698 globalIndex = i_ind + j_ind * ni_glo; 699 globalIndexDomain(globalIndexCount) = globalIndex; 700 ++globalIndexCount; 707 globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 708 ++globalIndexCountZoom; 701 709 } 702 710 } … … 724 732 clientServerMap->computeServerIndexMapping(globalIndexDomain); 725 733 const std::map<int, std::vector<size_t> >& globalIndexDomainOnServer = clientServerMap->getGlobalIndexOnServer(); 726 std::vector<int> connectedServerRank; 727 for (std::map<int, std::vector<size_t> >::const_iterator it = globalIndexDomainOnServer.begin(); it != globalIndexDomainOnServer.end(); ++it) { 728 connectedServerRank.push_back(it->first); 734 735 std::map<int, std::vector<size_t> >::const_iterator it = globalIndexDomainOnServer.begin(), 736 ite = globalIndexDomainOnServer.end(); 737 indSrv_.clear(); 738 for (; it != ite; ++it) 739 { 740 int rank = it->first; 741 std::vector<size_t>::const_iterator itbVec = (it->second).begin(), 742 iteVec = (it->second).end(); 743 int nb = globalIndexDomainZoom.numElements(); 744 for (int i = 0; i < nb; ++i) 745 { 746 if (std::binary_search(itbVec, iteVec, globalIndexDomainZoom(i))) 747 { 748 indSrv_[rank].push_back(globalIndexDomainZoom(i)); 749 } 750 } 729 751 } 730 nbConnectedClients_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank); 731 indSrv_ = globalIndexDomainOnServer; 752 753 connectedServerRank_.clear(); 754 for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) { 755 connectedServerRank_.push_back(it->first); 756 } 757 758 if (!indSrv_.empty()) 759 { 760 connectedServerRank_.clear(); 761 for (it = indSrv_.begin(); it != indSrv_.end(); ++it) 762 connectedServerRank_.push_back(it->first); 763 } 764 nbConnectedClients_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 732 765 733 766 delete clientServerMap; … … 753 786 itbMap = indSrv_.begin(); 754 787 iteMap = indSrv_.end(); 755 for (i t = itbMap; it != iteMap; ++it)788 for (int k = 0; k < connectedServerRank_.size(); ++k) 756 789 { 757 int rank = it->first; 758 int nbData = (it->second).size(); 790 int nbData = 0; 791 int rank = connectedServerRank_[k]; 792 it = indSrv_.find(rank); 793 if (iteMap != it) 794 nbData = (it->second).size(); 795 759 796 CArray<int,1> indi(nbData) ; 760 797 CArray<int,1> indj(nbData) ; … … 807 844 *list_msgLat.back()<<*list_boundslat.back(); 808 845 } 846 809 847 eventLon.push(rank,nbConnectedClients_[rank],*list_msgLon.back()) ; 810 848 eventLat.push(rank,nbConnectedClients_[rank],*list_msgLat.back()) ;
Note: See TracChangeset
for help on using the changeset viewer.