Changeset 1281


Ignore:
Timestamp:
09/26/17 14:13:40 (7 years ago)
Author:
ymipsl
Message:

Bug fix for zoom domain transformation. Zoom for domain defined by i_index and j_index was not correct.

YM

File:
1 edited

Legend:

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

    r1144 r1281  
    7474void CDomainAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    7575{ 
    76   int niSource = domainSrc_->ni.getValue(); 
    77   int ibeginSource = domainSrc_->ibegin.getValue(); 
    78   int iendSource = ibeginSource + niSource - 1; 
    79  
    80   int ibegin = std::max(ibeginSource, zoomIBegin_); 
    81   int iend = std::min(iendSource, zoomIEnd_); 
    82   int ni = iend + 1 - ibegin; 
    83   if (iend < ibegin) ni = 0; 
    84  
    85   int njSource = domainSrc_->nj.getValue(); 
    86   int jbeginSource = domainSrc_->jbegin.getValue(); 
    87   int jendSource = jbeginSource + njSource - 1; 
    88  
    89   int jbegin = std::max(jbeginSource, zoomJBegin_); 
    90   int jend = std::min(jendSource, zoomJEnd_); 
    91   int nj = jend + 1 - jbegin; 
    92   if (jend < jbegin) nj = 0; 
    9376 
    9477  int niGlob = domainSrc_->ni_glo.getValue(); 
     
    10285 
    10386  int domainGlobalIndex; 
    104   for (int j = 0; j < nj; ++j) 
     87  int iglob ; 
     88  int jglob ; 
     89  const CArray<int,1>& i_index = domainSrc_->i_index.getValue() ; 
     90  const CArray<int,1>& j_index = domainSrc_->j_index.getValue() ; 
     91 
     92  int nglo = i_index.numElements() ; 
     93  for (size_t i = 0; i < nglo ; ++i) 
    10594  { 
    106     for (int i = 0; i < ni; ++i) 
     95    iglob=i_index(i) ; jglob=j_index(i) ; 
     96    if (iglob>=zoomIBegin_ && iglob<=zoomIEnd_ && jglob>=zoomJBegin_ && jglob<=zoomJEnd_) 
    10797    { 
    108       domainGlobalIndex = (j+jbegin) * niGlob + (i+ibegin); 
     98      domainGlobalIndex = jglob*niGlob + iglob; 
    10999      transMap[domainGlobalIndex].push_back(domainGlobalIndex); 
    110100      transWeight[domainGlobalIndex].push_back(1.0); 
    111101    } 
    112102  } 
    113  
    114103  updateZoom(); 
    115   // updateDomainDestinationMask(); 
    116104} 
    117105 
Note: See TracChangeset for help on using the changeset viewer.