Ignore:
Timestamp:
11/05/18 13:57:52 (5 years ago)
Author:
oabramkina
Message:

Backporting r1578 and r1586 to dev, cleaning the code before merging it to XIOS 2.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/distribution_client.cpp

    r1570 r1589  
    1515   , axisDomainOrder_() 
    1616   , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_() 
    17    , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_()//, domainMasks_()//, axisMasks_() 
     17   , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_() 
    1818   , gridMask_(), indexMap_() 
    1919   , isDataDistributed_(true), axisNum_(0), domainNum_(0) 
     
    6161  // Then check mask of grid 
    6262  int gridDim = domList.size() * 2 + axisList.size(); 
    63 //  grid->checkMask(); 
    6463  switch (gridDim) { 
    6564    case 0: 
     
    117116  axisDomainOrder_ = axisDomainOrder; 
    118117 
    119 //  // Each domain or axis has its mask, of course 
    120 //  domainMasks_.resize(domainNum_); 
    121 //  for (int i = 0; i < domainNum_;++i) 
    122 //  { 
    123 //    domainMasks_[i].resize(domList[i]->domainMask.numElements()); 
    124 //    domainMasks_[i] = domList[i]->domainMask; 
    125 //  } 
    126  
    127 //  axisMasks_.resize(axisNum_); 
    128 //  for (int i = 0; i < axisNum_; ++i) 
    129 //  { 
    130 //    axisMasks_[i].resize(axisList[i]->mask.numElements()); 
    131 //    axisMasks_[i] = axisList[i]->mask; 
    132 //  } 
    133  
    134118  // Because domain and axis can be in any order (axis1, domain1, axis2, axis3, ) 
    135119  // their position should be specified. In axisDomainOrder, domain == true, axis == false 
     
    283267        if ((iIdx >= nBeginLocal_[indexMap_[i]]) && (iIdx < nLocal_[indexMap_[i]]) && 
    284268           (jIdx >= nBeginLocal_[indexMap_[i]+1]) && (jIdx < nLocal_[indexMap_[i]+1])) 
    285 //           && (domainMasks_[idxDomain](iIdx + jIdx*nLocal_[indexMap_[i]]))) 
    286269        { 
    287270          ++count; 
     
    413396 
    414397  for (int i = 0; i < numElement_; ++i) ssize *= eachElementSize[i]; 
    415 //  while (idx < ssize) 
    416 //  { 
    417 //    for (int i = 0; i < numElement_-1; ++i) 
    418 //    { 
    419 //      if (idxLoop[i] == eachElementSize[i]) 
    420 //      { 
    421 //        idxLoop[i] = 0; 
    422 //        ++idxLoop[i+1]; 
    423 //      } 
    424 //    } 
    425 // 
    426 //    // Find out outer index 
    427 //    // Depending the inner-most element is axis or domain, 
    428 //    // The outer loop index begins correspondingly at one (1) or zero (0) 
    429 //    for (int i = 1; i < numElement_; ++i) 
    430 //    { 
    431 //      currentIndex[i] = elementLocalIndex_[i](idxLoop[i]); 
    432 //    } 
    433 // 
    434 //    // Inner most index 
    435 //    for (int i = 0; i < innerLoopSize; ++i) 
    436 //    { 
    437 //      int gridMaskIndex = 0; 
    438 //      currentIndex[0] = elementLocalIndex_[0](i); 
    439 // 
    440 //      bool maskTmp = true; 
    441 //      int idxDomain = 0, idxAxis = 0; 
    442 //      for (int elem = 0; elem < numElement_; ++elem) 
    443 //      { 
    444 //        if (2 == axisDomainOrder_(elem)) 
    445 //        { 
    446 //          maskTmp = maskTmp && domainMasks_[idxDomain](currentIndex[elem]); 
    447 //          ++idxDomain; 
    448 //        } 
    449 //        else if (1 == axisDomainOrder_(elem)) 
    450 //        { 
    451 //          maskTmp = maskTmp && axisMasks_[idxAxis](currentIndex[elem]); 
    452 //          ++idxAxis; 
    453 //        } 
    454 //      } 
    455 //      if (maskTmp) ++indexLocalDataOnClientCount; 
    456 //    } 
    457 //    idxLoop[0] += innerLoopSize; 
    458 //    idx += innerLoopSize; 
    459 //  } 
    460  
    461   // Now allocate these arrays 
    462 //  localDataIndex_.resize(indexLocalDataOnClientCount); 
    463 //  localMaskIndex_.resize(indexLocalDataOnClientCount); 
    464 //  localMaskedDataIndex_.resize(indexLocalDataOnClientCount); 
    465 //  globalDataIndex_.rehash(std::ceil(indexLocalDataOnClientCount/globalDataIndex_.max_load_factor())); 
    466 //  globalLocalDataSendToServerMap_.rehash(std::ceil(indexLocalDataOnClientCount/globalLocalDataSendToServerMap_.max_load_factor())); 
    467398 
    468399  localDataIndex_.resize(ssize); 
     
    530461          bool maskTmp = true; 
    531462          bool maskGridTmp = true; 
    532  
    533 //          // Domain or axis mask: only unmasked values will be sent 
    534 //          int idxDomain = 0, idxAxis = 0; 
    535 //          for (int elem = 0; elem < numElement_; ++elem) 
    536 //          { 
    537 //            if (2 == axisDomainOrder_(elem)) 
    538 //            { 
    539 //              maskTmp = maskTmp && domainMasks_[idxDomain](currentIndex[elem]); 
    540 //              ++idxDomain; 
    541 //            } 
    542 //            else if (1 == axisDomainOrder_(elem)) 
    543 //            { 
    544 //              maskTmp = maskTmp && axisMasks_[idxAxis](currentIndex[elem]); 
    545 //              ++idxAxis; 
    546 //            } 
    547 //          } 
    548  
    549 //          if (maskTmp) 
    550 //          { 
    551             size_t globalIndex = 0; 
    552             for (int k = 0; k < numElement_; ++k) 
    553             { 
    554               globalIndex += (currentGlobalIndex[k])*elementNGlobal_[k]; 
    555             } 
    556             globalDataIndex_[globalIndex] = indexLocalDataOnClientCount; 
    557             localDataIndex_[indexLocalDataOnClientCount] = countLocalData; 
    558             globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; 
    559             localMaskedDataIndex_[indexLocalDataOnClientCount] = indexLocalDataOnClientCount; 
    560 //          } 
     463          size_t globalIndex = 0; 
     464          for (int k = 0; k < numElement_; ++k) 
     465          { 
     466            globalIndex += (currentGlobalIndex[k])*elementNGlobal_[k]; 
     467          } 
     468          globalDataIndex_[globalIndex] = indexLocalDataOnClientCount; 
     469          localDataIndex_[indexLocalDataOnClientCount] = countLocalData; 
     470          globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; 
     471          localMaskedDataIndex_[indexLocalDataOnClientCount] = indexLocalDataOnClientCount; 
    561472 
    562473          // Grid mask: unmasked values will be replaces by NaN and then all values will be sent 
Note: See TracChangeset for help on using the changeset viewer.