FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/edge.H>
40 #include <OpenFOAM/pointField.H>
41 #include <OpenFOAM/typeInfo.H>
42 #include <OpenFOAM/HashTable.H>
43 #include <OpenFOAM/autoPtr.H>
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class curvedEdge Declaration
52 \*---------------------------------------------------------------------------*/
53 
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 
122  virtual ~curvedEdge(){}
123 
124 
125  // Member Functions
126 
127  //- Return label of start point
128  inline label start() const;
129 
130  //- Return label of end point
131  inline label end() const;
132 
133  //- Compare the given start and end points with this curve
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  // - 0: different
141  // - +1: identical
142  // - -1: same edge, but different orientation
143  inline int compare(const edge&) const;
144 
145  //- Compare the given start and end points with this curve
146  // - 0: different
147  // - +1: identical
148  // - -1: same edge, but different orientation
149  inline int compare(const label start, const label end) const;
150 
151  //- Return the point position corresponding to the curve parameter
152  // 0 <= lambda <= 1
153  virtual point position(const scalar) const = 0;
154 
155  //- Return the length of the curve
156  virtual scalar length() const = 0;
157 
158 
159  // Member operators
160 
161  void operator=(const curvedEdge&);
162 
163  // Ostream operator
164 
165  friend Ostream& operator<<(Ostream&, const curvedEdge&);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #include "curvedEdgeI.H"
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************ vim: set sw=4 sts=4 et: ************************ //