Ignore:
Timestamp:
10/24/17 11:23:54 (3 years ago)
Author:
ymipsl
Message:

Add "local" attribute to reduce_domain_to_scalar transformation. The reduction is only apply on local domain.

YM

File:
1 edited

Legend:

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

    r1260 r1313  
    7676 
    7777  reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]); 
     78  local = algo->local ; 
    7879} 
    7980 
     
    105106  TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
    106107 
    107   int globalIndexSize = domainSrc_->ni_glo * domainSrc_->nj_glo;   
     108  int ni_glo = domainSrc_->ni_glo ; 
     109  int nj_glo = domainSrc_->nj_glo ; 
     110  int nbDomainIdx ; 
     111   
     112  if (local) 
     113  { 
     114      const CArray<int, 1>& i_index = domainSrc_-> i_index.getValue() ; 
     115      const CArray<int, 1>& j_index = domainSrc_-> j_index.getValue() ; 
     116      const CArray<bool,1>& localMask = domainSrc_-> localMask ; 
     117      int nbDomainIdx = i_index.numElements(); 
    108118 
    109   transMap[0].resize(globalIndexSize); 
    110   transWeight[0].resize(globalIndexSize, 1.0); 
    111   for (int idx = 0; idx < globalIndexSize; ++idx) 
    112   {      
    113     transMap[0][idx] = idx;     
     119      for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain) 
     120      { 
     121        if (localMask(idxDomain)) 
     122        {  
     123          transMap[0].push_back(j_index(idxDomain)* ni_glo + i_index(idxDomain)); 
     124          transWeight[0].push_back(1.0) ; 
     125        } 
     126      } 
    114127  } 
     128  else 
     129  {   
     130    nbDomainIdx = ni_glo * nj_glo; 
     131    transMap[0].resize(nbDomainIdx); 
     132    transWeight[0].resize(nbDomainIdx, 1.0); 
     133    for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain) transMap[0][idxDomain] = idxDomain;     
     134  } 
     135   
    115136} 
    116137 
Note: See TracChangeset for help on using the changeset viewer.