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-2020 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 Class
28  Foam::blockEdges::arcEdge
29 
30 Description
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 
58 SourceFiles
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 
71 namespace Foam
72 {
73 namespace blockEdges
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class arcEdge Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class 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 
127 public:
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 label start,
141  const label end
142  );
143 
144  //- Construct from components, using a point on the circumference
145  arcEdge
146  (
147  const pointField& points,
148  const label start,
149  const label end,
150  const point& midPoint
151  );
152 
153  //- Construct from Istream and point field.
154  // The Istream can specify either a point on the circumference,
155  // or with a tag to specify the origin.
156  arcEdge
157  (
158  const dictionary& dict,
159  const label index,
160  const searchableSurfaces& geometry, // unsed
161  const pointField& points,
162  Istream& is
163  );
164 
165 
166  //- Destructor
167  virtual ~arcEdge() = default;
168 
169 
170  // Member Functions
171 
172  //- The point corresponding to the curve parameter [0-1]
173  point position(const scalar lambda) const;
174 
175  //- The length of the curve
176  scalar length() const noexcept;
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace blockEdges
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
Foam::blockEdges::arcEdge::~arcEdge
virtual ~arcEdge()=default
Destructor.
Foam::blockEdge::end
label end() const
Index of end point.
Definition: blockEdgeI.H:36
Foam::blockEdges::arcEdge::length
scalar length() const noexcept
The length of the curve.
Definition: arcEdge.C:309
Foam::midPoint
Mid-point interpolation (weighting factors = 0.5) scheme class.
Definition: midPoint.H:55
Foam::blockEdges::arcEdge::TypeName
TypeName("arc")
Runtime type information.
Foam::blockEdge
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:62
Foam::Field< vector >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::blockEdge::start
label start() const
Index of start point.
Definition: blockEdgeI.H:30
cylindricalCS.H
Foam::coordSystem::cylindrical
A cylindrical coordinate system (r-theta-z). The coordinate system angle theta is always in radians.
Definition: cylindricalCS.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::blockEdges::arcEdge::position
point position(const scalar lambda) const
The point corresponding to the curve parameter [0-1].
Definition: arcEdge.C:286
lambda
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Vector< scalar >
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::blockEdges::arcEdge
A blockEdge defined as an arc of a circle.
Definition: arcEdge.H:79
blockEdge.H