- Timestamp:
- 11/24/20 11:33:59 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/axis_algorithm_interpolate.cpp
r1852 r1980 50 50 51 51 CAxisAlgorithmInterpolate::CAxisAlgorithmInterpolate(CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis) 52 : CAxisAlgorithmTransformation(axisDestination, axisSource), coordinate_(), transPosition_()52 : CAxisAlgorithmTransformation(axisDestination, axisSource), coordinate_(), coordinateDST_(),transPosition_() 53 53 TRY 54 54 { 55 55 interpAxis->checkValid(axisSource); 56 56 order_ = interpAxis->order.getValue(); 57 this->idAuxInputs_.clear(); 57 58 if (!interpAxis->coordinate.isEmpty()) 58 59 { … … 61 62 this->idAuxInputs_[0] = coordinate_; 62 63 } 64 else if (!interpAxis->coordinate_src.isEmpty()) 65 { 66 coordinate_ = interpAxis->coordinate_src.getValue(); 67 this->idAuxInputs_.resize(1); 68 this->idAuxInputs_[0] = coordinate_; 69 } 70 if (!interpAxis->coordinate_dst.isEmpty()) 71 { 72 coordinateDST_ = interpAxis->coordinate_dst.getValue(); 73 this->idAuxInputs_.resize(this->idAuxInputs_.size()+1); 74 this->idAuxInputs_[this->idAuxInputs_.size()-1] = coordinateDST_; 75 } 76 77 63 78 } 64 79 CATCH … … 71 86 { 72 87 CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").resume() ; 73 CContext* context = CContext::getCurrent(); 74 CContextClient* client=context->client; 75 int nbClient = client->clientSize; 88 76 89 CArray<bool,1>& axisMask = axisSrc_->mask; 77 90 int srcSize = axisSrc_->n_glo.getValue(); … … 90 103 XIOSAlgorithms::sortWithIndex<double, CVectorStorage>(recvBuff, indexVec); 91 104 for (int i = 0; i < srcSize; ++i) valueSrc[i] = recvBuff[indexVec[i]]; 92 computeInterpolantPoint(valueSrc, indexVec, idx);105 computeInterpolantPoint(valueSrc, indexVec, dataAuxInputs, idx); 93 106 } 94 107 CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").suspend() ; … … 97 110 98 111 /*! 99 Compute the interpolant points 112 Compute the interpolant points 100 113 Assume that we have all value of axis source, with these values, need to calculate weight (coeff) of Lagrange polynomial 101 114 \param [in] axisValue all value of axis source 115 \param [in] dataAuxInputs data for setting values of axis destination 102 116 \param [in] tranPos position of axis on a domain 103 117 */ 104 118 void CAxisAlgorithmInterpolate::computeInterpolantPoint(const std::vector<double>& axisValue, 105 119 const std::vector<int>& indexVec, 120 const std::vector<CArray<double,1>* >& dataAuxInputs, 106 121 int transPos) 107 122 TRY … … 115 130 CArray<double,1>& axisDestValue = axisDest_->value; 116 131 int numValue = axisDestValue.numElements(); 132 if(!coordinateDST_.empty()) 133 { 134 int nDomPoint = (*dataAuxInputs[0]).numElements()/numValue ; 135 int dst_position_in_data = dataAuxInputs.size()-1; 136 for(int ii=0; ii<numValue; ii++) 137 { 138 axisDestValue(ii) = (*dataAuxInputs[dst_position_in_data])(ii*nDomPoint+transPos); 139 } 140 } 141 117 142 std::map<int, std::vector<std::pair<int,double> > > interpolatingIndexValues; 118 143 … … 172 197 CATCH 173 198 199 200 174 201 /*! 175 202 Compute weight (coeff) of Lagrange's polynomial … … 233 260 int numValue = axisValue.numElements(); 234 261 262 235 263 if (srcSize == numValue) // Only one client or axis not distributed 236 264 { … … 248 276 } 249 277 } 250 251 278 } 252 279 else // Axis distributed … … 304 331 TRY 305 332 { 306 if (coordinate_.empty()) 333 bool has_src = !coordinate_.empty(); 334 bool has_dst = !coordinateDST_.empty(); 335 336 int nb_inputs=dataAuxInputs.size(); 337 338 339 if (!has_src) 307 340 { 308 341 vecAxisValue.resize(1); … … 312 345 this->transformationWeight_.resize(1); 313 346 } 314 else 347 else 315 348 { 316 349 CField* field = CField::get(coordinate_);
Note: See TracChangeset
for help on using the changeset viewer.