43 void NURBSbasis::computeKnots()
46 if (basisDegree_ >(nCPs_ - 1))
49 <<
"B - splines basis degree can be at most equal to the "
50 <<
"number of control points minus 1"
55 for (label ik = 0; ik < basisDegree_ + 1; ik++)
61 label firstCPIndex(basisDegree_ + 1);
62 label lastCPIndex(knots_.size() - basisDegree_ - 1);
63 label size(knots_.size() - 2*basisDegree_ - 2);
65 for (label ik = 0; ik < size; ik++)
67 knots_[ik + firstCPIndex] = scalar(ik + 1)/scalar(size + 1);
71 for (label ik = 0; ik < basisDegree_ + 1; ik++)
73 knots_[ik + lastCPIndex] = scalar(1);
77 <<
"Using knots " << knots_ <<
endl;
103 basisDegree_(degree),
104 knots_((nCPs_ + basisDegree_ + 1),
Zero)
115 nCPs_(
dict.
get<label>(
"nCPs")),
116 basisDegree_(
dict.
get<label>(
"basisDegree")),
117 knots_((nCPs_ + basisDegree_ + 1),
Zero)
129 basisDegree_(basis.basisDegree_),
133 <<
"Copied basis function" <<
endl;
153 if ((u >= knots_[iCP]) && (u < knots_[iCP + 1]))
157 else if ((u == 1) && (knots_[iCP + 1] == 1))
165 const scalar denom1(knots_[iCP +
degree] - knots_[iCP]);
166 const scalar denom2(knots_[iCP +
degree + 1] - knots_[iCP + 1]);
178 (knots_[iCP +
degree + 1] - u)
199 scalar derivative(0);
203 const scalar denom1(knots_[iCP +
degree] - knots_[iCP]);
204 const scalar denom2(knots_[iCP +
degree + 1] - knots_[iCP + 1]);
219 (knots_[iCP +
degree + 1] - u)
240 scalar derivative(0);
244 scalar denom1 = (knots_[iCP +
degree] - knots_[iCP]);
245 scalar denom2 = (knots_[iCP +
degree + 1] - knots_[iCP + 1]);
261 (knots_[iCP +
degree + 1] - u)
280 const scalar lowerBound(knots_[CPI]);
281 const scalar upperBound(knots_[CPI +
degree + 1]);
286 ((u == scalar(1)) && (lowerBound <= u) && (u <= upperBound))
287 || ((u != scalar(1)) && (lowerBound <= u) && (u < upperBound))
306 for (label kI = 0; kI < (knots_.size()-1); kI++)
308 if (knots_[kI + 1] > uBar)
317 kInsert = knots_.size()-1;
321 for (label kI = 0; kI<(kInsert + 1); kI++)
323 newKnots[kI] = knots_[kI];
326 newKnots[kInsert + 1] = uBar;
328 for (label kI= (kInsert + 2); kI < newKnots.size(); kI++)
330 newKnots[kI] = knots_[kI - 1];