Changeset 1169 for XIOS/trunk/src/transformation
- Timestamp:
- 06/15/17 16:17:01 (7 years ago)
- Location:
- XIOS/trunk/src/transformation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp
r933 r1169 44 44 zoomBegin_ = zoomAxis->begin.getValue(); 45 45 zoomSize_ = zoomAxis->n.getValue(); 46 zoomEnd_ = zoomBegin_ + zoomSize_ - 1; 46 zoomEnd_ = zoomBegin_ + zoomSize_ - 1; 47 47 48 48 if (zoomSize_ > axisSource->n_glo.getValue()) … … 53 53 << "Zoom size is " << zoomSize_ ); 54 54 } 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 } 55 65 } 56 66 … … 60 70 void CAxisAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 61 71 { 72 this->transformationMapping_.resize(1); 73 this->transformationWeight_.resize(1); 74 75 TransformationIndexMap& transMap = this->transformationMapping_[0]; 76 TransformationWeightMap& transWeight = this->transformationWeight_[0]; 77 62 78 StdSize niSource = axisSrc_->n.getValue(); 63 79 StdSize ibeginSource = axisSrc_->begin.getValue(); … … 69 85 if (iend < ibegin) ni = 0; 70 86 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()) 78 88 { 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 } 81 105 } 82 106 … … 92 116 axisDest_->global_zoom_begin = zoomBegin_; 93 117 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 } 94 123 } 95 124 -
XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp
r933 r1169 48 48 StdSize zoomSize_; 49 49 50 std::vector<int> zoomIndex_; 51 50 52 private: 51 53
Note: See TracChangeset
for help on using the changeset viewer.