curvedEdge.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 | Copyright (C) 2011-2016 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::curvedEdge
26 
27 Description
28  Define a curved edge that is parameterized for 0<lambda<1
29  between the start and end point.
30 
31 SourceFiles
32  curvedEdge.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef curvedEdges_H
37 #define curvedEdges_H
38 
39 #include "edge.H"
40 #include "pointField.H"
41 #include "typeInfo.H"
42 #include "HashTable.H"
43 #include "autoPtr.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of friend functions and operators
51 
52 class curvedEdge;
53 
54 Ostream& operator<<(Ostream&, const curvedEdge&);
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class curvedEdge Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class curvedEdge
62 {
63 protected:
64 
65  // Protected data
66 
68  const label start_;
69  const label end_;
70 
71  // Protected Member Functions
72 
73  //- Return a complete point field by appending the start/end points
74  // to the given list
76  (
77  const pointField&,
78  const label start,
79  const label end,
80  const pointField& otherKnots
81  );
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("curvedEdge");
88 
89  // Declare run-time constructor selection tables
90 
92  (
93  autoPtr,
94  curvedEdge,
95  Istream,
96  (
97  const pointField& points,
98  Istream& is
99  ),
100  (points, is)
101  );
102 
103 
104  // Constructors
105 
106  //- Construct from components
107  curvedEdge
108  (
109  const pointField& points,
110  const label start,
111  const label end
112  );
113 
114  //- Construct from Istream setting pointsList
115  curvedEdge(const pointField&, Istream&);
116 
117  //- Copy construct
118  curvedEdge(const curvedEdge&);
119 
120  //- Clone function
121  virtual autoPtr<curvedEdge> clone() const;
122 
123  //- New function which constructs and returns pointer to a curvedEdge
124  static autoPtr<curvedEdge> New(const pointField&, Istream&);
125 
126 
127  //- Destructor
128  virtual ~curvedEdge(){}
129 
130 
131  // Member Functions
132 
133  //- Return label of start point
134  inline label start() const;
135 
136  //- Return label of end point
137  inline label end() const;
138 
139  //- Compare the given start and end points with this curve
140  // Return:
141  // - 0: different
142  // - +1: identical
143  // - -1: same edge, but different orientation
144  inline int compare(const curvedEdge&) const;
145 
146  //- Compare the given start and end points with this curve
147  // Return:
148  // - 0: different
149  // - +1: identical
150  // - -1: same edge, but different orientation
151  inline int compare(const edge&) const;
152 
153  //- Compare the given start and end points with this curve
154  // Return:
155  // - 0: different
156  // - +1: identical
157  // - -1: same edge, but different orientation
158  inline int compare(const label start, const label end) const;
159 
160  //- Return the point position corresponding to the curve parameter
161  // 0 <= lambda <= 1
162  virtual point position(const scalar) const = 0;
163 
164  //- Return the length of the curve
165  virtual scalar length() const = 0;
166 
167 
168  // Member operators
169 
170  void operator=(const curvedEdge&);
171 
172 
173  // Ostream operator
174 
175  friend Ostream& operator<<(Ostream&, const curvedEdge&);
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #include "curvedEdgeI.H"
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
static pointField appendEndPoints(const pointField &, const label start, const label end, const pointField &otherKnots)
Return a complete point field by appending the start/end points.
Definition: curvedEdge.C:109
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
curvedEdge(const pointField &points, const label start, const label end)
Construct from components.
Definition: curvedEdge.C:41
virtual autoPtr< curvedEdge > clone() const
Clone function.
Definition: curvedEdge.C:69
const label start_
Definition: curvedEdge.H:67
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
TypeName("curvedEdge")
Runtime type information.
const pointField & points_
Definition: curvedEdge.H:66
const label end_
Definition: curvedEdge.H:68
friend Ostream & operator<<(Ostream &, const curvedEdge &)
virtual point position(const scalar) const =0
Return the point position corresponding to the curve parameter.
const pointField & points
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:58
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
label end() const
Return label of end point.
Definition: curvedEdgeI.H:34
static autoPtr< curvedEdge > New(const pointField &, Istream &)
New function which constructs and returns pointer to a curvedEdge.
Definition: curvedEdge.C:77
declareRunTimeSelectionTable(autoPtr, curvedEdge, Istream,(const pointField &points, Istream &is),(points, is))
void operator=(const curvedEdge &)
Definition: curvedEdge.C:134
Ostream & operator<<(Ostream &, const ensightPart &)
int compare(const curvedEdge &) const
Compare the given start and end points with this curve.
Definition: curvedEdgeI.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Define a curved edge that is parameterized for 0<lambda<1 between the start and end point...
Definition: curvedEdge.H:60
virtual scalar length() const =0
Return the length of the curve.
Namespace for OpenFOAM.
label start() const
Return label of start point.
Definition: curvedEdgeI.H:28
virtual ~curvedEdge()
Destructor.
Definition: curvedEdge.H:127