polyline.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) 2020 Ivor Clifford/Paul Scherrer Institut
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::extrudeModels::polyline
28 
29 Description
30  Extrudes by transforming points along a polyline provided as a
31  series of points and edge segments. Supports all blockMesh edge
32  types, e.g. line, arc, spline. The surface points are rotated to
33  follow the path.
34 
35  \table
36  Property | Description | Required | Default
37  vertices | List of vertices | yes |
38  edges | List of blockEdge segments | yes |
39  toleranceCheck | Relative tolerance for polyline checks | no | SMALL
40  \endtable
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef polyline_H
45 #define polyline_H
46 
47 #include "extrudeModel.H"
48 #include "blockEdgeList.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 namespace extrudeModels
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class polyline Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class polyline
62 :
63  public extrudeModel
64 {
65  // Private Data
66 
67  //- Dummy object needed to use blockEdge
68  searchableSurfaces geometry_;
69 
70  //- List of points
71  pointField vertices_;
72 
73  //- List of line segments
74  blockEdgeList segments_;
75 
76  //- Relative length along all segments for interplation (0 <= x <= 1)
77  scalarField x_;
78 
79  //- Relative position on segments for interpolation
80  //- (0 <= y <= segments_.size())
81  scalarField y_;
82 
83  //- Position vector at start of polyline
84  vector p0_;
85 
86  //- Direction vector at start of polyline
87  vector n0_;
88 
89  //- Relative tolerance for checking alignment of polyline and surface
90  scalar relTol_;
91 
92  //- Small delta for numerical differencing
93  const scalar DELTA = 1e-6;
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("polyline");
99 
100 
101  // Constructors
102 
103  //- Construct from dictionary
104  explicit polyline(const dictionary& dict);
105 
106 
107  //- Destructor
108  virtual ~polyline() = default;
109 
110 
111  // Member Operators
112 
113  point operator()
114  (
115  const point& surfacePoint,
116  const vector& surfaceNormal,
117  const label layer
118  ) const;
119 
120  //- The point and direction vector corresponding to the polyline
121  //- parameter [0-1]
123  (
124  const scalar lambda,
125  vector& p,
126  vector& n
127  ) const;
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace extrudeModels
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::extrudeModel
Top level extrusion model class.
Definition: extrudeModel.H:76
Foam::extrudeModels::polyline
Extrudes by transforming points along a polyline provided as a series of points and edge segments....
Definition: polyline.H:80
Foam::blockEdgeList
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.
Definition: blockEdgeList.H:47
Foam::extrudeModels::polyline::~polyline
virtual ~polyline()=default
Destructor.
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field< vector >
blockEdgeList.H
extrudeModel.H
Foam::PtrList< blockEdge >
Foam::extrudeModels::polyline::polyline
polyline(const dictionary &dict)
Construct from dictionary.
Definition: polyline.C:49
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
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::extrudeModels::polyline::TypeName
TypeName("polyline")
Runtime type information.
Foam::Vector< scalar >
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::extrudeModels::polyline::positionAndDirection
void positionAndDirection(const scalar lambda, vector &p, vector &n) const
Definition: polyline.C:175