arcEdge.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) 2017-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::blockEdges::arcEdge
29
30Description
31 A blockEdge defined as an arc of a circle.
32
33 The arc is normally defined by its endpoints and a point on
34 its circumference, typically a midpoint. For example,
35 \verbatim
36 points ((1 0 0) (0 1 0));
37
38 arc 0 1 (0.707107 0.707107 0);
39 \endverbatim
40 The arc can enclose an angle greater than 0 and less than 360 degrees.
41
42 The arc will frequently enclose an angle less than 180 degrees.
43 For the case, it is possible to define the arc by its endpoints and its
44 centre (origin) point. For example,
45 \verbatim
46 arc 0 1 origin (0 0 0);
47 \endverbatim
48 When defined in the way, any discrepancy in the arc radius for the
49 endpoints is resolved by adjusting the origin to ensure that the average
50 radius is satisfied.
51
52 It is also possible to define a \em flatness factor as a multiplier of
53 the calculated radius. For example,
54 \verbatim
55 arc 0 1 origin 1.1 (0 0 0);
56 \endverbatim
57
58SourceFiles
59 arcEdge.C
60
61\*---------------------------------------------------------------------------*/
62
63#ifndef blockEdges_arcEdge_H
64#define blockEdges_arcEdge_H
65
66#include "blockEdge.H"
67#include "cylindricalCS.H"
68
69// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70
71namespace Foam
72{
73namespace blockEdges
74{
75
76/*---------------------------------------------------------------------------*\
77 Class arcEdge Declaration
78\*---------------------------------------------------------------------------*/
80class arcEdge
81:
82 public blockEdge
83{
84 // Private Data
85
86 //- The arc radius
87 scalar radius_;
88
89 //- The arc angle (radians)
90 scalar angle_;
91
92 //- The local cylindrical coordinate system
94
95
96 // Private Member Functions
97
98 //- Calculate angle, radius, cylindrical coordinate system
99 //- from end points and the given point on the circumference
100 void calcFromMidPoint
101 (
102 const point& p1,
103 const point& p3,
104 const point& p2
105 );
106
107 //- Calculate angle, radius, cylindrical coordinate system
108 //- from end points and the given origin.
109 // Optionally adjust centre to accommodate deviations in the
110 // effective radius to the end-points
111 void calcFromCentre
112 (
113 const point& p1,
114 const point& p3,
115 const point& centre,
116 bool adjustCentre = false,
117 scalar rMultiplier = 1
118 );
119
120 //- No copy construct
121 arcEdge(const arcEdge&) = delete;
122
123 //- No copy assignment
124 void operator=(const arcEdge&) = delete;
125
126
127public:
128
129 //- Runtime type information
130 TypeName("arc");
131
132
133 // Constructors
134
135 //- Construct from components, given the origin of the circle
136 arcEdge
137 (
138 const pointField& points,
139 const point& origin,
140 const edge& fromTo
141 );
142
143 //- Construct from components, using a point on the circumference
144 arcEdge
145 (
146 const pointField& points,
147 const edge& fromTo,
148 const point& midPoint
149 );
150
151 //- Construct from components, given the origin of the circle
152 arcEdge
153 (
154 const pointField& points,
155 const point& origin,
156 const label from,
157 const label to
158 );
159
160 //- Construct from components, using a point on the circumference
161 arcEdge
162 (
163 const pointField& points,
164 const label from,
165 const label to,
166 const point& midPoint
167 );
168
169 //- Construct from Istream and point field.
170 // The Istream can specify either a point on the circumference,
171 // or with a tag to specify the origin.
172 arcEdge
173 (
174 const dictionary& dict,
175 const label index,
176 const searchableSurfaces& /*unused*/,
177 const pointField& points,
178 Istream& is
179 );
180
181
182 //- Destructor
183 virtual ~arcEdge() = default;
184
185
186 // Member Functions
187
188 //- The point corresponding to the curve parameter [0-1]
189 point position(const scalar lambda) const;
190
191 //- The length of the curve
192 scalar length() const noexcept;
193};
194
195
196// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198} // End namespace blockEdges
199} // End namespace Foam
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202
203#endif
204
205// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:64
A blockEdge defined as an arc of a circle.
Definition: arcEdge.H:82
virtual ~arcEdge()=default
Destructor.
TypeName("arc")
Runtime type information.
point position(const scalar lambda) const
The point corresponding to the curve parameter [0-1].
Definition: arcEdge.C:308
scalar length() const noexcept
The length of the curve.
Definition: arcEdge.C:331
A cylindrical coordinate system (r-theta-z). The coordinate system angle theta is always in radians.
Definition: cylindricalCS.H:74
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
Mid-point interpolation (weighting factors = 0.5) scheme class.
Definition: midPoint.H:58
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
const pointField & points
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
dictionary dict
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73