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"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
37namespace blockEdges
38{
41}
42}
43
44
45// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46
48(
49 const pointField& points,
50 const edge& fromTo,
51 const pointField& control
52)
53:
54 blockEdge(points, fromTo),
55 control_(control)
56{}
57
58
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
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 (
83 polyLine::concat(firstPoint(), pointField(is), lastPoint())
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
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:64
A List obtained as a section of another List.
Definition: SubList.H:70
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:64
Nth order bezier curve edge. Only interior control points should be specified. The outer points are t...
Definition: bezier.H:64
scalar length() const
Return the length of the curve.
Definition: bezier.C:109
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
A series of straight line segments, which can also be interpreted as a series of control points for s...
Definition: polyLine.H:56
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:121
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
const pointField & points
Namespace for OpenFOAM.
dictionary dict
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333