Changeset 1298


Ignore:
Timestamp:
10/09/17 10:02:17 (4 years ago)
Author:
ymipsl
Message:

Bug fix for generic transformation. By default redondant source points are now correctly eliminated from transformation.

YM

Location:
XIOS/dev/XIOS_DEV_CMIP6/src/transformation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/transformation/generic_algorithm_transformation.cpp

    r1274 r1298  
    1919 : transformationMapping_(), transformationWeight_(), transformationPosition_(), 
    2020   idAuxInputs_(), type_(ELEMENT_NO_MODIFICATION_WITH_DATA), indexElementSrc_(), 
    21    computedProcSrcNonTransformedElement_(false) 
     21   computedProcSrcNonTransformedElement_(false), eliminateRedondantSrc_(true) 
    2222{ 
    2323} 
     
    199199  computeGlobalIndexOnProc = (0 < recvValue); 
    200200 
     201  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc; 
     202   
    201203  if (computeGlobalIndexOnProc || !computedProcSrcNonTransformedElement_) 
    202204  {     
     
    204206    if (globalElementIndexOnProc_.empty()) 
    205207      globalElementIndexOnProc_.resize(axisDomainDstOrder.numElements()); 
    206     CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc;   
     208     
    207209    for (idx = 0; idx < axisDomainDstOrder.numElements(); ++idx) 
    208210    { 
     
    318320        {           
    319321          tmpCounter.insert(srcIndex[idx]); 
     322 
     323           std::vector<int>& srcProc = globalIndexOfTransformedElementOnProc[srcIndex[idx]]; 
     324           for (int j = 0; j < srcProc.size(); ++j) 
     325              globalElementIndexOnProc_[elementPositionInGrid][srcProc[j]].push_back(srcIndex[idx]); 
     326/*           
    320327          for (int j = 0; j < procContainSrcElementIdx_.size(); ++j) 
    321             globalElementIndexOnProc_[elementPositionInGrid][procContainSrcElementIdx_[j]].push_back(srcIndex[idx]); 
     328            globalElementIndexOnProc_[elementPositionInGrid][procContainSrcElementIdx_[j]].push_back(srcIndex[idx]);*/ 
    322329        } 
    323330      } 
     
    513520  // eliminate redondant global src point owned by differrent processes. 
    514521  // 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 ; 
     522      int rankSrc ; 
     523      size_t globalSrcIndex ; 
     524      size_t globalDstIndex ; 
     525      double weight ; 
    520526  
    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 ; 
     527      SourceDestinationIndexMap::iterator rankIt,rankIte ; 
     528      boost::unordered_map<size_t, std::vector<std::pair<size_t,double> > >::iterator globalSrcIndexIt, globalSrcIndexIte ; 
     529      std::vector<std::pair<size_t,double> >::iterator vectIt,vectIte ; 
    524530    
    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)) ; 
     531      rankIt=globaIndexWeightFromSrcToDst_tmp.begin() ; rankIte=globaIndexWeightFromSrcToDst_tmp.end() ; 
     532      for(;rankIt!=rankIte;++rankIt) 
     533      { 
     534        rankSrc = rankIt->first ; 
     535        globalSrcIndexIt = rankIt->second.begin() ; globalSrcIndexIte = rankIt->second.end() ; 
     536        for(;globalSrcIndexIt!=globalSrcIndexIte;++globalSrcIndexIt) 
     537        {  
     538          globalSrcIndex = globalSrcIndexIt->first ; 
     539          vectIt = globalSrcIndexIt->second.begin() ; vectIte = globalSrcIndexIt->second.end() ; 
     540          for(vectIt; vectIt!=vectIte; vectIt++) 
     541          { 
     542            globalDstIndex = vectIt->first ; 
     543            weight = vectIt->second ; 
     544            if (eliminateRedondantSrc_) 
     545            { 
     546              if (rankMap[make_pair(globalSrcIndex,globalDstIndex)] == rankSrc)   
     547                globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstIndex,weight)) ; 
     548            } 
     549            else globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstIndex,weight)) ; 
     550         } 
    540551       } 
    541552     } 
    542    } 
    543  
    544553 
    545554} 
  • XIOS/dev/XIOS_DEV_CMIP6/src/transformation/generic_algorithm_transformation.hpp

    r1260 r1298  
    150150  std::map<int, int> elementPositionInGridSrc2AxisPosition_, elementPositionInGridSrc2DomainPosition_, elementPositionInGridSrc2ScalarPosition_; 
    151151  std::map<int, int> elementPositionInGridDst2AxisPosition_, elementPositionInGridDst2DomainPosition_, elementPositionInGridDst2ScalarPosition_; 
     152 
     153  bool eliminateRedondantSrc_ ; // flag to indicate if the transformation must select only one global source point for all proc. 
     154                               // In this case it will choose preferentially the current process  
    152155}; 
    153156 
Note: See TracChangeset for help on using the changeset viewer.