patchEdgeSet.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) 2019-2020 OpenCFD Ltd.
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::patchEdgeSet
28 
29 Description
30  Like Foam::uniformSet but samples patch edges
31 
32 Usage
33  Example of function object specification:
34  \verbatim
35  sets
36  {
37  type sets;
38  libs (sampling);
39  writeControl timeStep;
40  writeInterval 1;
41 
42  fields (p U);
43  interpolationScheme cellPoint;
44  setFormat vtk;
45 
46  sets
47  (
48  // Intersections of patches with plane
49  patchEdge
50  {
51  type patchEdge;
52  axis x;
53 
54  // List of patches to sample (into single file). Note: supports
55  // wildcards.
56  patches (movingWall);
57 
58  // Surface type
59  surfaceType searchablePlane;
60  // Additional info for surface
61  planeType pointAndNormal;
62  pointAndNormalDict
63  {
64  point (1.5 1.5 1.5);
65  normal (0.1 0 1);
66  }
67 
68  // Sort point according to distance to origin
69  origin (0 1 0);
70  }
71 
72  // Intersections of patches with stl
73  sphere.stl
74  {
75  type patchEdge;
76  axis x;
77 
78  patches (movingWall);
79 
80  surfaceType triSurfaceMesh;
81  // Sort point according to distance to origin
82  origin (0 1 0);
83  }
84  );
85  }
86  \endverbatim
87 
88  Where the entries comprise:
89  \table
90  Property | Description | Required | Default
91  type | patchEdge | yes |
92  axis | x, y, z, xyz, distance | yes |
93  patches | List of patch names or regexs | yes |
94  surfaceType | Definition of the surface | yes |
95  origin | reference location | yes |
96  \endtable
97 
98 Note
99  - The ordering of the points is according to the distance to the specified
100  origin.
101  - Collocated points get merged if closer than SMALL (1e-15 in double prec).
102  (hardcoded). Collocated points can occur if patch points are exactly
103  on the sampling plane. Note that (in parallel) any point merging gets
104  done locally before sending to the master.
105 
106 SourceFiles
107  patchEdgeSet.C
108 
109 \*---------------------------------------------------------------------------*/
110 
111 #ifndef patchEdgeSet_H
112 #define patchEdgeSet_H
113 
114 #include "sampledSet.H"
115 #include "DynamicList.H"
116 #include "HashSet.H"
117 #include "plane.H"
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 namespace Foam
122 {
123 
124 class searchableSurface;
125 
126 /*---------------------------------------------------------------------------*\
127  Class patchEdgeSet Declaration
128 \*---------------------------------------------------------------------------*/
129 
130 class patchEdgeSet
131 :
132  public sampledSet
133 {
134  // Private data
135 
136  //- The surface
137  const autoPtr<searchableSurface> surfPtr_;
138 
139  //- Reference point
140  const point origin_;
141 
142  //- Patches to sample
143  const labelHashSet patchSet_;
144 
145 
146  // Private Member Functions
147 
148  //- Samples all points in sampleCoords.
149  void calcSamples
150  (
151  DynamicList<point>& samplingPts,
152  DynamicList<label>& samplingCells,
153  DynamicList<label>& samplingFaces,
154  DynamicList<label>& samplingSegments,
155  DynamicList<scalar>& samplingCurveDist
156  ) const;
157 
158  //- Uses calcSamples to obtain samples. Copies them into *this.
159  void genSamples();
160 
161 
162 public:
163 
164  //- Runtime type information
165  TypeName("patchEdge");
166 
167 
168  // Constructors
169 
170  //- Construct from dictionary
172  (
173  const word& name,
174  const polyMesh& mesh,
175  const meshSearch& searchEngine,
176  const dictionary& dict
177  );
178 
179 
180  //- Destructor
181  virtual ~patchEdgeSet() = default;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Foam::sampledSet
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:83
Foam::coordSet::name
const word & name() const
Definition: coordSet.H:125
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::meshSearch
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Definition: meshSearch.H:60
Foam::patchEdgeSet
Like Foam::uniformSet but samples patch edges.
Definition: patchEdgeSet.H:159
Foam::DynamicList< point >
Foam::sampledSet::searchEngine
const meshSearch & searchEngine() const
Definition: sampledSet.H:286
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
sampledSet.H
plane.H
HashSet.H
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:123
Foam::patchEdgeSet::TypeName
TypeName("patchEdge")
Runtime type information.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::sampledSet::mesh
const polyMesh & mesh() const
Definition: sampledSet.H:281
Foam::Vector< scalar >
Foam::patchEdgeSet::~patchEdgeSet
virtual ~patchEdgeSet()=default
Destructor.
DynamicList.H
Foam::patchEdgeSet::patchEdgeSet
patchEdgeSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: patchEdgeSet.C:195
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition: HashSet.H:85