Changeset 1460 for XIOS/dev/branch_openmp/src/distribution_client.cpp
- Timestamp:
- 03/22/18 10:43:20 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/distribution_client.cpp
r932 r1460 10 10 11 11 namespace xios { 12 13 CDistributionClient::CDistributionClient(int rank, int dims, const CArray<size_t,1>& globalIndex)14 : CDistribution(rank, dims, globalIndex)15 , axisDomainOrder_()16 , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_()17 , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_()18 , gridMask_(), indexMap_()19 , isDataDistributed_(true), axisNum_(0), domainNum_(0)20 , localDataIndex_(), localMaskIndex_()21 , globalLocalDataSendToServerMap_()22 , infoIndex_(), isComputed_(false)23 , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_()24 , elementZoomMask_(), elementNLocal_(), elementNGlobal_()25 {26 }27 12 28 13 CDistributionClient::CDistributionClient(int rank, CGrid* grid) … … 46 31 { /* Nothing to do */ } 47 32 33 void CDistributionClient::partialClear() 34 { 35 GlobalLocalMap void1 ; 36 GlobalLocalMap void2 ; 37 std::vector<int> void3 ; 38 std::vector<int> void4 ; 39 40 globalLocalDataSendToServerMap_.swap(void1) ; 41 globalDataIndex_.swap(void2) ; 42 localDataIndex_.swap(void3); 43 localMaskIndex_.swap(void4) ; 44 } 45 48 46 /*! 49 47 Read information of a grid to generate distribution. … … 123 121 for (int i = 0; i < domainNum_;++i) 124 122 { 125 domainMasks_[i].resize(domList[i]-> mask_1d.numElements());126 domainMasks_[i] = domList[i]-> mask_1d;123 domainMasks_[i].resize(domList[i]->domainMask.numElements()); 124 domainMasks_[i] = domList[i]->domainMask; 127 125 } 128 126 … … 197 195 nBeginLocal_.at(indexMap_[idx]+1) = 0; 198 196 nBeginGlobal_.at(indexMap_[idx]+1) = domList[domIndex]->jbegin; 199 nZoomBegin_.at((indexMap_[idx]+1)) = domList[domIndex]->global_zoom_jbegin;200 nZoomEnd_.at((indexMap_[idx]+1)) = domList[domIndex]-> global_zoom_jbegin + domList[domIndex]->global_zoom_nj-1;197 nZoomBegin_.at((indexMap_[idx]+1)) = 0; //domList[domIndex]->global_zoom_jbegin; 198 nZoomEnd_.at((indexMap_[idx]+1)) = domList[domIndex]->nj_glo.getValue()- 1; //domList[domIndex]->global_zoom_jbegin + domList[domIndex]->global_zoom_nj-1; 201 199 202 200 dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); … … 209 207 nBeginLocal_.at(indexMap_[idx]) = 0; 210 208 nBeginGlobal_.at(indexMap_[idx]) = domList[domIndex]->ibegin; 211 nZoomBegin_.at((indexMap_[idx])) = domList[domIndex]->global_zoom_ibegin;212 nZoomEnd_.at((indexMap_[idx])) = domList[domIndex]-> global_zoom_ibegin + domList[domIndex]->global_zoom_ni-1;209 nZoomBegin_.at((indexMap_[idx])) = 0; // domList[domIndex]->global_zoom_ibegin; 210 nZoomEnd_.at((indexMap_[idx])) = domList[domIndex]->ni_glo.getValue() -1; //domList[domIndex]->global_zoom_ibegin + domList[domIndex]->global_zoom_ni-1; 213 211 214 212 dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); … … 231 229 nBeginLocal_.at(indexMap_[idx]) = 0; 232 230 nBeginGlobal_.at(indexMap_[idx]) = axisList[axisIndex]->begin.getValue(); 233 nZoomBegin_.at((indexMap_[idx])) = axisList[axisIndex]->global_zoom_begin;234 nZoomEnd_.at((indexMap_[idx])) = axisList[axisIndex]-> global_zoom_begin + axisList[axisIndex]->global_zoom_n-1;231 nZoomBegin_.at((indexMap_[idx])) = 0; //axisList[axisIndex]->global_zoom_begin; 232 nZoomEnd_.at((indexMap_[idx])) = axisList[axisIndex]->n_glo.getValue() - 1; //axisList[axisIndex]->global_zoom_begin + axisList[axisIndex]->global_zoom_n-1; 235 233 236 234 dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); … … 493 491 localDataIndex_.resize(indexLocalDataOnClientCount); 494 492 localMaskIndex_.resize(indexSend2ServerCount); 493 localMaskedDataIndex_.resize(indexSend2ServerCount); 494 globalDataIndex_.rehash(std::ceil(indexLocalDataOnClientCount/globalDataIndex_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount); 495 495 globalLocalDataSendToServerMap_.rehash(std::ceil(indexSend2ServerCount/globalLocalDataSendToServerMap_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount); 496 496 … … 558 558 if (gridMask_(gridMaskIndex)) 559 559 { 560 size_t globalIndex = 0; 561 for (int k = 0; k < numElement_; ++k) 562 { 563 globalIndex += (currentGlobalIndex[k])*elementNGlobal_[k]; 564 } 565 globalDataIndex_[globalIndex] = indexLocalDataOnClientCount; 560 566 localDataIndex_[indexLocalDataOnClientCount] = countLocalData; 561 567 bool isIndexOnServer = true; … … 567 573 if (isIndexOnServer) 568 574 { 569 size_t globalIndex = 0;570 for (int k = 0; k < numElement_; ++k)571 {572 globalIndex += (currentGlobalIndex[k])*elementNGlobal_[k];573 }574 575 globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; 575 576 localMaskIndex_[indexSend2ServerCount] = gridMaskIndex; 577 localMaskedDataIndex_[indexSend2ServerCount] = indexLocalDataOnClientCount; 576 578 ++indexSend2ServerCount; 577 579 } … … 642 644 } 643 645 646 CDistributionClient::GlobalLocalDataMap& CDistributionClient::getGlobalDataIndexOnClient() 647 { 648 if (!isComputed_) createGlobalIndexSendToServer(); 649 return globalDataIndex_; 650 } 651 644 652 /*! 645 653 Return local data index of client … … 660 668 } 661 669 670 /*! 671 Return local mask index of client 672 */ 673 const std::vector<int>& CDistributionClient::getLocalMaskedDataIndexOnClient() 674 { 675 if (!isComputed_) createGlobalIndexSendToServer(); 676 return localMaskedDataIndex_; 677 } 678 662 679 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.