Changeset 1562 for XIOS/trunk/src/distribution_client.cpp
- Timestamp:
- 07/18/18 16:04:07 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/distribution_client.cpp
r1557 r1562 14 14 : CDistribution(rank, 0) 15 15 , axisDomainOrder_() 16 , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_() ,nZoomBegin_(), nZoomEnd_()16 , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_() 17 17 , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 18 18 , gridMask_(), indexMap_() … … 22 22 , infoIndex_(), isComputed_(false) 23 23 , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_() 24 , element ZoomMask_(), elementNLocal_(), elementNGlobal_()24 , elementNLocal_(), elementNGlobal_() 25 25 { 26 26 readDistributionInfo(grid); … … 153 153 nBeginLocal_.resize(this->dims_,0); 154 154 nBeginGlobal_.resize(this->dims_,0); 155 nZoomBegin_.resize(this->dims_);156 nZoomEnd_.resize(this->dims_);157 155 158 156 // Data_n_index of domain or axis (For now, axis uses its size as data_n_index … … 172 170 elementGlobalIndex_.resize(numElement_); 173 171 elementIndexData_.resize(numElement_); 174 elementZoomMask_.resize(numElement_);175 172 elementNLocal_.resize(numElement_); 176 173 elementNGlobal_.resize(numElement_); … … 195 192 nBeginLocal_.at(indexMap_[idx]+1) = 0; 196 193 nBeginGlobal_.at(indexMap_[idx]+1) = domList[domIndex]->jbegin; 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;199 194 200 195 dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); … … 207 202 nBeginLocal_.at(indexMap_[idx]) = 0; 208 203 nBeginGlobal_.at(indexMap_[idx]) = domList[domIndex]->ibegin; 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;211 204 212 205 dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); … … 229 222 nBeginLocal_.at(indexMap_[idx]) = 0; 230 223 nBeginGlobal_.at(indexMap_[idx]) = axisList[axisIndex]->begin.getValue(); 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;233 224 234 225 dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); … … 251 242 nBeginLocal_.at(indexMap_[idx]) = 0; 252 243 nBeginGlobal_.at(indexMap_[idx]) = 1; 253 nZoomBegin_.at((indexMap_[idx])) = 0;254 nZoomEnd_.at((indexMap_[idx])) = 0;255 244 256 245 dataBegin_.at(indexMap_[idx]) = 0; … … 303 292 elementLocalIndex_[i].resize(count); 304 293 elementGlobalIndex_[i].resize(count); 305 elementZoomMask_[i].resize(count);306 elementZoomMask_[i] = false;307 294 count = 0; 308 295 CArray<bool,1>& tmpIndexElementData = elementIndexData_[i]; 309 CArray<bool,1>& tmpZoomMaskElement = elementZoomMask_[i];310 296 CArray<int,1>& tmpLocalElementIndex = elementLocalIndex_[i]; 311 297 CArray<size_t,1>& tmpGlobalElementIndex = elementGlobalIndex_[i]; … … 319 305 localIndex = tmpLocalElementIndex(count) = iIdx + jIdx * nLocal_[indexMap_[i]]; 320 306 tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(localIndex) + ((infoIndex_[indexMap_[i]+1])(localIndex))*nGlob_[indexMap_[i]]; 321 if ((((infoIndex_[indexMap_[i]])(localIndex)) <= nZoomEnd_[indexMap_[i]])322 && (nZoomBegin_[indexMap_[i]] <= ((infoIndex_[indexMap_[i]])(localIndex)))323 && (((infoIndex_[indexMap_[i]+1])(localIndex)) <= nZoomEnd_[indexMap_[i]+1])324 && (nZoomBegin_[indexMap_[i]+1] <= ((infoIndex_[indexMap_[i]+1])(localIndex))))325 {326 tmpZoomMaskElement(count) = true;327 }328 307 ++count; 329 308 } … … 360 339 elementLocalIndex_[i].resize(count); 361 340 elementGlobalIndex_[i].resize(count); 362 elementZoomMask_[i].resize(count);363 elementZoomMask_[i] = false;364 341 count = 0; 365 342 CArray<bool,1>& tmpIndexElementData = elementIndexData_[i]; 366 CArray<bool,1>& tmpZoomMaskElement = elementZoomMask_[i];367 343 CArray<int,1>& tmpLocalElementIndex = elementLocalIndex_[i]; 368 344 CArray<size_t,1>& tmpGlobalElementIndex = elementGlobalIndex_[i]; … … 373 349 iIdx = tmpLocalElementIndex(count) = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); 374 350 tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(iIdx); 375 if ((((infoIndex_[indexMap_[i]])(iIdx)) <= nZoomEnd_[indexMap_[i]])376 && (nZoomBegin_[indexMap_[i]] <= ((infoIndex_[indexMap_[i]])(iIdx))))377 {378 tmpZoomMaskElement(count) = true;379 }380 351 ++count; 381 352 } … … 404 375 elementGlobalIndex_[i].resize(count); 405 376 elementGlobalIndex_[i] = 0; 406 elementZoomMask_[i].resize(count);407 elementZoomMask_[i] = true;408 377 } 409 378 } … … 440 409 std::vector<StdSize> currentGlobalIndex(numElement_,0); 441 410 int innerLoopSize = eachElementSize[0]; 442 size_t idx = 0, indexLocalDataOnClientCount = 0 , indexSend2ServerCount = 0;411 size_t idx = 0, indexLocalDataOnClientCount = 0; 443 412 size_t ssize = 1; 444 413 for (int i = 0; i < numElement_; ++i) ssize *= eachElementSize[i]; … … 475 444 { 476 445 ++indexLocalDataOnClientCount; 477 bool isIndexOnServer = true;478 479 for (int idxElement = 0; idxElement < this->numElement_; ++idxElement)480 {481 isIndexOnServer = isIndexOnServer && elementZoomMask_[idxElement](idxLoop[idxElement]);482 }483 if (isIndexOnServer) ++indexSend2ServerCount;484 446 } 485 447 } … … 490 452 // Now allocate these arrays 491 453 localDataIndex_.resize(indexLocalDataOnClientCount); 492 localMaskIndex_.resize(index Send2ServerCount);493 localMaskedDataIndex_.resize(index Send2ServerCount);494 globalDataIndex_.rehash(std::ceil(indexLocalDataOnClientCount/globalDataIndex_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount);495 globalLocalDataSendToServerMap_.rehash(std::ceil(index Send2ServerCount/globalLocalDataSendToServerMap_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount);454 localMaskIndex_.resize(indexLocalDataOnClientCount); 455 localMaskedDataIndex_.resize(indexLocalDataOnClientCount); 456 globalDataIndex_.rehash(std::ceil(indexLocalDataOnClientCount/globalDataIndex_.max_load_factor())); 457 globalLocalDataSendToServerMap_.rehash(std::ceil(indexLocalDataOnClientCount/globalLocalDataSendToServerMap_.max_load_factor())); 496 458 497 459 // We need to loop with data index 498 460 idxLoop.assign(numElement_,0); 499 idx = indexLocalDataOnClientCount = indexSend2ServerCount =0;461 idx = indexLocalDataOnClientCount = 0; 500 462 ssize = 1; for (int i = 0; i < numElement_; ++i) ssize *= dataNIndex_[i]; 501 463 innerLoopSize = dataNIndex_[0]; … … 565 527 globalDataIndex_[globalIndex] = indexLocalDataOnClientCount; 566 528 localDataIndex_[indexLocalDataOnClientCount] = countLocalData; 567 bool isIndexOnServer = true; 568 for (int idxElement = 0; idxElement < this->numElement_; ++idxElement) 569 { 570 isIndexOnServer = isIndexOnServer && elementZoomMask_[idxElement](correctIndexOfElement[idxElement]); 571 } 572 573 if (isIndexOnServer) 574 { 575 globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; 576 localMaskIndex_[indexSend2ServerCount] = gridMaskIndex; 577 localMaskedDataIndex_[indexSend2ServerCount] = indexLocalDataOnClientCount; 578 ++indexSend2ServerCount; 579 } 529 globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; 530 localMaskIndex_[indexLocalDataOnClientCount] = gridMaskIndex; 531 localMaskedDataIndex_[indexLocalDataOnClientCount] = indexLocalDataOnClientCount; 580 532 ++indexLocalDataOnClientCount; 581 533 } … … 644 596 if ((tempI < 0) || (tempI > ni)) 645 597 return -1; 646 else if (tempI == ni)598 else 647 599 return tempI; 648 else649 return ((tempI)%ni);650 600 } 651 601
Note: See TracChangeset
for help on using the changeset viewer.