- Timestamp:
- 07/11/16 17:36:08 (8 years ago)
- Location:
- XIOS/trunk/src/transformation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp
r867 r896 44 44 // Fill in axis value from coordinate 45 45 fillInAxisValue(vecAxisValue, dataAuxInputs); 46 std::vector<double> valueSrc(srcSize); 47 std::vector<double> recvBuff(srcSize); 48 std::vector<int> indexVec(srcSize); 46 49 47 50 for (int idx = 0; idx < vecAxisValue.size(); ++idx) 48 51 { 49 52 CArray<double,1>& axisValue = vecAxisValue[idx]; 50 std::vector<double> recvBuff(srcSize);51 std::vector<int> indexVec(srcSize);52 53 retrieveAllAxisValue(axisValue, axisMask, recvBuff, indexVec); 53 54 XIOSAlgorithms::sortWithIndex<double, CVectorStorage>(recvBuff, indexVec); 54 computeInterpolantPoint(recvBuff, indexVec, idx); 55 for (int i = 0; i < srcSize; ++i) valueSrc[i] = recvBuff[indexVec[i]]; 56 computeInterpolantPoint(valueSrc, idx); 55 57 } 56 58 } … … 60 62 Assume that we have all value of axis source, with these values, need to calculate weight (coeff) of Lagrange polynomial 61 63 \param [in] axisValue all value of axis source 62 \param [in] indexVec permutation index of axisValue63 */ 64 void CAxisAlgorithmInterpolate::computeInterpolantPoint(const std::vector<double>& axisValue, const std::vector<int>& indexVec,int transPos)64 \param [in] tranPos position of axis on a domain 65 */ 66 void CAxisAlgorithmInterpolate::computeInterpolantPoint(const std::vector<double>& axisValue, int transPos) 65 67 { 66 68 std::vector<double>::const_iterator itb = axisValue.begin(), ite = axisValue.end(); 67 69 std::vector<double>::const_iterator itLowerBound, itUpperBound, it; 68 std::vector<int>::const_iterator itbVec = indexVec.begin(), itVec;69 70 const double sfmax = NumTraits<double>::sfmax(); 70 71 … … 116 117 { 117 118 int index = std::distance(itb, it); 118 interpolatingIndexValues[idx+ibegin].push_back(make_pair(index Vec[index],*it));119 interpolatingIndexValues[idx+ibegin].push_back(make_pair(index,*it)); 119 120 } 120 121 } … … 186 187 indexVec[idx] = idx; 187 188 } 188 else recvBuff[idx] = NumTraits<double>::sfmax(); 189 else 190 { 191 recvBuff[idx] = NumTraits<double>::sfmax(); 192 indexVec[idx] = -1; 193 } 189 194 } 190 195 -
XIOS/trunk/src/transformation/axis_algorithm_interpolate.hpp
r827 r896 33 33 void retrieveAllAxisValue(const CArray<double,1>& axisValue, const CArray<bool,1>& axisMask, 34 34 std::vector<double>& recvBuff, std::vector<int>& indexVec); 35 void computeInterpolantPoint(const std::vector<double>& recvBuff, const std::vector<int>& indexVec,int transPos = 0);35 void computeInterpolantPoint(const std::vector<double>& recvBuff, int transPos = 0); 36 36 void computeWeightedValueAndMapping(const std::map<int, std::vector<std::pair<int,double> > >& interpolatingIndexValues, int transPos = 0); 37 37 void fillInAxisValue(std::vector<CArray<double,1> >& vecAxisValue, … … 46 46 47 47 } 48 48 49 #endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__
Note: See TracChangeset
for help on using the changeset viewer.