- Timestamp:
- 09/25/17 10:55:12 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/transformation/generic_algorithm_transformation.cpp
r1260 r1274 353 353 \param [in] srcRank rank of client from which we demand global index of element source 354 354 \param [in] src2DstMap mapping of global index of element source and global index of element destination 355 \param [in] gridSrc Grid source356 \param [in] gridDst Grid destination357 \param [in] globalElementIndexOnProc Global index of element source on different client rank358 \param [out] globaIndexWeightFromSrcToDst Mapping of global index of grid source and grid destination355 \param [in] gridSrc Grid source 356 \param [in] gridDst Grid destination 357 \param [in] globalElementIndexOnProc Global index of element source on different client rank 358 \param [out] globaIndexWeightFromSrcToDst Mapping of global index of grid source and grid destination 359 359 */ 360 360 void CGenericAlgorithmTransformation::computeGlobalGridIndexMapping(int elementPositionInGrid, … … 366 366 SourceDestinationIndexMap& globaIndexWeightFromSrcToDst) 367 367 { 368 SourceDestinationIndexMap globaIndexWeightFromSrcToDst_tmp ; 369 370 CContext* context = CContext::getCurrent(); 371 CContextClient* client=context->client; 372 int clientRank = client->clientRank; 373 368 374 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains(); 369 375 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); … … 406 412 size_t globalDstSize = 1; 407 413 domainIndex = axisIndex = scalarIndex = 0; 414 set<size_t> globalSrcStoreIndex ; 415 408 416 for (int idx = 0; idx < nbElement; ++idx) 409 417 { … … 429 437 } 430 438 439 std::map< std::pair<size_t,size_t>, int > rankMap ; 440 std::map< std::pair<size_t,size_t>, int >:: iterator rankMapIt ; 441 431 442 for (int i = 0; i < srcRank.size(); ++i) 432 443 { … … 488 499 for (int k = 0; k < globalElementDstIndexSize; ++k) 489 500 { 490 globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstVecIndex[k],src2DstMap[currentIndexSrc[elementPositionInGrid]][k].second )); 501 502 globaIndexWeightFromSrcToDst_tmp[rankSrc][globalSrcIndex].push_back(make_pair(globalDstVecIndex[k],src2DstMap[currentIndexSrc[elementPositionInGrid]][k].second )); 503 rankMapIt=rankMap.find(make_pair(globalSrcIndex,globalDstVecIndex[k])) ; 504 if (rankMapIt==rankMap.end()) rankMap[make_pair(globalSrcIndex,globalDstVecIndex[k])] = rankSrc ; 505 else if (rankSrc==clientRank) rankMapIt->second = rankSrc ; 491 506 } 492 507 ++idxLoop[0]; … … 495 510 } 496 511 } 512 513 // eliminate redondant global src point owned by differrent processes. 514 // Avoid as possible to tranfer data from an other process if the src point is also owned by current process 515 516 int rankSrc ; 517 size_t globalSrcIndex ; 518 size_t globalDstIndex ; 519 double weight ; 520 521 SourceDestinationIndexMap::iterator rankIt,rankIte ; 522 boost::unordered_map<size_t, std::vector<std::pair<size_t,double> > >::iterator globalSrcIndexIt, globalSrcIndexIte ; 523 std::vector<std::pair<size_t,double> >::iterator vectIt,vectIte ; 524 525 rankIt=globaIndexWeightFromSrcToDst_tmp.begin() ; rankIte=globaIndexWeightFromSrcToDst_tmp.end() ; 526 for(;rankIt!=rankIte;++rankIt) 527 { 528 rankSrc = rankIt->first ; 529 globalSrcIndexIt = rankIt->second.begin() ; globalSrcIndexIte = rankIte->second.end() ; 530 for(;globalSrcIndexIt!=globalSrcIndexIte;++globalSrcIndexIt) 531 { 532 globalSrcIndex = globalSrcIndexIt->first ; 533 vectIt = globalSrcIndexIt->second.begin() ; vectIte = globalSrcIndexIt->second.end() ; 534 for(vectIt; vectIt!=vectIte; vectIt++) 535 { 536 globalDstIndex = vectIt->first ; 537 weight = vectIt->second ; 538 if (rankMap[make_pair(globalSrcIndex,globalDstIndex)] == rankSrc) 539 globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstIndex,weight)) ; 540 } 541 } 542 } 543 544 497 545 } 498 546
Note: See TracChangeset
for help on using the changeset viewer.