BSplineEdge.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) 2014-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2021 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 \*---------------------------------------------------------------------------*/
28 
29 #include "BSplineEdge.H"
30 #include "polyLine.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace blockEdges
38 {
39  defineTypeNameAndDebug(BSplineEdge, 0);
40 
42  (
43  blockEdge,
44  BSplineEdge,
45  Istream
46  );
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
53 Foam::blockEdges::BSplineEdge::BSplineEdge
54 (
55  const pointField& points,
56  const edge& fromTo,
57  const pointField& internalPoints
58 )
59 :
60  blockEdge(points, fromTo),
61  BSpline
62  (
63  polyLine::concat(firstPoint(), internalPoints, lastPoint())
64  )
65 {}
66 
67 
68 Foam::blockEdges::BSplineEdge::BSplineEdge
69 (
70  const pointField& points,
71  const label from,
72  const label to,
73  const pointField& internalPoints
74 )
75 :
76  BSplineEdge(points, edge(from,to), internalPoints)
77 {}
78 
79 
80 Foam::blockEdges::BSplineEdge::BSplineEdge
81 (
82  const dictionary& dict,
83  const label index,
84  const searchableSurfaces&,
85  const pointField& points,
86  Istream& is
87 )
88 :
89  blockEdge(dict, index, points, is),
90  BSpline
91  (
92  polyLine::concat(firstPoint(), pointField(is), lastPoint())
93  )
94 {
95  token tok(is);
96  is.putBack(tok);
97 
98  // Discard unused start/end tangents
99  if (tok == token::BEGIN_LIST)
100  {
101  vector tangent0Ignored(is);
102  vector tangent1Ignored(is);
103  }
104 }
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110 {
111  return BSpline::position(mu);
112 }
113 
114 
115 Foam::scalar Foam::blockEdges::BSplineEdge::length() const
116 {
117  return BSpline::length();
118 }
119 
120 
121 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A blockEdge interface for B-splines.
Definition: BSplineEdge.H:50
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A token holds an item read from Istream.
Definition: token.H:65
Begin list [isseparator].
Definition: token.H:161
Macros for easy insertion into run-time selection tables.
void putBack(const token &tok)
Put back a token (copy). Only a single put back is permitted.
Definition: Istream.C:71
const pointField & points
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:59
Container for searchableSurfaces. The collection is specified as a dictionary. For example...
An implementation of B-splines.
Definition: BSpline.H:72
A series of straight line segments, which can also be interpreted as a series of control points for s...
Definition: polyLine.H:51
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual point position(const scalar) const
The point position corresponding to the curve parameter.
Definition: BSplineEdge.C:102
virtual scalar length() const
The length of the spline curve.
Definition: BSplineEdge.C:108
defineTypeNameAndDebug(arcEdge, 0)
addToRunTimeSelectionTable(blockEdge, arcEdge, Istream)
const dimensionedScalar mu
Atomic mass unit.
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:60
point position(const scalar lambda) const
The point position corresponding to the global curve parameter.
Definition: BSpline.C:38
Namespace for OpenFOAM.
scalar length() const
The length of the curve.
Definition: BSpline.C:127