40 const Field<Type>& ctrlField
46 if (ctrlField.size() != controlPoints_.size())
50 "tmp<Field<Type> > RBFInterpolation::interpolate\n"
52 " const Field<Type>& ctrlField\n"
54 ) <<
"Incorrect size of source field. Size = " << ctrlField.size()
55 <<
" nControlPoints = " << controlPoints_.size()
59 tmp<Field<Type >> tresult
61 new Field<Type>(dataPoints_.size(), pTraits<Type>::zero)
63 Field<Type>& result =
const_cast<Field<Type>&
>(tresult());
69 const label nControlPoints = controlPoints_.size();
70 const scalarSquareMatrix& mat = this->B();
72 Field<Type> alpha(nControlPoints, pTraits<Type>::zero);
73 Field<Type>
beta(4, pTraits<Type>::zero);
75 for (label row = 0; row < nControlPoints; row++)
77 for (label
col = 0;
col < nControlPoints;
col++)
79 alpha[row] += mat[row][
col] * ctrlField[
col];
86 label row = nControlPoints;
87 row < nControlPoints + 4;
91 for (label
col = 0;
col < nControlPoints;
col++)
93 beta[row - nControlPoints] += mat[row][
col] * ctrlField[
col];
100 forAll (dataPoints_, flPoint)
103 t = (mag(dataPoints_[flPoint] - focalPoint_) - innerRadius_) /
104 (outerRadius_ - innerRadius_);
109 result[flPoint] = 0 * result[flPoint];
114 scalarField weights =
115 RBF_->weights(controlPoints_, dataPoints_[flPoint]);
118 result[flPoint] += weights[
i] * alpha[
i];
125 +
beta[1] * dataPoints_[flPoint].x()
126 +
beta[2] * dataPoints_[flPoint].y()
127 +
beta[3] * dataPoints_[flPoint].z();
138 w = 1 - sqr(t) * (3 - 2 * t);
141 result[flPoint] = w * result[flPoint];