Spline.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::Spline
26 
27 Description
28  Base class for splines
29 
30 SourceFiles
31  Spline.C
32  SplineI.H
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef Spline_H
37 #define Spline_H
38 
39 #include "pointField.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class Spline Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class Derived>
51 class Spline
52 {
53  // Private Data
54 
55  //- The end points and control points
56  const pointField knots_;
57 
58  //- Tolerance to which to improve the spacing
59  const scalar tol_;
60 
61  //- Number of iterations over which to improve the spacing
62  const label nIter_;
63 
64 
65 protected:
66 
67  // Protected Member Functions
68 
69  //- Access the end points and control points
70  inline const pointField& knots() const;
71 
72 
73 public:
74 
75  // Constructors
76 
77  //- Construct from components
78  Spline(const pointField& knots, const scalar tol, const label nIter);
79 
80  //- Construct from knots with default iteration settings
81  Spline(const pointField& knots);
82 
83  //- Disallow default bitwise copy construction
84  Spline(const Spline&) = delete;
85 
86 
87  // Member Functions
88 
89  //- Return the number of segments
90  inline label nSegments() const;
91 
92  //- Return the start point
93  inline const point& start() const;
94 
95  //- Return the end point
96  inline const point& end() const;
97 
98  //- Return the point position corresponding to the curve parameter
99  point position(const scalar lambda) const;
100 
101  //- Return the point positions corresponding to the curve parameters
102  tmp<pointField> position(const scalarList& lambdas) const;
103 
104 
105  // Member Operators
106 
107  //- Disallow default bitwise assignment
108  void operator=(const Spline&) = delete;
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #include "SplineI.H"
119 
120 #ifdef NoRepository
121  #include "Spline.C"
122 #endif
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************************************************************* //
Base class for splines.
Definition: Spline.H:51
label nSegments() const
Return the number of segments.
Definition: SplineI.H:40
const point & start() const
Return the start point.
Definition: SplineI.H:47
const pointField & knots() const
Access the end points and control points.
Definition: SplineI.H:31
point position(const scalar lambda) const
Return the point position corresponding to the curve parameter.
Definition: Spline.C:56
void operator=(const Spline &)=delete
Disallow default bitwise assignment.
const point & end() const
Return the end point.
Definition: SplineI.H:54
Spline(const pointField &knots, const scalar tol, const label nIter)
Construct from components.
Definition: Spline.C:32
A class for managing temporary objects.
Definition: tmp.H:55
dimensionedScalar lambda(viscosity->lookup("lambda"))
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59