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