NURBS3DCurve Class Reference

A NURBS 3D curve. More...

Inheritance diagram for NURBS3DCurve:
[legend]
Collaboration diagram for NURBS3DCurve:
[legend]

Public Member Functions

 NURBS3DCurve (const NURBSbasis &basis, const List< vector > &CPs, const List< scalar > &weights, const scalarField &u, const label nPts, const word name="NURBS3DCurve")
 
 NURBS3DCurve (const NURBSbasis &basis, const List< vector > &CPs, const List< scalar > &weights, const label nPts, const word name="NURBS3DCurve")
 Construct from control points, weights and basis order. More...
 
 NURBS3DCurve (const NURBSbasis &basis, const List< vector > &CPs, const label nPts, const word name="NURBS3DCurve")
 Construct from control points and basis order. More...
 
 NURBS3DCurve (const NURBS3DCurve &)
 Construct as copy. More...
 
 ~NURBS3DCurve ()=default
 Destructor. More...
 
void setNrm3DOrientation (const vector &givenNrm, const vector &givenTan)
 
void setNrm2DOrientation (const vector &givenNrm, const scalar zVal)
 
void flipNrmOrientation ()
 Flip the orientation of the nrm. More...
 
void setCPs (const List< vector > &CPs)
 Set CPs. More...
 
void setWeights (const List< scalar > &weights)
 Set weights. More...
 
void setName (const word &name)
 Set name. More...
 
void buildCurve ()
 Build curve. More...
 
void invert ()
 Invert CPs order and re-build curve. More...
 
void insertKnot (const scalarField &oldKnots, const scalar uBar, const label kInsert)
 Insert a knot by re-computing the control points. More...
 
void makeEquidistant (const label lenAcc=25, const label maxIter=10, const label spacingCorrInterval=-1, const scalar tolerance=1.e-5)
 Make curve points equidistant in cartesian space. More...
 
vector curvePoint (const scalar u) const
 Curve point cartesian coordinates at ui. More...
 
scalar findClosestCurvePoint (const vector &targetPoint, const label maxIter=1000, const scalar tolerance=1.e-13)
 
scalar findClosestCurvePoint (const vector &targetPoint, const scalar initGuess, const label maxIter=1000, const scalar tolerance=1.e-13)
 
const vector nrm3D (const vector &refTan, const scalar u) const
 Find the normal to the curve, with the option of forcing a z-plane. More...
 
const vector nrm2D (const scalar zVal, const scalar u) const
 
scalarList genEquidistant (const label nPts=100, const label lenAcc=25, const label maxIter=10, const label spacingCorrInterval=-1, const scalar tolerance=1.e-5)
 
bool checkRange (const scalar u, const label CPI, const label degree) const
 Check if given parametric coordinate u and CP are linked. More...
 
bool checkRange (const scalar u, const label CPI) const
 
scalar length (const label uIStart, const label uIEnd) const
 
scalar length (const scalar uStart, const scalar uEnd, const label nPts) const
 
scalar length () const
 Calculate length for the entire curve length. More...
 
vector curveDerivativeU (const scalar u) const
 Curve derivative wrt u at point ui. More...
 
vector curveDerivativeUU (const scalar u) const
 Curve second derivative wrt u at point ui. More...
 
scalar curveDerivativeCP (const scalar u, const label CPI)
 
vector curveDerivativeWeight (const scalar u, const label CPI)
 Curve derivative wrt CPII at point u. More...
 
scalar lengthDerivativeU (const scalar uStart, const scalar uEnd, const label nPts)
 
const NURBSbasisgetBasisFunction () const
 Get basis function. More...
 
const List< vector > & getCPs () const
 Get CPs. More...
 
const List< scalar > & getWeights () const
 Get weights. More...
 
const List< scalar > & getParametricCoordinates () const
 Get parametric coordinates. More...
 
const wordgetName () const
 Get name. More...
 
label nrmOrientation () const
 Return the nrm sgn relation to the u=0 nrm. More...
 
const vectorgivenInitNrm () const
 Return the initial normal given to compare to the Curve's normals. More...
 
void write ()
 Write curve to file. More...
 
void write (const word fileName)
 
void write (const fileName dirName, const fileName fileName)
 
void writeWParses ()
 
void writeWParses (const word fileName)
 
void writeWParses (const fileName dirName, const fileName fileName)
 
