OpenFOAM: API Guide
v2112
The open source CFD toolbox
BSpline.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) 2011-2016 OpenFOAM Foundation
9
Copyright (C) 2020 OpenCFD Ltd.
10
-------------------------------------------------------------------------------
11
License
12
This file is part of OpenFOAM.
13
14
OpenFOAM is free software: you can redistribute it and/or modify it
15
under the terms of the GNU General Public License as published by
16
the Free Software Foundation, either version 3 of the License, or
17
(at your option) any later version.
18
19
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22
for more details.
23
24
You should have received a copy of the GNU General Public License
25
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27
Class
28
Foam::BSpline
29
30
Description
31
An implementation of B-splines.
32
33
In this implementation, the end tangents are created automatically
34
by reflection.
35
36
In matrix form, the \e local interpolation on the interval t=[0..1] is
37
described as follows:
38
\verbatim
39
P(t) = 1/6 * [ t^3 t^2 t 1 ] * [ -1 3 -3 1 ] * [ P-1 ]
40
[ 3 -6 3 0 ] [ P0 ]
41
[ -3 0 3 0 ] [ P1 ]
42
[ 1 4 1 0 ] [ P2 ]
43
\endverbatim
44
45
Where P-1 and P2 represent the neighbouring points or the extrapolated
46
end points. Simple reflection is used to automatically create the end
47
points.
48
49
The spline is discretized based on the chord length of the individual
50
segments. In rare cases (sections with very high curvatures), the
51
resulting distribution may be sub-optimal.
52
53
A future implementation could also handle closed splines.
54
55
See also
56
CatmullRomSpline
57
58
SourceFiles
59
BSpline.C
60
61
\*---------------------------------------------------------------------------*/
62
63
#ifndef BSpline_H
64
#define BSpline_H
65
66
#include "
polyLine.H
"
67
68
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69
70
namespace
Foam
71
{
72
73
/*---------------------------------------------------------------------------*\
74
Class BSpline Declaration
75
\*---------------------------------------------------------------------------*/
76
77
class
BSpline
78
:
79
public
polyLine
80
{
81
public
:
82
83
// Constructors
84
85
//- Construct from components
86
explicit
BSpline
87
(
88
const
pointField
& knots,
89
const
bool
notImplementedClosed =
false
90
);
91
92
93
// Member Functions
94
95
//- The point position corresponding to the global curve parameter
96
// 0 <= lambda <= 1
97
point
position
(
const
scalar
lambda
)
const
;
98
99
//- The point position corresponding to the local lambda (0-1)
100
//- on the given segment
101
point
position
(
const
label
segment
,
const
scalar
lambda
)
const
;
102
103
//- The length of the curve
104
// \note NotImplemented
105
scalar
length
()
const
;
106
};
107
108
109
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110
111
}
// End namespace Foam
112
113
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114
115
#endif
116
117
// ************************************************************************* //
Foam::polyLine
A series of straight line segments, which can also be interpreted as a series of control points for s...
Definition:
polyLine.H:55
polyLine.H
Foam::BSpline::position
point position(const scalar lambda) const
The point position corresponding to the global curve parameter.
Definition:
BSpline.C:45
Foam::BSpline
An implementation of B-splines.
Definition:
BSpline.H:76
Foam::Field< vector >
Foam::BSpline::length
scalar length() const
The length of the curve.
Definition:
BSpline.C:134
lambda
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:33
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition:
Pair.H:54
Foam::Vector< scalar >
Foam::BSpline::BSpline
BSpline(const pointField &knots, const bool notImplementedClosed=false)
Construct from components.
Definition:
BSpline.C:34
src
mesh
blockMesh
blockEdges
BSplineEdge
BSpline.H
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.