NURBSbasis.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2007-2019 PCOpt/NTUA
9 Copyright (C) 2013-2019 FOSS GP
10 Copyright (C) 2019 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28Class
29 Foam::NURBSbasis
30
31Description
32 NURBSbasis function. Used to construct NURBS curves, surfaces and volumes
33
34SourceFiles
35 NURBSbasis.C
36 NURBSbasisTemplates.C
37 NURBSbasisI.H
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef NURBSbasis_H
42#define NURBSbasis_H
43
44#include "dictionary.H"
45#include "scalarField.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class NURBSbasis Declaration
54\*---------------------------------------------------------------------------*/
56class NURBSbasis
57{
58 // Private data
59
60 //- Number of control points
61 label nCPs_;
62
63 //- Basis order
64 label basisDegree_;
65
66 //- Knot values
67 scalarField knots_;
68
69
70 // Private Member Functions
71
72 //- Compute knots
73 void computeKnots();
74
75
76public:
77
78 //- Runtime type information
79 TypeName("NURBbasis");
80
81 // Constructors
82
83 //- Construct from number of control points, knot vector and basis order
85 (
86 const label nCPs,
87 const label degree,
88 const scalarField& knots
89 );
90
91 //- Construct from number of control points and basis order
92 // Assumes uniform knot vector
94 (
95 const label nCPs,
96 const label degree
97 );
98
99 //- Construct from dictionary
100 // Assumes uniform knot vector
102 (
103 const dictionary& dict
104 );
105
106 //- Construct as copy
107 NURBSbasis(const NURBSbasis&);
108
109
110 //- Destructor
111 virtual ~NURBSbasis() = default;
112
113
114 // Member Functions
115
116 //- Basis value
117 scalar basisValue
118 (
119 const label iCP,
120 const label degree,
121 const scalar u
122 ) const;
123
124 //- Basis derivative w.r.t u
125 scalar basisDerivativeU
126 (
127 const label iCP,
128 const label degree,
129 const scalar u
130 ) const;
131
132 //- Basis second derivative w.r.t u
133 scalar basisDerivativeUU
134 (
135 const label iCP,
136 const label degree,
137 const scalar u
138 ) const;
139
140 //- Checks to see if given u is affected by given CP.
141 bool checkRange
142 (
143 const scalar u,
144 const label CPI,
145 const label degree
146 ) const;
147
148 //- Adds the new knot's u value, increments the nCPs and returns 'k',
149 //- the index of the newly inserted uValue.
150 // uBar should be pre-bounded between 0,1.
151 label insertKnot
152 (
153 const scalar uBar
154 );
155
156 inline const scalarField& knots() const;
157
158 inline const label& degree() const;
159
160 inline const label& nCPs() const;
161};
162
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166} // End namespace Foam
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170#include "NURBSbasisI.H"
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
175
176// ************************************************************************* //
NURBSbasis function. Used to construct NURBS curves, surfaces and volumes.
Definition: NURBSbasis.H:56
scalar basisDerivativeUU(const label iCP, const label degree, const scalar u) const
Basis second derivative w.r.t u.
Definition: NURBSbasis.C:231
scalar basisDerivativeU(const label iCP, const label degree, const scalar u) const
Basis derivative w.r.t u.
Definition: NURBSbasis.C:190
const label & nCPs() const
Definition: NURBSbasisI.H:46
const label & degree() const
Definition: NURBSbasisI.H:40
scalar basisValue(const label iCP, const label degree, const scalar u) const
Basis value.
Definition: NURBSbasis.C:140
TypeName("NURBbasis")
Runtime type information.
const scalarField & knots() const
Definition: NURBSbasisI.H:34
bool checkRange(const scalar u, const label CPI, const label degree) const
Checks to see if given u is affected by given CP.
Definition: NURBSbasis.C:273
virtual ~NURBSbasis()=default
Destructor.
label insertKnot(const scalar uBar)
Definition: NURBSbasis.C:298
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73