blockEdge.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) 2019 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::blockEdge
29 
30 Description
31  Define a curved edge that is parameterized for 0<lambda<1
32  between the start and end point.
33 
34 SourceFiles
35  blockEdge.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef blockEdge_H
40 #define blockEdge_H
41 
42 #include "searchableSurfaces.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of friend functions and operators
50 
51 class blockEdge;
52 
53 Ostream& operator<<(Ostream&, const blockEdge&);
54 
55 
56 /*---------------------------------------------------------------------------*\
57  Class blockEdge Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class blockEdge
61 {
62 protected:
63 
64  // Protected data
65 
66  const pointField& points_;
67 
68  const label start_;
69  const label end_;
70 
71 
72  // Protected Member Functions
73 
74  //- Return a complete point field by appending the start/end points
75  // to the given list
77  (
78  const pointField&,
79  const label start,
80  const label end,
81  const pointField& otherKnots
82  );
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("blockEdge");
89 
90  // Declare run-time constructor selection tables
91 
93  (
94  autoPtr,
95  blockEdge,
96  Istream,
97  (
98  const dictionary& dict,
99  const label index,
100  const searchableSurfaces& geometry,
101  const pointField& points,
102  Istream& is
103  ),
104  (dict, index, geometry, points, is)
105  );
106 
107 
108  // Constructors
109 
110  //- Construct from components
111  blockEdge
112  (
113  const pointField& points,
114  const label start,
115  const label end
116  );
117 
118  //- Construct from Istream setting pointsList
119  blockEdge
120  (
121  const dictionary& dict,
122  const label index,
123  const pointField&,
124  Istream&
125  );
126 
127  //- Clone function
128  virtual autoPtr<blockEdge> clone() const;
129 
130  //- New function which constructs and returns pointer to a blockEdge
131  static autoPtr<blockEdge> New
132  (
133  const dictionary& dict,
134  const label index,
135  const searchableSurfaces& geometry,
136  const pointField&,
137  Istream&
138  );
139 
140  //- Class used for the read-construction of
141  // PtrLists of blockEdge
142  class iNew
143  {
144  const dictionary& dict_;
145  const searchableSurfaces& geometry_;
146  const pointField& points_;
147  mutable label index_;
148 
149  public:
150 
152  (
153  const dictionary& dict,
154  const searchableSurfaces& geometry,
155  const pointField& points
156  )
157  :
158  dict_(dict),
159  geometry_(geometry),
160  points_(points),
161  index_(0)
162  {}
163 
165  {
166  return blockEdge::New(dict_, index_++, geometry_, points_, is);
167  }
168  };
169 
170 
171  //- Destructor
172  virtual ~blockEdge() = default;
173 
174 
175  // Member Functions
176 
177  //- Return label of start point
178  inline label start() const;
179 
180  //- Return label of end point
181  inline label end() const;
182 
183  //- Compare the given start and end points with this curve
184  // Return:
185  // - 0: different
186  // - +1: identical
187  // - -1: same edge, but different orientation
188  inline int compare(const blockEdge&) const;
189 
190  //- Compare the given start and end points with this curve
191  // Return:
192  // - 0: different
193  // - +1: identical
194  // - -1: same edge, but different orientation
195  inline int compare(const edge&) const;
196 
197  //- Compare the given start and end points with this curve
198  // Return:
199  // - 0: different
200  // - +1: identical
201  // - -1: same edge, but different orientation
202  inline int compare(const label start, const label end) const;
203 
204  //- Return the point position corresponding to the curve parameter
205  // 0 <= lambda <= 1
206  virtual point position(const scalar) const = 0;
207 
208  //- Return the point positions corresponding to the curve parameters
209  // 0 <= lambda <= 1
210  virtual tmp<pointField> position(const scalarList&) const;
211 
212  //- Return the length of the curve
213  virtual scalar length() const = 0;
214 
215  //- Write edge with variable backsubstitution
216  void write(Ostream&, const dictionary&) const;
217 
218 
219  // Ostream operator
220 
221  friend Ostream& operator<<(Ostream&, const blockEdge&);
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #include "blockEdgeI.H"
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
Foam::blockEdge::TypeName
TypeName("blockEdge")
Runtime type information.
Foam::blockEdge::end
label end() const
Return label of end point.
Definition: blockEdgeI.H:36
Foam::blockEdge::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: blockEdge.C:110
Foam::blockEdge::iNew::iNew
iNew(const dictionary &dict, const searchableSurfaces &geometry, const pointField &points)
Definition: blockEdge.H:151
blockEdgeI.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::blockEdge::compare
int compare(const blockEdge &) const
Compare the given start and end points with this curve.
Definition: blockEdgeI.H:59
Foam::blockEdge::blockEdge
blockEdge(const pointField &points, const label start, const label end)
Construct from components.
Definition: blockEdge.C:44
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
Foam::blockEdge::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, blockEdge, Istream,(const dictionary &dict, const label index, const searchableSurfaces &geometry, const pointField &points, Istream &is),(dict, index, geometry, points, is))
Foam::blockEdge
Define a curved edge that is parameterized for 0<lambda<1 between the start and end point.
Definition: blockEdge.H:59
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
searchableSurfaces.H
Foam::blockEdge::~blockEdge
virtual ~blockEdge()=default
Destructor.
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::points_
const pointField & points_
Definition: blockEdge.H:65
Foam::blockEdge::start
label start() const
Return label of start point.
Definition: blockEdgeI.H:30
Foam::blockEdge::iNew::operator()
autoPtr< blockEdge > operator()(Istream &is) const
Definition: blockEdge.H:163
Foam::blockEdge::length
virtual scalar length() const =0
Return the length of the curve.
Foam::blockEdge::start_
const label start_
Definition: blockEdge.H:67
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
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::blockEdge::end_
const label end_
Definition: blockEdge.H:68
Foam::blockEdge::operator<<
friend Ostream & operator<<(Ostream &, const blockEdge &)
Foam::blockEdge::New
static autoPtr< blockEdge > New(const dictionary &dict, const label index, const searchableSurfaces &geometry, const pointField &, Istream &)
New function which constructs and returns pointer to a blockEdge.
Definition: blockEdge.C:78
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::blockEdge::iNew
Class used for the read-construction of.
Definition: blockEdge.H:141
Foam::Vector< scalar >
Foam::List< scalar >
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
Foam::blockEdge::clone
virtual autoPtr< blockEdge > clone() const
Clone function.
Definition: blockEdge.C:70
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::blockEdge::write
void write(Ostream &, const dictionary &) const
Write edge with variable backsubstitution.
Definition: blockEdge.C:147
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::blockEdge::position
virtual point position(const scalar) const =0
Return the point position corresponding to the curve parameter.