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