- Timestamp:
- 09/22/16 10:59:04 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp
r933 r937 97 97 { 98 98 std::vector<double>::const_iterator itb = axisValue.begin(), ite = axisValue.end(); 99 std::vector<double>::const_iterator itLowerBound, itUpperBound, it, iteRange ;99 std::vector<double>::const_iterator itLowerBound, itUpperBound, it, iteRange, itfirst, itsecond; 100 100 const double sfmax = NumTraits<double>::sfmax(); 101 const double precision = NumTraits<double>::dummy_precision(); 101 102 102 103 int ibegin = axisDest_->begin.getValue(); … … 116 117 117 118 if ((ite == itLowerBound) || (ite == itUpperBound)) outOfRange = true; 118 // If the value is not in the range, that means we'll do extra-polation 119 // if (ite == itLowerBound) // extra-polation 120 // { 121 // itLowerBound = itb; 122 // itUpperBound = itb + order_+1; 123 // } 124 // else if (ite == itUpperBound) // extra-polation 125 // { 126 // itLowerBound = itUpperBound - order_-1; 127 // } 128 //else 119 129 120 // We don't do extrapolation FOR NOW, maybe in the future 130 121 if (!outOfRange) 131 122 { 132 123 if ((itLowerBound == itUpperBound) && (itb != itLowerBound)) --itLowerBound; 124 double distanceToLower = destValue - *itLowerBound; 125 double distanceToUpper = *itUpperBound - destValue; 133 126 int order = (order_ + 1) - 2; 134 bool down = true;127 bool down = (distanceToLower < distanceToUpper) ? true : false; 135 128 for (int k = 0; k < order; ++k) 136 129 { … … 138 131 { 139 132 --itLowerBound; 140 down = false; 133 distanceToLower = destValue - *itLowerBound; 134 down = (distanceToLower < distanceToUpper) ? true : false; 141 135 continue; 142 136 } … … 144 138 { 145 139 ++itUpperBound; 146 down = true; 147 } 148 } 149 140 distanceToUpper = *itUpperBound - destValue; 141 down = (distanceToLower < distanceToUpper) ? true : false; 142 143 } 144 } 150 145 151 146 iteRange = (ite == itUpperBound) ? itUpperBound : itUpperBound + 1; 152 for (it = itLowerBound; it != iteRange; ++it) 153 { 147 itsecond = it = itLowerBound; ++itsecond; 148 while (it < iteRange) 149 { 150 while (((*itsecond -*it) < precision) && itsecond < ite) 151 { ++itsecond; ++it; } 154 152 int index = std::distance(itb, it); 155 153 interpolatingIndexValues[idx+ibegin].push_back(make_pair(indexVec[index],*it)); 156 } 154 ++it; ++itsecond; 155 } 156 157 157 } 158 158 }
Note: See TracChangeset
for help on using the changeset viewer.