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];
87 label row = nControlPoints;
88 row < nControlPoints + 4;
92 for (label
col = 0;
col < nControlPoints;
col++)
94 beta[row - nControlPoints] += mat[row][
col] * ctrlField[
col];
102 forAll (dataPoints_, flPoint)
105 t = (mag(dataPoints_[flPoint] - focalPoint_) - innerRadius_) /
106 (outerRadius_ - innerRadius_);
111 result[flPoint] = 0 * result[flPoint];
116 scalarField weights =
117 RBF_->weights(controlPoints_, dataPoints_[flPoint]);
120 result[flPoint] += weights[
i] * alpha[
i];
127 +
beta[1] * dataPoints_[flPoint].x()
128 +
beta[2] * dataPoints_[flPoint].y()
129 +
beta[3] * dataPoints_[flPoint].z();
140 w = 1 - sqr(t) * (3 - 2 * t);
143 result[flPoint] = w * result[flPoint];