arcEdge.H 5.9 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
OpenFOAM bot's avatar
OpenFOAM bot committed
5
    \\  /    A nd           | www.openfoam.com
OpenFOAM bot's avatar
OpenFOAM bot committed
6
7
     \\/     M anipulation  |
-------------------------------------------------------------------------------
OpenFOAM bot's avatar
OpenFOAM bot committed
8
    Copyright (C) 2011-2016 OpenFOAM Foundation
9
    Copyright (C) 2017-2020 OpenCFD Ltd.
10
11
12
13
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

14
15
16
17
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
18
19
20
21
22
23
24

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    A blockEdge defined as an arc of a circle.

    The arc is normally defined by its endpoints and a point on
    its circumference, typically a midpoint. For example,
    \verbatim
    points ((1 0 0) (0 1 0));

    arc 0 1 (0.707107 0.707107 0);
    \endverbatim
    The arc can enclose an angle greater than 0 and less than 360 degrees.

    The arc will frequently enclose an angle less than 180 degrees.
    For the case, it is possible to define the arc by its endpoints and its
    centre (origin) point. For example,
    \verbatim
    arc 0 1 origin (0 0 0);
    \endverbatim
    When defined in the way, any discrepancy in the arc radius for the
    endpoints is resolved by adjusting the origin to ensure that the average
    radius is satisfied.

    It is also possible to define a \em flatness factor as a multiplier of
    the calculated radius. For example,
    \verbatim
    arc 0 1 origin 1.1 (0 0 0);
    \endverbatim
57
58
59
60
61
62

SourceFiles
    arcEdge.C

\*---------------------------------------------------------------------------*/

63
64
#ifndef blockEdges_arcEdge_H
#define blockEdges_arcEdge_H
65

66
#include "blockEdge.H"
67
68
69
70
71
72
#include "cylindricalCS.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
73
74
namespace blockEdges
{
75
76
77
78
79
80
81

/*---------------------------------------------------------------------------*\
                           Class arcEdge Declaration
\*---------------------------------------------------------------------------*/

class arcEdge
:
82
    public blockEdge
83
{
84
    // Private Data
85
86

        //- The arc radius
87
        scalar radius_;
88

89
90
91
        //- The arc angle (radians)
        scalar angle_;

92
        //- The local cylindrical coordinate system
93
        coordSystem::cylindrical cs_;
94

95

96
97
    // Private Member Functions

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
        //- Calculate angle, radius, cylindrical coordinate system
        //- from end points and the given point on the circumference
        void calcFromMidPoint
        (
            const point& p1,        //!< Start point
            const point& p3,        //!< End point
            const point& p2         //!< Point on circumference
        );

        //- Calculate angle, radius, cylindrical coordinate system
        //- from end points and the given origin.
        //  Optionally adjust centre to accommodate deviations in the
        //  effective radius to the end-points
        void calcFromCentre
        (
            const point& p1,        //!< Start point
            const point& p3,        //!< End point
            const point& centre,    //!< Centre
            bool adjustCentre = false,  //!< Adjust centre
            scalar rMultiplier = 1      //!< Adjust radius by this factor
        );
119

120
121
        //- No copy construct
        arcEdge(const arcEdge&) = delete;
122

123
124
        //- No copy assignment
        void operator=(const arcEdge&) = delete;
125

126

127
128
129
130
131
132
133
134
public:

    //- Runtime type information
    TypeName("arc");


    // Constructors

135
136
137
138
139
140
141
142
143
144
        //- Construct from components, given the origin of the circle
        arcEdge
        (
            const pointField& points,   //!< Referenced point field
            const point& origin,    //!< The origin of the circle
            const label start,      //!< Start point in referenced point field
            const label end         //!< End point in referenced point field
        );

        //- Construct from components, using a point on the circumference
145
146
        arcEdge
        (
147
148
149
150
            const pointField& points,   //!< Referenced point field
            const label start,      //!< Start point in referenced point field
            const label end,        //!< End point in referenced point field
            const point& midPoint   //!< A point on the circumference
151
152
        );

153
154
155
        //- Construct from Istream and point field.
        //  The Istream can specify either a point on the circumference,
        //  or with a tag to specify the origin.
156
157
        arcEdge
        (
158
159
            const dictionary& dict,
            const label index,
160
161
162
            const searchableSurfaces& geometry, // unsed
            const pointField& points,   //!< Referenced point field
            Istream& is
163
        );
164
165


166
    //- Destructor
167
    virtual ~arcEdge() = default;
168
169
170
171


    // Member Functions

172
173
        //- The point corresponding to the curve parameter [0-1]
        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
184
185
186
187
188
189
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //