- Timestamp:
- 08/12/16 19:57:50 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp
r913 r918 69 69 { 70 70 std::vector<double>::const_iterator itb = axisValue.begin(), ite = axisValue.end(); 71 std::vector<double>::const_iterator itLowerBound, itUpperBound, it ;71 std::vector<double>::const_iterator itLowerBound, itUpperBound, it, iteRange; 72 72 const double sfmax = NumTraits<double>::sfmax(); 73 73 … … 79 79 for (int idx = 0; idx < numValue; ++idx) 80 80 { 81 bool outOfRange = false; 81 82 double destValue = axisDestValue(idx); 83 if (destValue < *itb) outOfRange = true; 84 82 85 itLowerBound = std::lower_bound(itb, ite, destValue); 83 86 itUpperBound = std::upper_bound(itb, ite, destValue); 84 87 if ((ite != itUpperBound) && (sfmax == *itUpperBound)) itUpperBound = ite; 85 88 89 if ((ite == itLowerBound) || (ite == itUpperBound)) outOfRange = true; 86 90 // If the value is not in the range, that means we'll do extra-polation 87 if (ite == itLowerBound) // extra-polation 88 { 89 itLowerBound = itb; 90 itUpperBound = itb + order_+1; 91 } 92 else if (ite == itUpperBound) // extra-polation 93 { 94 itLowerBound = itUpperBound - order_-1; 95 } 96 else 97 { 98 if (itb != itLowerBound) --itLowerBound; 99 if (ite != itUpperBound) ++itUpperBound; 91 // if (ite == itLowerBound) // extra-polation 92 // { 93 // itLowerBound = itb; 94 // itUpperBound = itb + order_+1; 95 // } 96 // else if (ite == itUpperBound) // extra-polation 97 // { 98 // itLowerBound = itUpperBound - order_-1; 99 // } 100 //else 101 // We don't do extrapolation FOR NOW, maybe in the future 102 if (!outOfRange) 103 { 104 if ((itLowerBound == itUpperBound) && (itb != itLowerBound)) --itLowerBound; 100 105 int order = (order_ + 1) - 2; 101 106 bool down = true; … … 114 119 } 115 120 } 116 } 117 118 for (it = itLowerBound; it != itUpperBound; ++it) 119 { 120 int index = std::distance(itb, it); 121 interpolatingIndexValues[idx+ibegin].push_back(make_pair(indexVec[index],*it)); 121 122 123 iteRange = (ite == itUpperBound) ? itUpperBound : itUpperBound + 1; 124 for (it = itLowerBound; it != iteRange; ++it) 125 { 126 int index = std::distance(itb, it); 127 interpolatingIndexValues[idx+ibegin].push_back(make_pair(indexVec[index],*it)); 128 } 122 129 } 123 130 } … … 163 170 } 164 171 } 172 if (!transPosition_.empty() && this->transformationPosition_[transPos].empty()) 173 (this->transformationPosition_[transPos])[0] = transPosition_[transPos]; 174 165 175 } 166 176
Note: See TracChangeset
for help on using the changeset viewer.