Changeset 1562


Ignore:
Timestamp:
07/18/18 16:04:07 (2 years ago)
Author:
oabramkina
Message:

Some cleaning related to zoom.

Location:
XIOS/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/distribution_client.cpp

    r1557 r1562  
    1414   : CDistribution(rank, 0) 
    1515   , axisDomainOrder_() 
    16    , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_() 
     16   , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_() 
    1717   , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 
    1818   , gridMask_(), indexMap_() 
     
    2222   , infoIndex_(), isComputed_(false) 
    2323   , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_() 
    24    , elementZoomMask_(), elementNLocal_(), elementNGlobal_() 
     24   , elementNLocal_(), elementNGlobal_() 
    2525{ 
    2626  readDistributionInfo(grid); 
     
    153153  nBeginLocal_.resize(this->dims_,0); 
    154154  nBeginGlobal_.resize(this->dims_,0); 
    155   nZoomBegin_.resize(this->dims_); 
    156   nZoomEnd_.resize(this->dims_); 
    157155 
    158156  // Data_n_index of domain or axis (For now, axis uses its size as data_n_index 
     
    172170  elementGlobalIndex_.resize(numElement_); 
    173171  elementIndexData_.resize(numElement_); 
    174   elementZoomMask_.resize(numElement_); 
    175172  elementNLocal_.resize(numElement_); 
    176173  elementNGlobal_.resize(numElement_); 
     
    195192      nBeginLocal_.at(indexMap_[idx]+1) = 0; 
    196193      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; 
    199194 
    200195      dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); 
     
    207202      nBeginLocal_.at(indexMap_[idx]) = 0; 
    208203      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; 
    211204 
    212205      dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); 
     
    229222      nBeginLocal_.at(indexMap_[idx]) = 0; 
    230223      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; 
    233224 
    234225      dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); 
     
    251242      nBeginLocal_.at(indexMap_[idx]) = 0; 
    252243      nBeginGlobal_.at(indexMap_[idx]) = 1; 
    253       nZoomBegin_.at((indexMap_[idx])) = 0; 
    254       nZoomEnd_.at((indexMap_[idx])) = 0; 
    255244 
    256245      dataBegin_.at(indexMap_[idx]) = 0; 
     
    303292      elementLocalIndex_[i].resize(count); 
    304293      elementGlobalIndex_[i].resize(count); 
    305       elementZoomMask_[i].resize(count); 
    306       elementZoomMask_[i] = false; 
    307294      count = 0; 
    308295      CArray<bool,1>& tmpIndexElementData = elementIndexData_[i]; 
    309       CArray<bool,1>& tmpZoomMaskElement = elementZoomMask_[i]; 
    310296      CArray<int,1>& tmpLocalElementIndex = elementLocalIndex_[i]; 
    311297      CArray<size_t,1>& tmpGlobalElementIndex = elementGlobalIndex_[i]; 
     
    319305          localIndex = tmpLocalElementIndex(count) = iIdx + jIdx * nLocal_[indexMap_[i]]; 
    320306          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           } 
    328307          ++count; 
    329308        } 
     
    360339      elementLocalIndex_[i].resize(count); 
    361340      elementGlobalIndex_[i].resize(count); 
    362       elementZoomMask_[i].resize(count); 
    363       elementZoomMask_[i] = false; 
    364341      count = 0; 
    365342      CArray<bool,1>& tmpIndexElementData = elementIndexData_[i]; 
    366       CArray<bool,1>& tmpZoomMaskElement = elementZoomMask_[i]; 
    367343      CArray<int,1>& tmpLocalElementIndex = elementLocalIndex_[i]; 
    368344      CArray<size_t,1>& tmpGlobalElementIndex = elementGlobalIndex_[i]; 
     
    373349          iIdx = tmpLocalElementIndex(count) = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); 
    374350          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           } 
    380351          ++count; 
    381352        } 
     
    404375      elementGlobalIndex_[i].resize(count); 
    405376      elementGlobalIndex_[i] = 0; 
    406       elementZoomMask_[i].resize(count); 
    407       elementZoomMask_[i] = true; 
    408377    } 
    409378  } 
     
    440409  std::vector<StdSize> currentGlobalIndex(numElement_,0); 
    441410  int innerLoopSize = eachElementSize[0]; 
    442   size_t idx = 0, indexLocalDataOnClientCount = 0, indexSend2ServerCount = 0; 
     411  size_t idx = 0, indexLocalDataOnClientCount = 0; 
    443412  size_t ssize = 1; 
    444413  for (int i = 0; i < numElement_; ++i) ssize *= eachElementSize[i]; 
     
    475444      { 
    476445        ++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; 
    484446      } 
    485447    } 
     
    490452  // Now allocate these arrays 
    491453  localDataIndex_.resize(indexLocalDataOnClientCount); 
    492   localMaskIndex_.resize(indexSend2ServerCount); 
    493   localMaskedDataIndex_.resize(indexSend2ServerCount); 
    494   globalDataIndex_.rehash(std::ceil(indexLocalDataOnClientCount/globalDataIndex_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount); 
    495   globalLocalDataSendToServerMap_.rehash(std::ceil(indexSend2ServerCount/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())); 
    496458 
    497459  // We need to loop with data index 
    498460  idxLoop.assign(numElement_,0); 
    499   idx = indexLocalDataOnClientCount = indexSend2ServerCount = 0; 
     461  idx = indexLocalDataOnClientCount = 0; 
    500462  ssize = 1; for (int i = 0; i < numElement_; ++i) ssize *= dataNIndex_[i]; 
    501463  innerLoopSize = dataNIndex_[0]; 
     
    565527            globalDataIndex_[globalIndex] = indexLocalDataOnClientCount; 
    566528            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; 
    580532            ++indexLocalDataOnClientCount; 
    581533          } 
     
    644596  if ((tempI < 0) || (tempI > ni)) 
    645597    return -1; 
    646   else if (tempI == ni) 
     598  else 
    647599    return tempI; 
    648   else 
    649     return ((tempI)%ni); 
    650600} 
    651601 
  • XIOS/trunk/src/distribution_client.hpp

    r1549 r1562  
    9797    std::vector<int> nBeginLocal_;//!< Begin index of each dimension (e.x: for domain, it's always 0, for axis, it's zoom_begin, ...) 
    9898    std::vector<int> nBeginGlobal_; //!< Begin index of each dimension (e.x: ibegin, jbegin, ...) 
    99     std::vector<int> nZoomBegin_; //!< Begin index of zoom of each dimension 
    100     std::vector<int> nZoomEnd_; //!< End index of zoom of each dimension 
    10199 
    102100    // Data_n_index of domain or axis (For now, axis uses its size as data_n_index 
     
    114112    std::vector<CArray<size_t,1> > elementGlobalIndex_; //!< Global index of each element 
    115113    std::vector<CArray<bool,1> > elementIndexData_; //!< // The correct index of a domain has true value, the ghost one has false value 
    116     std::vector<CArray<bool,1> > elementZoomMask_; //!< Only zoomed region are true 
    117114    std::vector<size_t> elementNLocal_; 
    118115    std::vector<size_t> elementNGlobal_; 
  • XIOS/trunk/src/node/axis.hpp

    r1559 r1562  
    2929   BEGIN_DECLARE_ATTRIBUTE_MAP(CAxis) 
    3030#  include "axis_attribute.conf" 
    31 #  include "axis_attribute_private.conf" 
    3231   END_DECLARE_ATTRIBUTE_MAP(CAxis) 
    3332 
  • XIOS/trunk/src/node/grid.cpp

    r1559 r1562  
    12971297      const std::vector<int>& localMaskedDataIndex = clientDistribution_->getLocalMaskedDataIndexOnClient(); 
    12981298      const int size = localMaskedDataIndex.size(); 
    1299        
    13001299      for(int i = 0; i < size; ++i) out(localMaskedDataIndex[i]) = data[i]; 
    13011300   } 
     
    13051304  { 
    13061305    CContext* context = CContext::getCurrent();     
    1307 //    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 
    1308 //    for (int p = 0; p < nbSrvPools; ++p) 
    1309     { 
    1310 //      CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 
    1311 //                                                    : context->client; 
     1306    { 
    13121307      CContextClient* client = context->client; 
    13131308 
Note: See TracChangeset for help on using the changeset viewer.