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

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

YM

Location:
XIOS/dev/XIOS_DEV_CMIP6/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/config/reduce_domain_to_scalar_attribute.conf

    r976 r1313  
    11DECLARE_ENUM4(operation, min, max, sum, average) 
     2DECLARE_ATTRIBUTE(bool, local) 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/reduce_domain_to_scalar.cpp

    r976 r1313  
    3939  void CReduceDomainToScalar::checkValid(CScalar* scalarDst, CDomain* domainSrc) 
    4040  { 
     41    if (this->local.isEmpty()) local=false ; 
    4142  } 
    4243 
  • 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 
  • XIOS/dev/XIOS_DEV_CMIP6/src/transformation/scalar_algorithm_reduce_domain.hpp

    r1260 r1313  
    4141  static bool registerTrans(); 
    4242protected: 
     43  bool local ; 
    4344  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
    4445 
Note: See TracChangeset for help on using the changeset viewer.