Ignore:
Timestamp:
07/10/17 18:17:04 (7 years ago)
Author:
yushan
Message:

branch merged with trunk @1200

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_zoom.cpp

    r933 r1205  
    5353           << "Zoom size is " << zoomSize_ ); 
    5454  } 
     55 
     56  if (!zoomAxis->index.isEmpty()) 
     57  { 
     58    int sz = zoomAxis->index.numElements(); 
     59    zoomIndex_.resize(sz); 
     60    for (int i = 0; i < sz; ++i) 
     61      zoomIndex_[i] = zoomAxis->index(i); 
     62 
     63    std::sort(zoomIndex_.begin(), zoomIndex_.end()); 
     64  } 
    5565} 
    5666 
     
    6070void CAxisAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    6171{ 
     72  this->transformationMapping_.resize(1); 
     73  this->transformationWeight_.resize(1); 
     74 
     75  TransformationIndexMap& transMap = this->transformationMapping_[0]; 
     76  TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
     77 
    6278  StdSize niSource = axisSrc_->n.getValue(); 
    6379  StdSize ibeginSource = axisSrc_->begin.getValue(); 
     
    6985  if (iend < ibegin) ni = 0; 
    7086 
    71   this->transformationMapping_.resize(1); 
    72   this->transformationWeight_.resize(1); 
    73  
    74   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    75   TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
    76  
    77   for (StdSize idx = 0; idx < ni; ++idx) 
     87  if (!zoomIndex_.empty()) 
    7888  { 
    79     transMap[ibegin+idx].push_back(ibegin+idx); 
    80     transWeight[ibegin+idx].push_back(1.0); 
     89    std::vector<int>::iterator itZoomBegin, itZoomEnd; 
     90    itZoomBegin = std::lower_bound(zoomIndex_.begin(), zoomIndex_.end(), ibeginSource); 
     91    itZoomEnd   = std::upper_bound(zoomIndex_.begin(), zoomIndex_.end(), iendSource);             
     92    for (; itZoomBegin != itZoomEnd; ++itZoomBegin) 
     93    { 
     94      transMap[*itZoomBegin].push_back(*itZoomBegin); 
     95      transWeight[*itZoomBegin].push_back(1.0); 
     96    } 
     97  } 
     98  else 
     99  { 
     100    for (StdSize idx = 0; idx < ni; ++idx) 
     101    { 
     102      transMap[ibegin+idx].push_back(ibegin+idx); 
     103      transWeight[ibegin+idx].push_back(1.0); 
     104    } 
    81105  } 
    82106 
     
    92116  axisDest_->global_zoom_begin = zoomBegin_; 
    93117  axisDest_->global_zoom_n  = zoomSize_; 
     118  if (!zoomIndex_.empty()) 
     119  { 
     120    axisDest_->global_zoom_index.resize(zoomIndex_.size()); 
     121    std::copy(zoomIndex_.begin(), zoomIndex_.end(), axisDest_->global_zoom_index.begin()); 
     122  } 
    94123} 
    95124 
Note: See TracChangeset for help on using the changeset viewer.