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