Changeset 831


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

Location:
XIOS/trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/client_server_mapping.hpp

    r829 r831  
    2626public: 
    2727  typedef boost::unordered_map<int, std::vector<size_t> > GlobalIndexMap; 
    28   typedef std::map<int, std::vector<int> > LocalIndexMap; 
    2928  public: 
    3029    /** Default constructor */ 
     
    3736    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) = 0; 
    3837 
    39 //    // Simple case, global index on client and index on servers 
    40 //    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
    41 //                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer); 
    42  
    4338    static std::map<int,int> computeConnectedClients(int nbServer, int nbClient, 
    4439                                                     MPI_Comm& clientIntraComm, 
     
    4641 
    4742    const GlobalIndexMap& getGlobalIndexOnServer() const; 
    48 //    const LocalIndexMap& getLocalIndexSendToServer() const; 
    49  
    50   protected: 
    51 //    void defaultComputeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
    52 //                                          const std::vector<CArray<size_t,1>* >& globalIndexOnServer, 
    53 //                                          const CArray<int,1>* localIndexOnClient = 0); 
    5443 
    5544  protected: 
    5645    //! Global index of data on SERVER, which are calculated by client(s) 
    5746    GlobalIndexMap indexGlobalOnServer_; 
    58  
    59     //! Index of the local data which will be sent to the corresponding server(s) 
    60 //    LocalIndexMap  localIndexSend2Server_; 
    6147 
    6248    //!< Number of clients connected to a server 
  • XIOS/trunk/src/distribution_client.cpp

    r821 r831  
    1818   , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 
    1919   , isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_() 
    20    , globalDataSendToServer_(), localDataIndexSendToServer_(), localDataIndex_(), localMaskIndex_() 
     20   , localDataIndex_(), localMaskIndex_()//, globalDataSendToServer_(), localDataIndexSendToServer_() 
     21   , globalLocalDataSendToServerMap_() 
    2122   , infoIndex_() 
    2223{ 
     
    3031   , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 
    3132   , isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_() 
    32    , globalDataSendToServer_(), localDataIndexSendToServer_(), localDataIndex_(), localMaskIndex_() 
     33   , localDataIndex_(), localMaskIndex_()//, globalDataSendToServer_(), localDataIndexSendToServer_() 
     34   , globalLocalDataSendToServerMap_() 
    3335   , infoIndex_() 
    3436{ 
     
    505507 
    506508  // Now allocate these arrays 
    507   globalDataSendToServer_.resize(indexSend2ServerCount); 
     509//  globalDataSendToServer_.resize(indexSend2ServerCount); 
     510//  localDataIndexSendToServer_.resize(indexSend2ServerCount); 
    508511  localDataIndex_.resize(indexLocalDataOnClientCount); 
    509   localDataIndexSendToServer_.resize(indexSend2ServerCount); 
     512 
    510513  localMaskIndex_.resize(indexSend2ServerCount); 
    511514 
     
    655658            } 
    656659          } 
    657           globalDataSendToServer_[indexSend2ServerCount] = globalIndex; 
    658           localDataIndexSendToServer_[indexSend2ServerCount] = indexLocalDataOnClientCount; 
     660//          globalDataSendToServer_[indexSend2ServerCount] = globalIndex; 
     661//          localDataIndexSendToServer_[indexSend2ServerCount] = indexLocalDataOnClientCount; 
     662          globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; 
    659663          localMaskIndex_[indexSend2ServerCount] = gridMaskIndex; 
    660664          ++indexSend2ServerCount; 
     
    710714} 
    711715 
    712 const std::vector<size_t>& CDistributionClient::getGlobalDataIndexSendToServer() const 
    713 { 
    714   return globalDataSendToServer_; 
     716/*! 
     717  Return global local data mapping of client 
     718*/ 
     719const CDistributionClient::GlobalLocalDataMap& CDistributionClient::getGlobalLocalDataSendToServer() const 
     720{ 
     721  return globalLocalDataSendToServerMap_; 
    715722} 
    716723 
     
    731738} 
    732739 
    733 /*! 
    734   Return local data index on client which are sent to servers 
    735 */ 
    736 const std::vector<int>& CDistributionClient::getLocalDataIndexSendToServer() const 
    737 { 
    738   return localDataIndexSendToServer_; 
    739 } 
    740  
    741740} // namespace xios 
  • XIOS/trunk/src/distribution_client.hpp

    r818 r831  
    1414#include "domain.hpp" 
    1515#include "grid.hpp" 
     16#include <boost/unordered_map.hpp> 
    1617 
    1718namespace xios { 
     
    2829class CDistributionClient : public CDistribution 
    2930{ 
     31public: 
     32  typedef boost::unordered_map<size_t,int> GlobalLocalDataMap; 
     33 
    3034  public: 
    3135    /** Default constructor */ 
     
    3741 
    3842    virtual const std::vector<int>& getLocalDataIndexOnClient() const; 
    39     virtual const std::vector<int>& getLocalDataIndexSendToServer() const; 
    40     const std::vector<size_t>& getGlobalDataIndexSendToServer() const; 
     43    const GlobalLocalDataMap& getGlobalLocalDataSendToServer() const; 
    4144    const std::vector<int>& getLocalMaskIndexOnClient() const; 
    4245 
     
    7275  private: 
    7376    //!< LocalData index on client 
    74     std::vector<size_t> globalDataSendToServer_; 
     77    GlobalLocalDataMap globalLocalDataSendToServerMap_; 
    7578    std::vector<int> localDataIndex_; 
    76     std::vector<int> localDataIndexSendToServer_; 
    7779    std::vector<int> localMaskIndex_; 
    7880 
     
    164166} 
    165167 
    166  
    167168} // namespace xios 
    168169#endif // __XIOS_DISTRIBUTIONCLIENT_HPP__ 
  • XIOS/trunk/src/node/grid.cpp

    r829 r831  
    459459     const CClientServerMapping::GlobalIndexMap& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer(); 
    460460 
    461      const std::vector<size_t>& globalIndexSendToServer = clientDistribution_->getGlobalDataIndexSendToServer(); 
     461     const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); 
     462     CDistributionClient::GlobalLocalDataMap::const_iterator iteGlobalLocalIndexMap = globalLocalIndexSendToServer.end(), itGlobalLocalIndexMap; 
    462463     CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; 
    463464     itGlobalMap  = itbGlobalMap = globalIndexOnServer.begin(); 
    464465     iteGlobalMap = globalIndexOnServer.end(); 
    465466 
    466      typedef XIOSBinarySearchWithIndex<size_t> BinarySearch; 
    467      std::vector<int>::iterator itVec; 
    468      int nbGlobalIndex = globalIndexSendToServer.size(); 
    469467     for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
    470468     { 
    471469       int serverRank = itGlobalMap->first; 
    472470       int indexSize = itGlobalMap->second.size(); 
    473        std::vector<int> permutIndex(indexSize); 
    474        XIOSAlgorithms::fillInIndex(indexSize, permutIndex); 
    475        XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(itGlobalMap->second, permutIndex); 
    476        BinarySearch binSearch(itGlobalMap->second); 
    477        for (int i = 0; i < nbGlobalIndex; ++i) 
     471       const std::vector<size_t>& indexVec = itGlobalMap->second; 
     472       for (int idx = 0; idx < indexSize; ++idx) 
    478473       { 
    479          if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexSendToServer[i], itVec)) 
    480          { 
    481            if (connectedDataSize_.end() == connectedDataSize_.find(serverRank)) 
    482              connectedDataSize_[serverRank] = 1; 
    483            else 
    484              ++connectedDataSize_[serverRank]; 
    485          } 
     474          itGlobalLocalIndexMap = globalLocalIndexSendToServer.find(indexVec[idx]); 
     475          if (iteGlobalLocalIndexMap != itGlobalLocalIndexMap) 
     476          { 
     477             if (connectedDataSize_.end() == connectedDataSize_.find(serverRank)) 
     478               connectedDataSize_[serverRank] = 1; 
     479             else 
     480               ++connectedDataSize_[serverRank]; 
     481          } 
    486482       } 
    487483     } 
     
    788784    list<CArray<size_t,1> > listOutIndex; 
    789785    const CClientServerMapping::GlobalIndexMap& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer(); 
    790     const std::vector<int>& localIndexSendToServer = clientDistribution_->getLocalDataIndexSendToServer(); 
    791     const std::vector<size_t>& globalIndexSendToServer = clientDistribution_->getGlobalDataIndexSendToServer(); 
     786    const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); 
     787    CDistributionClient::GlobalLocalDataMap::const_iterator itIndex = globalLocalIndexSendToServer.begin(), 
     788                                                           iteIndex = globalLocalIndexSendToServer.end(); 
    792789 
    793790    if (!doGridHaveDataDistributed()) 
     
    795792      if (0 == client->clientRank) 
    796793      { 
    797         CArray<size_t,1> outGlobalIndexOnServer(globalIndexSendToServer.size()); 
    798         for (int idx = 0; idx < globalIndexSendToServer.size();++idx) 
    799           outGlobalIndexOnServer(idx) = globalIndexSendToServer[idx]; 
    800  
    801         CArray<int,1> outLocalIndexToServer(localIndexSendToServer.size()); 
    802         for (int idx = 0; idx < localIndexSendToServer.size();++idx) 
    803           outLocalIndexToServer(idx) = localIndexSendToServer[idx]; 
     794        int indexSize = globalLocalIndexSendToServer.size(); 
     795        CArray<size_t,1> outGlobalIndexOnServer(indexSize); 
     796        CArray<int,1> outLocalIndexToServer(indexSize); 
     797        for (int idx = 0; itIndex != iteIndex; ++itIndex, ++idx) 
     798        { 
     799          outGlobalIndexOnServer(idx) = itIndex->first; 
     800          outLocalIndexToServer(idx) = itIndex->second; 
     801        } 
    804802 
    805803        for (rank = 0; rank < client->serverSize; ++rank) 
     
    821819    else 
    822820    { 
    823       CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; 
    824       itbGlobalMap = itGlobalMap = globalIndexOnServer.begin(); 
     821      CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap; 
     822      itGlobalMap = globalIndexOnServer.begin(); 
    825823      iteGlobalMap = globalIndexOnServer.end(); 
    826824 
    827       int nbGlobalIndex = globalIndexSendToServer.size(); 
    828825      std::map<int,std::vector<int> >localIndexTmp; 
    829826      std::map<int,std::vector<size_t> > globalIndexTmp; 
    830  
    831       typedef XIOSBinarySearchWithIndex<size_t> BinarySearch; 
    832       std::vector<int>::iterator itVec; 
    833827      for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
    834828      { 
    835829        int serverRank = itGlobalMap->first; 
    836830        int indexSize = itGlobalMap->second.size(); 
    837         std::vector<int> permutIndex(indexSize); 
    838         XIOSAlgorithms::fillInIndex(indexSize, permutIndex); 
    839         XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(itGlobalMap->second, permutIndex); 
    840         BinarySearch binSearch(itGlobalMap->second); 
    841  
    842         for (int i = 0; i < nbGlobalIndex; ++i) 
     831        const std::vector<size_t>& indexVec = itGlobalMap->second; 
     832        for (int idx = 0; idx < indexSize; ++idx) 
    843833        { 
    844           if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexSendToServer[i], itVec)) 
     834          itIndex = globalLocalIndexSendToServer.find(indexVec[idx]); 
     835          if (iteIndex != itIndex) 
    845836          { 
    846             globalIndexTmp[serverRank].push_back(globalIndexSendToServer[i]); 
    847             localIndexTmp[serverRank].push_back(localIndexSendToServer[i]); 
     837            globalIndexTmp[serverRank].push_back(itIndex->first); 
     838            localIndexTmp[serverRank].push_back(itIndex->second); 
    848839          } 
    849840        } 
  • XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp

    r827 r831  
    2828    this->idAuxInputs_[0] = coordinate_; 
    2929  } 
    30  
    31 //  computeIndexSourceMapping(); 
    3230} 
    3331 
     
    282280    this->transformationPosition_.resize(vecAxisValueSize); 
    283281 
    284     const std::vector<size_t>& globalIndexSendToServer = grid->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    285     const std::vector<int>& localDataSendToServer = grid->getDistributionClient()->getLocalDataIndexSendToServer(); 
    286     std::vector<int> permutIndex(globalIndexSendToServer.size()); 
    287     std::vector<int>::iterator itVec; 
    288     XIOSAlgorithms::fillInIndex(globalIndexSendToServer.size(), permutIndex); 
    289     XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(globalIndexSendToServer, permutIndex); 
     282    const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = grid->getDistributionClient()->getGlobalLocalDataSendToServer(); 
     283    CDistributionClient::GlobalLocalDataMap::const_iterator itIndex, iteIndex = globalLocalIndexSendToServer.end(); 
    290284    size_t axisSrcSize = axisSrc_->index.numElements(); 
    291285    std::vector<int> globalDimension = grid->getGlobalDimension(); 
    292     XIOSBinarySearchWithIndex<size_t> binSearch(globalIndexSendToServer); 
     286 
    293287    for (size_t idx = 0; idx < vecAxisValueSize; ++idx) 
    294288    { 
     
    297291      { 
    298292        size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1]; 
    299         if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndex, itVec)) 
     293        if (iteIndex != globalLocalIndexSendToServer.find(globalIndex)) 
    300294        { 
    301295          ++axisValueSize; 
     
    308302      { 
    309303        size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1]; 
    310         if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndex, itVec)) 
     304        itIndex = globalLocalIndexSendToServer.find(globalIndex); 
     305        if (iteIndex != itIndex) 
    311306        { 
    312           vecAxisValue[idx](axisValueSize) = (*dataAuxInputs[0])(localDataSendToServer[*itVec]); 
     307          vecAxisValue[idx](axisValueSize) = (*dataAuxInputs[0])(itIndex->second); 
    313308          ++axisValueSize; 
    314309        } 
  • XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp

    r829 r831  
    2222  \param[in] gridDestGlobalDim global size of each dimension of grid source (all dimension must have the same size except of the one on which transformation is performed) 
    2323  \param[in] gridSrcGlobalDim dimension size of source grid (it should share the same size for all dimension, maybe except the domain on which transformation is performed) 
    24   \param[in] globalIndexGridDestSendToServer global index of grid destination on the current client to send to server 
    25   \param[in] localIndexGridSendToServer local index of grid destination on the current client to send to server 
     24  \param[in] globalLocalIndexGridDestSendToServer global and local index mapping of grid destination on the current client to send to server 
    2625  \param[in/out] globaIndexWeightFromDestToSource mapping between transformed global index of grid destination 
    2726             and the weighted value as well as global index from grid index source 
    2827*/ 
    2928void CGenericAlgorithmTransformation::computeGlobalSourceIndex(int elementPositionInGrid, 
    30                                                              const std::vector<int>& gridDestGlobalDim, 
    31                                                              const std::vector<int>& gridSrcGlobalDim, 
    32                                                              const std::vector<size_t>& globalIndexGridDestSendToServer, 
    33                                                              const std::vector<int>& localIndexGridSendToServer, 
    34                                                              DestinationIndexMap& globaIndexWeightFromDestToSource) 
     29                                                               const std::vector<int>& gridDestGlobalDim, 
     30                                                               const std::vector<int>& gridSrcGlobalDim, 
     31                                                               const GlobalLocalMap& globalLocalIndexGridDestSendToServer, 
     32                                                               DestinationIndexMap& globaIndexWeightFromDestToSource) 
    3533{ 
    3634  bool isTransPosEmpty = transformationPosition_.empty(); 
    37   boost::unordered_map<size_t,int> globalLocalIndexDestSendToServerMap; 
    38   size_t nbGlobalIndexDest = globalIndexGridDestSendToServer.size(); 
    39   for (size_t idx = 0; idx < nbGlobalIndexDest; ++idx) 
    40   { 
    41     globalLocalIndexDestSendToServerMap[globalIndexGridDestSendToServer[idx]] = localIndexGridSendToServer[idx]; 
    42   } 
    43  
    4435  for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans) 
    4536  { 
     
    6152    for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight) 
    6253    { 
    63       boost::unordered_map<size_t,int> globalLocalIndexDestMap; 
    6454      if (!isTransPosEmpty) 
    6555      { 
     
    7060                                                           gridDestGlobalDim, 
    7161                                                           gridSrcGlobalDim, 
    72                                                            globalLocalIndexDestSendToServerMap, 
     62                                                           globalLocalIndexGridDestSendToServer, 
    7363                                                           globalLocalIndexDest, 
    7464                                                           globalIndexSrcGrid); 
     
    8373                                                           gridDestGlobalDim, 
    8474                                                           gridSrcGlobalDim, 
    85                                                            globalLocalIndexDestSendToServerMap, 
     75                                                           globalLocalIndexGridDestSendToServer, 
    8676                                                           globalLocalIndexDest, 
    8777                                                           globalIndexSrcGrid); 
  • XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp

    r829 r831  
    3636                                const std::vector<int>& gridDestGlobalDim, 
    3737                                const std::vector<int>& gridSrcGlobalDim, 
    38                                 const std::vector<size_t>& globalIndexGridDestSendToServer, 
    39                                 const std::vector<int>& localIndexGridSendToServer, 
     38                                const GlobalLocalMap& globalLocalIndexGridDestSendToServer, 
    4039                                DestinationIndexMap& globaIndexWeightFromDestToSource); 
    4140 
  • 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  } 
  • XIOS/trunk/src/transformation/transformation_mapping.cpp

    r829 r831  
    2727 
    2828  CDistributionClient distributionClientSrc(client->clientRank, gridSource_); 
    29  
    30   const std::vector<size_t>& globalIndexGridSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    31   const std::vector<int>& localIndexGridSrc = distributionClientSrc.getLocalDataIndexSendToServer(); 
     29  const CDistributionClient::GlobalLocalDataMap& globalLocalIndexGridSrc = distributionClientSrc.getGlobalLocalDataSendToServer(); 
     30  CDistributionClient::GlobalLocalDataMap::const_iterator itIndex = globalLocalIndexGridSrc.begin(), iteIndex = globalLocalIndexGridSrc.end(); 
    3231 
    3332  // Mapping of global index and pair containing rank and local index 
    3433  CClientClientDHTPairIntInt::Index2InfoTypeMap globalIndexOfServer; 
    35   int globalIndexSize = globalIndexGridSrc.size(); 
    36   PairIntInt pii; 
    37   for (int idx = 0; idx < globalIndexSize; ++idx) 
    38   { 
    39     pii.first  = clientRank; 
    40     pii.second = localIndexGridSrc[idx]; 
    41     globalIndexOfServer[globalIndexGridSrc[idx]] = pii; //std::make_pair(clientRank, localIndexGridSrc[idx]); 
     34  PairIntInt pairIntInt; 
     35  for (; itIndex != iteIndex; ++itIndex) 
     36  { 
     37    pairIntInt.first  = clientRank; 
     38    pairIntInt.second = itIndex->second; 
     39    globalIndexOfServer[itIndex->first] = pairIntInt; 
    4240  } 
    4341 
Note: See TracChangeset for help on using the changeset viewer.