Changeset 1400


Ignore:
Timestamp:
01/11/18 17:15:58 (4 years ago)
Author:
ymipsl
Message:

2 bug fix for spatial transformation

  • Dynamic spatial transformation distributed :: missing information saved in the class for next time step
  • Non distributed transformation : solve local mask grid problem for intermediate grid
  • take into account some transformation that are always considered as distributed

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

    r1399 r1400  
    120120  if (!isDistributedComputed_) 
    121121  { 
    122     CContext* context = CContext::getCurrent(); 
    123     CContextClient* client = context->client; 
    124    
    125     computePositionElements(gridSrc, gridDst); 
    126     std::vector<CScalar*> scalarListSrcP  = gridSrc->getScalars(); 
    127     std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); 
    128     std::vector<CDomain*> domainListSrcP = gridSrc->getDomains(); 
    129     int distributed, distributed_glo ; 
    130    
    131     CArray<int,1> axisDomainSrcOrder = gridSrc->axis_domain_order; 
    132     if (2 == axisDomainSrcOrder(elementPositionInGrid)) // It's domain 
    133     { 
    134       distributed=domainListSrcP[elementPositionInGridSrc2DomainPosition_[elementPositionInGrid]]->isDistributed() ; 
    135       MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; 
     122    isDistributedComputed_=true ; 
     123    if (!eliminateRedondantSrc_) isDistributed_=true ; 
     124    else 
     125    { 
     126      CContext* context = CContext::getCurrent(); 
     127      CContextClient* client = context->client; 
     128   
     129      computePositionElements(gridSrc, gridDst); 
     130      std::vector<CScalar*> scalarListSrcP  = gridSrc->getScalars(); 
     131      std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); 
     132      std::vector<CDomain*> domainListSrcP = gridSrc->getDomains(); 
     133      int distributed, distributed_glo ; 
     134   
     135      CArray<int,1> axisDomainSrcOrder = gridSrc->axis_domain_order; 
     136      if (2 == axisDomainSrcOrder(elementPositionInGrid)) // It's domain 
     137      { 
     138        distributed=domainListSrcP[elementPositionInGridSrc2DomainPosition_[elementPositionInGrid]]->isDistributed() ; 
     139        MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; 
    136140     
    137     } 
    138     else if (1 == axisDomainSrcOrder(elementPositionInGrid))//it's an axis 
    139     { 
    140       distributed=axisListSrcP[elementPositionInGridSrc2AxisPosition_[elementPositionInGrid]]->isDistributed() ; 
    141       MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; 
    142     } 
    143     else //it's a scalar 
    144     { 
    145       distributed_glo=false ; 
    146     }  
    147     isDistributed_=distributed_glo ; 
    148     isDistributedComputed_=true ; 
     141      } 
     142      else if (1 == axisDomainSrcOrder(elementPositionInGrid))//it's an axis 
     143      { 
     144        distributed=axisListSrcP[elementPositionInGridSrc2AxisPosition_[elementPositionInGrid]]->isDistributed() ; 
     145        MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; 
     146      } 
     147      else //it's a scalar 
     148      { 
     149        distributed_glo=false ; 
     150      }  
     151      isDistributed_=distributed_glo ; 
     152    } 
    149153  } 
    150154  return isDistributed_ ; 
     
    235239  computeGlobalIndexOnProc = (0 < recvValue); 
    236240 
    237   CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc; 
     241//  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc; 
    238242 
    239243  if (computeGlobalIndexOnProc || !computedProcSrcNonTransformedElement_) 
    240244  {     
     245    { 
     246      CClientClientDHTInt::Index2VectorInfoTypeMap tmp ; 
     247      globalIndexOfTransformedElementOnProc_.swap(tmp) ; 
     248    } 
    241249    // Find out global index source of transformed element on corresponding process.     
    242250    if (globalElementIndexOnProc_.empty()) 
     
    245253    for (idx = 0; idx < axisDomainDstOrder.numElements(); ++idx) 
    246254    { 
     255       
    247256      if (idx == elementPositionInGrid) 
    248         computeExchangeGlobalIndex(indexSrc, axisDomainSrcOrder(idx), globalIndexOfTransformedElementOnProc); //globalElementIndexOnProc[idx]); 
     257        computeExchangeGlobalIndex(indexSrc, axisDomainSrcOrder(idx), globalIndexOfTransformedElementOnProc_); //globalElementIndexOnProc[idx]); 
    249258      if (!computedProcSrcNonTransformedElement_) 
    250259      { 
     
    340349          set<int> tmpSet ;  
    341350          procList.swap(tmpSet) ; 
    342           CClientClientDHTInt::Index2VectorInfoTypeMap::iterator itIdxb = globalIndexOfTransformedElementOnProc.begin(), 
    343                                                                  itIdxe = globalIndexOfTransformedElementOnProc.end(), itIdx; 
     351          CClientClientDHTInt::Index2VectorInfoTypeMap::iterator itIdxb = globalIndexOfTransformedElementOnProc_.begin(), 
     352                                                                 itIdxe = globalIndexOfTransformedElementOnProc_.end(), itIdx; 
    344353          for (itIdx = itIdxb; itIdx != itIdxe; ++itIdx) 
    345354          { 
     
    406415          tmpCounter.insert(srcIndex[idx]); 
    407416        
    408           vector<int>& rankSrc = globalIndexOfTransformedElementOnProc[srcIndex[idx]] ; 
     417          vector<int>& rankSrc = globalIndexOfTransformedElementOnProc_[srcIndex[idx]] ; 
    409418          for (int n=0;n<rankSrc.size();++n) 
    410419          { 
     
    856865  vector<int> nIndexSrc(nElement) ; 
    857866  vector<int> nIndexDst(nElement) ; 
     867  int nlocalIndexSrc=1 ; 
    858868  int nlocalIndexDest=1 ; 
    859869   
     
    875885      nIndexSrc[i]=1 ; 
    876886    } 
     887    nlocalIndexSrc=nlocalIndexSrc*nIndexSrc[i] ; 
    877888  } 
    878889 
     
    934945// just get the local src mask 
    935946  CArray<bool,1> localMaskOnSrcGrid; 
    936   gridSrc->getLocalMask(localMaskOnSrcGrid) ;  
     947  gridSrc->getLocalMask(localMaskOnSrcGrid) ; 
     948// intermediate grid, mask is not initialized => set up mask to true 
     949  if (localMaskOnSrcGrid.isEmpty()) localMaskOnSrcGrid.resize(nlocalIndexSrc) ; 
     950  localMaskOnSrcGrid=true ; 
    937951   
    938952 
  • XIOS/dev/XIOS_DEV_CMIP6/src/transformation/generic_algorithm_transformation.hpp

    r1399 r1400  
    158158  std::vector< set<int> > procElementList_ ; // List of processes containing source index of elements 
    159159 
    160  
     160  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc_; 
     161   
    161162  bool computedProcSrcNonTransformedElement_; // Flag to indicate whether we computed proc containing non transformed elements 
    162163 
Note: See TracChangeset for help on using the changeset viewer.