Changeset 937
- Timestamp:
- 09/22/16 10:59:04 (7 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/interpolate_axis.cpp
r836 r937 40 40 void CInterpolateAxis::checkValid(CAxis* axisSrc) 41 41 { 42 if (this->order.isEmpty()) this->order.setValue( 2);42 if (this->order.isEmpty()) this->order.setValue(1); 43 43 int order = this->order.getValue(); 44 44 if (order >= axisSrc->n_glo.getValue()) … … 46 46 ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", 47 47 << "Order of interpolation is greater than global size of axis source" 48 << "Size of axis source " <<axisSrc->getId() << " is " << axisSrc->n_glo.getValue() << std::endl 49 << "Order of interpolation is " << order ); 50 } 51 52 if (order < 1) 53 { 54 ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", 55 << "Order of interpolation is smaller than 1" 48 56 << "Size of axis source " <<axisSrc->getId() << " is " << axisSrc->n_glo.getValue() << std::endl 49 57 << "Order of interpolation is " << order ); -
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.