Loading...
Searching...
No Matches
bezier.C
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) 2015-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "bezier.H"
29#include "polyLine.H"
30#include "SubList.H"
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
37namespace blockEdges
38{
41}
42}
43
44
45// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46
47Foam::blockEdges::bezier::bezier
48(
49 const pointField& points,
50 const edge& fromTo,
51 const pointField& control
53:
54 blockEdge(points, fromTo),
55 control_(control)
56{}
57
58
59Foam::blockEdges::bezier::bezier
60(
61 const pointField& points,
62 const label from,
63 const label to,
64 const pointField& control
65)
66:
67 bezier(points, edge(from, to), control)
68{}
69
70
71Foam::blockEdges::bezier::bezier
72(
73 const dictionary& dict,
74 const label index,
75 const searchableSurfaces&,
76 const pointField& points,
77 Istream& is
78)
79:
80 blockEdge(dict, index, points, is),
81 control_
82 (
84 )
85{}
86
87
88// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89
91{
92 pointField working(control_);
93
94 label nWorking(working.size());
95
96 forAll(working, workingI)
97 {
98 --nWorking;
99
100 SubList<point>(working, nWorking) =
101 (1 - lambda)*SubList<point>(working, nWorking)
102 + lambda*SubList<point>(working, nWorking, 1);
103 }
104
105 return working[0];
106}
107
108
109Foam::scalar Foam::blockEdges::bezier::length() const
110{
112 return 1;
113}
114
115
116// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A non-owning sub-view of a List (allocated or unallocated storage).
Definition SubList.H:61
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition blockEdge.H:61
blockEdge(const pointField &points, const label from, const label to)
Construct from components.
Definition blockEdge.H:106
const point & lastPoint() const
The location of the last point.
Definition blockEdgeI.H:48
const point & firstPoint() const
The location of the first point.
Definition blockEdgeI.H:42
Nth order bezier curve edge. Only interior control points should be specified. The outer points are t...
Definition bezier.H:60
scalar length() const
Return the length of the curve.
Definition bezier.C:102
point position(const scalar lambda) const
Return the point position corresponding to the curve parameter.
Definition bezier.C:83
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Definition edge.H:62
A series of straight line segments, which can also be interpreted as a series of control points for s...
Definition polyLine.H:52
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
const pointField & points
A namespace for various blockEdge types.
Definition arcEdge.C:31
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition point.H:37
vectorField pointField
pointField is a vectorField.
dictionary dict
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299