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];
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
NURBSbasis(const label nCPs, const label degree, const scalarField &knots)
Construct from number of control points, knot vector and basis order.
List< scalar > scalarList
A List of scalars.
NURBSbasis function. Used to construct NURBS curves, surfaces and volumes.
label insertKnot(const scalar uBar)
Adds the new knot's u value, increments the nCPs and returns 'k', the index of the newly inserted uVa...
const label & degree() const
#define DebugInfo
Report an information message using Foam::Info.
scalar basisDerivativeUU(const label iCP, const label degree, const scalar u) const
Basis second derivative w.r.t u.
scalar basisValue(const label iCP, const label degree, const scalar u) const
Basis value.
scalar basisDerivativeU(const label iCP, const label degree, const scalar u) const
Basis derivative w.r.t u.
defineTypeNameAndDebug(combustionModel, 0)
bool checkRange(const scalar u, const label CPI, const label degree) const
Checks to see if given u is affected by given CP.
static constexpr const zero Zero
Global zero (0)