Ignore:
Timestamp:
03/23/16 16:11:09 (8 years ago)
Author:
mhnguyen
Message:

Cleaning up some redundant coeds and making some improvements

+) Remove some XIOS Search to make code run faster
+) Remove some commented codes

Test
+) On Curie
+) All tests pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r829 r831  
    392392      // Recalculate the distribution of grid destination 
    393393      CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
    394       const std::vector<size_t>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 
    395       const std::vector<int>& localIndexGridDestSendToServer = distributionClientDest.getLocalDataIndexSendToServer(); 
     394      const CDistributionClient::GlobalLocalDataMap& globalLocalIndexGridDestSendToServer = distributionClientDest.getGlobalLocalDataSendToServer(); 
    396395 
    397396      // ComputeTransformation of global index of each element 
     
    402401                                     gridDestinationDimensionSize, 
    403402                                     gridSrcDimensionSize, 
    404                                      globalIndexGridDestSendToServer, 
    405                                      localIndexGridDestSendToServer, 
     403                                     globalLocalIndexGridDestSendToServer, 
    406404                                     globaIndexWeightFromDestToSource); 
    407405 
     
    443441  CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
    444442  const std::vector<int>& localMaskIndexOnClientDest = distributionClientDest.getLocalMaskIndexOnClient(); 
    445   const std::vector<size_t>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); 
    446  
    447   std::vector<size_t>::const_iterator itbArr, itArr, iteArr; 
     443  const CDistributionClient::GlobalLocalDataMap& globalIndexOnClientDest = distributionClientDest.getGlobalLocalDataSendToServer(); 
     444 
     445  CDistributionClient::GlobalLocalDataMap::const_iterator itbArr, itArr, iteArr; 
    448446  itbArr = globalIndexOnClientDest.begin(); 
    449447  iteArr = globalIndexOnClientDest.end(); 
     
    454452  for (itArr = itbArr; itArr != iteArr; ++itArr) 
    455453  { 
    456     if (iteGlobalMap != currentGridIndexToOriginalGridIndex_.find(*itArr)) 
    457     { 
    458       const std::vector<std::pair<int, std::pair<size_t,double> > >& vecIndex = currentGridIndexToOriginalGridIndex_[*itArr]; 
     454    if (iteGlobalMap != currentGridIndexToOriginalGridIndex_.find(itArr->first)) 
     455    { 
     456      const std::vector<std::pair<int, std::pair<size_t,double> > >& vecIndex = currentGridIndexToOriginalGridIndex_[itArr->first]; 
    459457      for (int idx = 0; idx < vecIndex.size(); ++idx) 
    460458      { 
     
    472470  for (itArr = itbArr; itArr != iteArr; ++itArr) 
    473471  { 
    474     if (iteGlobalMap != currentGridIndexToOriginalGridIndex_.find(*itArr)) 
    475     { 
    476       const std::vector<std::pair<int, std::pair<size_t,double> > >& vecIndex = currentGridIndexToOriginalGridIndex_[*itArr]; 
     472    if (iteGlobalMap != currentGridIndexToOriginalGridIndex_.find(itArr->first)) 
     473    { 
     474      const std::vector<std::pair<int, std::pair<size_t,double> > >& vecIndex = currentGridIndexToOriginalGridIndex_[itArr->first]; 
    477475      for (int idx = 0; idx < vecIndex.size(); ++idx) 
    478476      { 
     
    731729 
    732730  const CTransformationMapping::ReceivedIndexMap& globalIndexToReceive = transformationMap.getGlobalIndexReceivedOnGridDestMapping(); 
    733   const CTransformationMapping::SentIndexMap& globalIndexToSend = transformationMap.getGlobalIndexSendToGridDestMapping(); 
    734  
    735 //  CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
    736 //  CDistributionClient distributionClientSrc(client->clientRank, originalGridSource_); 
    737 // 
    738 //  const std::vector<size_t>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); 
    739 //  const std::vector<size_t>& globalIndexOnClientSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); 
    740  
    741 //  std::vector<size_t>::const_iterator itbArr, itArr, iteArr; 
    742 //  std::vector<int>::const_iterator itIndex, itbIndex, iteIndex; 
    743731  CTransformationMapping::ReceivedIndexMap::const_iterator itbMapRecv, itMapRecv, iteMapRecv; 
    744  
    745 //  std::vector<int> permutIndex; 
    746 //  typedef XIOSBinarySearchWithIndex<size_t> BinarySearch; 
    747 // 
    748 //  // Find out local index on grid destination (received) 
    749 //  XIOSAlgorithms::fillInIndex(globalIndexOnClientDest.size(), permutIndex); 
    750 //  XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(globalIndexOnClientDest, permutIndex); 
    751 //  itbIndex = permutIndex.begin(); 
    752 //  iteIndex = permutIndex.end(); 
    753 //  BinarySearch searchClientDest(globalIndexOnClientDest); 
    754732  itbMapRecv = globalIndexToReceive.begin(); 
    755733  iteMapRecv = globalIndexToReceive.end(); 
     
    762740    { 
    763741      int vecSize = ((itMapRecv->second)[i]).size(); 
    764 //      std::vector<std::pair<int,double> > tmpVec; 
    765742      for (int idx = 0; idx < vecSize; ++idx) 
    766743      { 
    767744        const std::pair<int, std::pair<size_t,double> >& tmpPair = (itMapRecv->second)[i][idx]; 
    768745        localIndexToReceiveOnGridDest_[sourceRank][i].push_back(make_pair(tmpPair.first, tmpPair.second.second)); 
    769 //        size_t globalIndex = (itMapRecv->second)[i][idx].first; 
    770 //        double weight = (itMapRecv->second)[i][idx].second; 
    771 //        if (searchClientDest.search(itbIndex, iteIndex, globalIndex, itIndex)) 
    772 //        { 
    773 //          tmpVec.push_back(make_pair(*itIndex, weight)); 
    774 //        } 
    775746      } 
    776 //      localIndexToReceiveOnGridDest_[sourceRank][i] = tmpVec; 
    777747    } 
    778748  } 
    779749 
    780750  // Find out local index on grid source (to send) 
     751  const CTransformationMapping::SentIndexMap& globalIndexToSend = transformationMap.getGlobalIndexSendToGridDestMapping(); 
    781752  CTransformationMapping::SentIndexMap::const_iterator itbMap, itMap, iteMap; 
    782 //  XIOSAlgorithms::fillInIndex(globalIndexOnClientSrc.size(), permutIndex); 
    783 //  XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(globalIndexOnClientSrc, permutIndex); 
    784 //  itbIndex = permutIndex.begin(); 
    785 //  iteIndex = permutIndex.end(); 
    786 //  BinarySearch searchClientSrc(globalIndexOnClientSrc); 
    787753  itbMap = globalIndexToSend.begin(); 
    788754  iteMap = globalIndexToSend.end(); 
     
    794760    for (int idx = 0; idx < vecSize; ++idx) 
    795761    { 
    796 //      if (searchClientSrc.search(itbIndex, iteIndex, itMap->second[idx], itIndex)) 
    797 //      { 
    798         localIndexToSendFromGridSource_[destRank](idx) = itMap->second[idx].first; //*itIndex; 
    799 //      } 
     762      localIndexToSendFromGridSource_[destRank](idx) = itMap->second[idx].first; 
    800763    } 
    801764  } 
Note: See TracChangeset for help on using the changeset viewer.