Ignore:
Timestamp:
08/12/16 19:57:50 (8 years ago)
Author:
mhnguyen
Message:

Modifying vertical interpolation

+) Only process interpolation, the extrapolation will be ignored (value will be unidentified (masked))
+) Make sure even unidenfitified from one transformation can be known in the next transformation

Test
+) On Curie
+) Vertical interpolation: Correct
+) Vertical interpolation + horizontal interpolation: Correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp

    r913 r918  
    6969{ 
    7070  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; 
    7272  const double sfmax = NumTraits<double>::sfmax(); 
    7373 
     
    7979  for (int idx = 0; idx < numValue; ++idx) 
    8080  { 
     81    bool outOfRange = false; 
    8182    double destValue = axisDestValue(idx); 
     83    if (destValue < *itb) outOfRange = true; 
     84 
    8285    itLowerBound = std::lower_bound(itb, ite, destValue); 
    8386    itUpperBound = std::upper_bound(itb, ite, destValue); 
    8487    if ((ite != itUpperBound) && (sfmax == *itUpperBound)) itUpperBound = ite; 
    8588 
     89    if ((ite == itLowerBound) || (ite == itUpperBound)) outOfRange = true; 
    8690    // 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; 
    100105      int order = (order_ + 1) - 2; 
    101106      bool down = true; 
     
    114119        } 
    115120      } 
    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      } 
    122129    } 
    123130  } 
     
    163170    } 
    164171  } 
     172  if (!transPosition_.empty() && this->transformationPosition_[transPos].empty()) 
     173    (this->transformationPosition_[transPos])[0] = transPosition_[transPos]; 
     174 
    165175} 
    166176 
Note: See TracChangeset for help on using the changeset viewer.