Changeset 831 for XIOS/trunk/src/transformation
- Timestamp:
- 03/23/16 16:11:09 (8 years ago)
- Location:
- XIOS/trunk/src/transformation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp
r827 r831 28 28 this->idAuxInputs_[0] = coordinate_; 29 29 } 30 31 // computeIndexSourceMapping();32 30 } 33 31 … … 282 280 this->transformationPosition_.resize(vecAxisValueSize); 283 281 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(); 290 284 size_t axisSrcSize = axisSrc_->index.numElements(); 291 285 std::vector<int> globalDimension = grid->getGlobalDimension(); 292 XIOSBinarySearchWithIndex<size_t> binSearch(globalIndexSendToServer); 286 293 287 for (size_t idx = 0; idx < vecAxisValueSize; ++idx) 294 288 { … … 297 291 { 298 292 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)) 300 294 { 301 295 ++axisValueSize; … … 308 302 { 309 303 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) 311 306 { 312 vecAxisValue[idx](axisValueSize) = (*dataAuxInputs[0])( localDataSendToServer[*itVec]);307 vecAxisValue[idx](axisValueSize) = (*dataAuxInputs[0])(itIndex->second); 313 308 ++axisValueSize; 314 309 } -
XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
r829 r831 22 22 \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) 23 23 \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 26 25 \param[in/out] globaIndexWeightFromDestToSource mapping between transformed global index of grid destination 27 26 and the weighted value as well as global index from grid index source 28 27 */ 29 28 void 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) 35 33 { 36 34 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 44 35 for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans) 45 36 { … … 61 52 for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight) 62 53 { 63 boost::unordered_map<size_t,int> globalLocalIndexDestMap;64 54 if (!isTransPosEmpty) 65 55 { … … 70 60 gridDestGlobalDim, 71 61 gridSrcGlobalDim, 72 globalLocalIndex DestSendToServerMap,62 globalLocalIndexGridDestSendToServer, 73 63 globalLocalIndexDest, 74 64 globalIndexSrcGrid); … … 83 73 gridDestGlobalDim, 84 74 gridSrcGlobalDim, 85 globalLocalIndex DestSendToServerMap,75 globalLocalIndexGridDestSendToServer, 86 76 globalLocalIndexDest, 87 77 globalIndexSrcGrid); -
XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
r829 r831 36 36 const std::vector<int>& gridDestGlobalDim, 37 37 const std::vector<int>& gridSrcGlobalDim, 38 const std::vector<size_t>& globalIndexGridDestSendToServer, 39 const std::vector<int>& localIndexGridSendToServer, 38 const GlobalLocalMap& globalLocalIndexGridDestSendToServer, 40 39 DestinationIndexMap& globaIndexWeightFromDestToSource); 41 40 -
XIOS/trunk/src/transformation/grid_transformation.cpp
r829 r831 392 392 // Recalculate the distribution of grid destination 393 393 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(); 396 395 397 396 // ComputeTransformation of global index of each element … … 402 401 gridDestinationDimensionSize, 403 402 gridSrcDimensionSize, 404 globalIndexGridDestSendToServer, 405 localIndexGridDestSendToServer, 403 globalLocalIndexGridDestSendToServer, 406 404 globaIndexWeightFromDestToSource); 407 405 … … 443 441 CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 444 442 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; 448 446 itbArr = globalIndexOnClientDest.begin(); 449 447 iteArr = globalIndexOnClientDest.end(); … … 454 452 for (itArr = itbArr; itArr != iteArr; ++itArr) 455 453 { 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]; 459 457 for (int idx = 0; idx < vecIndex.size(); ++idx) 460 458 { … … 472 470 for (itArr = itbArr; itArr != iteArr; ++itArr) 473 471 { 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]; 477 475 for (int idx = 0; idx < vecIndex.size(); ++idx) 478 476 { … … 731 729 732 730 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;743 731 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);754 732 itbMapRecv = globalIndexToReceive.begin(); 755 733 iteMapRecv = globalIndexToReceive.end(); … … 762 740 { 763 741 int vecSize = ((itMapRecv->second)[i]).size(); 764 // std::vector<std::pair<int,double> > tmpVec;765 742 for (int idx = 0; idx < vecSize; ++idx) 766 743 { 767 744 const std::pair<int, std::pair<size_t,double> >& tmpPair = (itMapRecv->second)[i][idx]; 768 745 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 // }775 746 } 776 // localIndexToReceiveOnGridDest_[sourceRank][i] = tmpVec;777 747 } 778 748 } 779 749 780 750 // Find out local index on grid source (to send) 751 const CTransformationMapping::SentIndexMap& globalIndexToSend = transformationMap.getGlobalIndexSendToGridDestMapping(); 781 752 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);787 753 itbMap = globalIndexToSend.begin(); 788 754 iteMap = globalIndexToSend.end(); … … 794 760 for (int idx = 0; idx < vecSize; ++idx) 795 761 { 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; 800 763 } 801 764 } -
XIOS/trunk/src/transformation/transformation_mapping.cpp
r829 r831 27 27 28 28 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(); 32 31 33 32 // Mapping of global index and pair containing rank and local index 34 33 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; 42 40 } 43 41
Note: See TracChangeset
for help on using the changeset viewer.