- Public Member Functions inherited from Field< vector >
constexpr Field () noexcept
 Default construct. More...
 
 Field (const label len)
 Construct given size. More...
 
 Field (const label len, const vector &val)
 Construct given size and initial value. More...
 
 Field (const label len, const Foam::zero)
 Construct given size and initial values of zero. More...
 
 Field (const Foam::one, const vector &val)
 Construct with length=1, copying the value as the only content. More...
 
 Field (const Foam::one, vector &&val)
 Construct with length=1, moving the value as the only content. More...
 
 Field (const Foam::one, const Foam::zero)
 Construct with length=1, initializing content to zero. More...
 
 Field (const Field< vector > &fld)
 Copy construct. More...
 
 Field (const UList< vector > &list)
 Copy construct from UList<Type> More...
 
 Field (const IndirectListBase< vector, Addr > &list)
 Copy construct from IndirectList. More...
 
 Field (Field< vector > &&fld)
 Move construct from Field. More...
 
 Field (List< vector > &&list)
 Move construct from List. More...
 
 Field (DynamicList< vector, SizeMin > &&list)
 Move construct from DynamicList. More...
 
 Field (const UList< vector > &mapF, const labelUList &mapAddressing)
 Construct by 1 to 1 mapping from the given field. More...
 
 Field (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing)
 Construct by 1 to 1 mapping from the given tmp field. More...
 
 Field (const UList< vector > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given field. More...
 
 Field (const tmp< Field< vector >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given tmp field. More...
 
 Field (const UList< vector > &mapF, const FieldMapper &map, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const UList< vector > &mapF, const FieldMapper &map, const vector &defaultValue, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const UList< vector > &mapF, const FieldMapper &map, const UList< vector > &defaultValues, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const bool applyFlip=true)
 Construct by mapping from the given tmp field. More...
 
 Field (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const vector &defaultValue, const bool applyFlip=true)
 
 Field (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const UList< vector > &defaultValues, const bool applyFlip=true)
 
 Field (Field< vector > &fld, bool reuse)
 Copy construct or re-use as specified. More...
 
 Field (const tmp< Field< vector >> &tfld)
 Copy or move construct from tmp. More...
 
 Field (Istream &is)
 Construct from Istream. More...
 
 Field (const word &keyword, const dictionary &dict, const label len)
 Construct from a dictionary entry. More...
 
tmp< Field< vector > > clone () const
 Clone. More...
 
void map (const UList< vector > &mapF, const labelUList &mapAddressing)
 1 to 1 map from the given field More...
 
void map (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing)
 1 to 1 map from the given tmp field More...
 
void map (const UList< vector > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Interpolative map from the given field. More...
 
void map (const tmp< Field< vector >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights)
 Interpolative map from the given tmp field. More...
 
void map (const UList< vector > &mapF, const FieldMapper &map, const bool applyFlip=true)
 Map from the given field. More...
 
void map (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const bool applyFlip=true)
 Map from the given tmp field. More...
 
void autoMap (const FieldMapper &map, const bool applyFlip=true)
 Map from self. More...
 
void rmap (const UList< vector > &mapF, const labelUList &mapAddressing)
 1 to 1 reverse-map from the given field More...
 
void rmap (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing)
 1 to 1 reverse-map from the given tmp field More...
 
void rmap (const UList< vector > &mapF, const labelUList &mapAddressing, const UList< scalar > &weights)
 Interpolative reverse map from the given field. More...
 
void rmap (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing, const UList< scalar > &weights)
 Interpolative reverse map from the given tmp field. More...
 
void negate ()
 Negate this field (negative). More...
 
tmp< Field< cmptType > > component (const direction) const
 Return a component field of the field. More...
 
void replace (const direction, const UList< cmptType > &)
 Replace a component field of the field. More...
 
void replace (const direction, const tmp< Field< cmptType >> &)
 Replace a component field of the field. More...
 
void replace (const direction, const cmptType &)
 Replace a component field of the field. More...
 
VSForm block (const label start) const
 
tmp< Field< vector > > T () const
 Return the field transpose (only defined for second rank tensors) More...
 
void writeEntry (const word &keyword, Ostream &os) const
 Write the field as a dictionary entry. More...
 
SubField< vectorslice (const label pos, label len=-1)
 Return SubField slice (non-const access) - no range checking. More...
 
const SubField< vectorslice (const label pos, label len=-1) const
 Return SubField slice (const access) - no range checking. More...
 
SubField< vectorslice (const labelRange &range)
 Return SubField slice (non-const access) - with range checking. More...
 
const SubField< vectorslice (const labelRange &range) const
 Return SubField slice (const access) - with range checking. More...
 
void operator= (const Field< vector > &)
 Copy assignment. More...
 
void operator= (const tmp< Field< vector >> &)
 
void operator= (const UList< vector > &rhs)
 
void operator= (const SubField< vector > &rhs)
 
void operator= (const IndirectListBase< vector, Addr > &rhs)
 Copy assign from IndirectList. More...
 
void operator= (Field< vector > &&rhs)
 Move assignment. More...
 
void operator= (List< vector > &&rhs)
 
void operator= (DynamicList< vector, SizeMin > &&rhs)
 
void operator= (const vector &val)
 Value assignment. More...
 
void operator= (const Foam::zero)
 
void operator= (const VectorSpace< Form, Cmpt, nCmpt > &)
 
void operator= (const tmp< Field > &rhs)
 
void operator+= (const UList< vector > &)
 
void operator+= (const tmp< Field< vector >> &)
 
void operator+= (const vector &)
 
void operator-= (const UList< vector > &)
 
void operator-= (const tmp< Field< vector >> &)
 
void operator-= (const vector &)
 
void operator*= (const UList< scalar > &)
 
void operator*= (const tmp< Field< scalar >> &)
 
void operator*= (const scalar &)
 
void operator/= (const UList< scalar > &)
 
void operator/= (const tmp< Field< scalar >> &)
 
void operator/= (const scalar &)
 

Additional Inherited Members

- Public Types inherited from Field< vector >
typedef pTraits< vector >::cmptType cmptType
 Component type. More...
 
typedef SubField< vectorsubField
 Declare type of subField. More...
 
- Static Public Member Functions inherited from Field< vector >
static const Field< vector > & null ()
 Return nullObject reference Field. More...
 
static autoPtr< Field< vector > > New (Istream &is)
 Return a pointer to a new Field created on freestore. More...
 
static tmp< Field< vector > > NewCalculatedType (const Field< Type2 > &f)
 

Detailed Description

A NURBS 3D curve.

Source files

Definition at line 55 of file NURBS3DCurve.H.

Constructor & Destructor Documentation

◆ NURBS3DCurve() [1/4]

NURBS3DCurve ( const NURBSbasis basis,
const List< vector > &  CPs,
const List< scalar > &  weights,
const scalarField u,
const label  nPts,
const word  name = "NURBS3DCurve" 
)

Construct from control points, weights and basis order and parametric coordinates

Definition at line 210 of file NURBS3DCurve.C.

◆ NURBS3DCurve() [2/4]

NURBS3DCurve ( const NURBSbasis basis,
const List< vector > &  CPs,
const List< scalar > &  weights,
const label  nPts,
const word  name = "NURBS3DCurve" 
)

Construct from control points, weights and basis order.

Uniform coordinate distribution is implied

Definition at line 236 of file NURBS3DCurve.C.

◆ NURBS3DCurve() [3/4]

NURBS3DCurve ( const NURBSbasis basis,
const List< vector > &  CPs,
const label  nPts,
const word  name = "NURBS3DCurve" 
)

Construct from control points and basis order.

Uniform coordinate distribution and unit weights are implied

Definition at line 262 of file NURBS3DCurve.C.

◆ NURBS3DCurve() [4/4]

NURBS3DCurve ( const NURBS3DCurve )

Construct as copy.

◆ ~NURBS3DCurve()

~NURBS3DCurve ( )
default

Destructor.

Member Function Documentation

◆ setNrm3DOrientation()

void setNrm3DOrientation ( const vector givenNrm,
const vector givenTan 
)

Take a given normal and use to determine if NURBS normals should be reversed. Computation taken from u = 0.

Definition at line 291 of file NURBS3DCurve.C.

References Foam::endl(), Foam::Info, Foam::tan(), and Foam::Zero.

Here is the call graph for this function:

◆ setNrm2DOrientation()

void setNrm2DOrientation ( const vector givenNrm,
const scalar  zVal 
)

Definition at line 317 of file NURBS3DCurve.C.

References Foam::endl(), Foam::Info, Foam::tan(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), Vector< Cmpt >::z(), and Foam::Zero.

Here is the call graph for this function:

◆ flipNrmOrientation()

void flipNrmOrientation ( )

Flip the orientation of the nrm.

Definition at line 346 of file NURBS3DCurve.C.

◆ setCPs()

void setCPs ( const List< vector > &  CPs)

Set CPs.

Definition at line 359 of file NURBS3DCurve.C.

◆ setWeights()

void setWeights ( const List< scalar > &  weights)

Set weights.

Definition at line 365 of file NURBS3DCurve.C.

◆ setName()

void setName ( const word name)

Set name.

Definition at line 371 of file NURBS3DCurve.C.

References Foam::name().

Here is the call graph for this function:

◆ buildCurve()

void buildCurve ( )

Build curve.

Definition at line 377 of file NURBS3DCurve.C.

References NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, VectorSpace< Vector< scalar >, scalar, 3 >::zero, and Foam::Zero.

Referenced by NURBS3DCurve::invert().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invert()

void invert ( )

Invert CPs order and re-build curve.

Definition at line 408 of file NURBS3DCurve.C.

References NURBS3DCurve::buildCurve(), Foam::endl(), Foam::Info, and Foam::Zero.

Here is the call graph for this function:

◆ insertKnot()

void insertKnot ( const scalarField oldKnots,
const scalar  uBar,
const label  kInsert 
)

Insert a knot by re-computing the control points.

The basis' insertKnot function must have beem called first to correctly provide the required info.

Definition at line 646 of file NURBS3DCurve.C.

References Foam::Zero.

◆ makeEquidistant()

void makeEquidistant ( const label  lenAcc = 25,
const label  maxIter = 10,
const label  spacingCorrInterval = -1,
const scalar  tolerance = 1.e-5 
)

Make curve points equidistant in cartesian space.

Definition at line 430 of file NURBS3DCurve.C.

◆ curvePoint()

vector curvePoint ( const scalar  u) const

Curve point cartesian coordinates at ui.

Definition at line 457 of file NURBS3DCurve.C.

References NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, and Foam::Zero.

Here is the call graph for this function:

◆ findClosestCurvePoint() [1/2]

scalar findClosestCurvePoint ( const vector targetPoint,
const label  maxIter = 1000,
const scalar  tolerance = 1.e-13 
)

Find curve point which is closest to given point using Newton-Raphson. Returns the param coordinate.

Definition at line 484 of file NURBS3DCurve.C.

References Foam::bound(), Foam::endl(), forAll, Foam::mag(), and WarningInFunction.

Here is the call graph for this function:

◆ findClosestCurvePoint() [2/2]

scalar findClosestCurvePoint ( const vector targetPoint,
const scalar  initGuess,
const label  maxIter = 1000,
const scalar  tolerance = 1.e-13 
)

Find curve point which is closest to given point using Newton-Raphson. Returns the param coordinate.

Definition at line 554 of file NURBS3DCurve.C.

References Foam::bound(), Foam::endl(), Foam::mag(), and WarningInFunction.

Here is the call graph for this function:

◆ nrm3D()

const vector nrm3D ( const vector refTan,
const scalar  u 
) const

Find the normal to the curve, with the option of forcing a z-plane.

Definition at line 612 of file NURBS3DCurve.C.

References NURBS3DCurve::curveDerivativeU(), Vector< Cmpt >::normalise(), and Foam::Zero.

Here is the call graph for this function:

◆ nrm2D()

const vector nrm2D ( const scalar  zVal,
const scalar  u 
) const

Definition at line 631 of file NURBS3DCurve.C.

References NURBS3DCurve::curveDerivativeU(), Foam::mag(), Foam::tan(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), Vector< Cmpt >::z(), and Foam::Zero.

Here is the call graph for this function:

◆ genEquidistant()

scalarList genEquidistant ( const label  nPts = 100,
const label  lenAcc = 25,
const label  maxIter = 10,
const label  spacingCorrInterval = -1,
const scalar  tolerance = 1.e-5 
)

Generate points on the curve which are evenly spaced in cartesian coordinate distances.

Definition at line 688 of file NURBS3DCurve.C.

References U, and Foam::Zero.

◆ checkRange() [1/2]

bool checkRange ( const scalar  u,
const label  CPI,
const label  degree 
) const

Check if given parametric coordinate u and CP are linked.

Definition at line 719 of file NURBS3DCurve.C.

◆ checkRange() [2/2]

bool checkRange ( const scalar  u,
const label  CPI 
) const

Definition at line 729 of file NURBS3DCurve.C.

References NURBSbasis::checkRange(), and NURBSbasis::degree().

Here is the call graph for this function:

◆ length() [1/3]

scalar length ( const label  uIStart,
const label  uIEnd 
) const

Calculate Length from starting to ending indices via computational evaluation using trapezoid rule.

Definition at line 736 of file NURBS3DCurve.C.

References NURBS3DCurve::curveDerivativeU(), forAll, NURBS3DCurve::length(), Foam::mag(), and Foam::Zero.

Here is the call graph for this function:

◆ length() [2/3]

scalar length ( const scalar  uStart,
const scalar  uEnd,
const label  nPts 
) const

Calculate length from starting to ending parametric coordinates via computational evaluation using trapezoid rule.

Definition at line 762 of file NURBS3DCurve.C.

References forAll, Foam::mag(), and Foam::Zero.

Here is the call graph for this function:

◆ length() [3/3]

scalar length ( ) const

Calculate length for the entire curve length.

Definition at line 792 of file NURBS3DCurve.C.

Referenced by NURBS3DCurve::length().

Here is the caller graph for this function:

◆ curveDerivativeU()

vector curveDerivativeU ( const scalar  u) const

Curve derivative wrt u at point ui.

Definition at line 800 of file NURBS3DCurve.C.

References NURBSbasis::basisDerivativeU(), NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, and Foam::Zero.

Referenced by NURBS3DCurve::length(), NURBS3DCurve::nrm2D(), and NURBS3DCurve::nrm3D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ curveDerivativeUU()

vector curveDerivativeUU ( const scalar  u) const

Curve second derivative wrt u at point ui.

Definition at line 825 of file NURBS3DCurve.C.

References NURBSbasis::basisDerivativeU(), NURBSbasis::basisDerivativeUU(), NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, and Foam::Zero.

Here is the call graph for this function:

◆ curveDerivativeCP()

scalar curveDerivativeCP ( const scalar  u,
const label  CPI 
)

Curve derivative wrt b at point ui: scalar since dx/dX = dy/dY = dz/dZ.

Definition at line 864 of file NURBS3DCurve.C.

References forAll, and Foam::Zero.

◆ curveDerivativeWeight()

vector curveDerivativeWeight ( const scalar  u,
const label  CPI 
)

Curve derivative wrt CPII at point u.

Definition at line 886 of file NURBS3DCurve.C.

References forAll, and Foam::Zero.

◆ lengthDerivativeU()

scalar lengthDerivativeU ( const scalar  uStart,
const scalar  uEnd,
const label  nPts 
)

Calculate length from starting to ending indices via computational evaluation using trapezoid rule

Definition at line 912 of file NURBS3DCurve.C.

References forAll, Foam::mag(), and Foam::Zero.

Here is the call graph for this function:

◆ getBasisFunction()

const NURBSbasis& getBasisFunction ( ) const
inline

Get basis function.

Definition at line 325 of file NURBS3DCurve.H.

◆ getCPs()

const List<vector>& getCPs ( ) const
inline

Get CPs.

Definition at line 331 of file NURBS3DCurve.H.

◆ getWeights()

const List<scalar>& getWeights ( ) const
inline

Get weights.

Definition at line 337 of file NURBS3DCurve.H.

◆ getParametricCoordinates()

const List<scalar>& getParametricCoordinates ( ) const
inline

Get parametric coordinates.

Definition at line 343 of file NURBS3DCurve.H.

◆ getName()

const word& getName ( ) const
inline

Get name.

Definition at line 349 of file NURBS3DCurve.H.

◆ nrmOrientation()

label nrmOrientation ( ) const
inline

Return the nrm sgn relation to the u=0 nrm.

Definition at line 355 of file NURBS3DCurve.H.

◆ givenInitNrm()

const vector& givenInitNrm ( ) const
inline

Return the initial normal given to compare to the Curve's normals.

Definition at line 361 of file NURBS3DCurve.H.

◆ write() [1/3]

void write ( )

Write curve to file.

Definition at line 954 of file NURBS3DCurve.C.

◆ write() [2/3]

void write ( const word  fileName)

Definition at line 961 of file NURBS3DCurve.C.

References Foam::endl(), field(), forAll, and UPstream::master().

Here is the call graph for this function:

◆ write() [3/3]

void write ( const fileName  dirName,
const fileName  fileName 
)

Definition at line 1010 of file NURBS3DCurve.C.

References Foam::endl(), field(), forAll, and UPstream::master().

Here is the call graph for this function:

◆ writeWParses() [1/3]

void writeWParses ( )

Definition at line 1059 of file NURBS3DCurve.C.

◆ writeWParses() [2/3]

void writeWParses ( const word  fileName)

Definition at line 1066 of file NURBS3DCurve.C.

References Foam::endl(), field(), forAll, and UPstream::master().

Here is the call graph for this function:

◆ writeWParses() [3/3]

void writeWParses ( const fileName  dirName,
const fileName  fileName 
)

Definition at line 1117 of file NURBS3DCurve.C.

References Foam::endl(), field(), forAll, and UPstream::master().

Here is the call graph for this function:

The documentation for this class was generated from the following files: