cellDistFuncs.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-2019 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::cellDistFuncs
26 
27 Description
28  Collection of functions used in wall distance calculation.
29 
30 SourceFiles
31  cellDistFuncs.C
32  cellDistFuncsTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef cellDistFuncs_H
37 #define cellDistFuncs_H
38 
39 #include "scalarField.H"
40 #include "HashSet.H"
41 #include "Map.H"
42 #include "wordReList.H"
43 #include "scalarField.H"
44 #include "point.H"
45 #include "primitivePatch.H"
46 #include "className.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of classes
54 class polyMesh;
55 class polyPatch;
56 class polyBoundaryMesh;
57 
58 /*---------------------------------------------------------------------------*\
59  Class cellDistFuncs Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class cellDistFuncs
63 {
64  // Private Member Data
65 
66  //- Reference to mesh
67  const polyMesh& mesh_;
68 
69 
70  // Private Member Functions
71 
72  //- Search for element in first n elements of labelList. Return index
73  // or -1.
74  static label findIndex(const label n, const labelList&, const label);
75 
76 
77 public:
78 
79  ClassName("cellDistFuncs");
80 
81  // Constructors
82 
83  //- Construct from mesh
84  cellDistFuncs(const polyMesh& mesh);
85 
86  //- Disallow default bitwise copy construction
87  cellDistFuncs(const cellDistFuncs&) = delete;
88 
89 
90  // Member Functions
91 
92  //- Access mesh
93  const polyMesh& mesh() const
94  {
95  return mesh_;
96  }
97 
98  //- Return the set of patch IDs corresponding to the given names
100 
101  //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
102  // Uses isA, not isType
103  template<class Type>
104  labelHashSet getPatchIDs() const;
105 
106  //- Calculate smallest true distance (and face index)
107  // from pt to faces wallFaces.
108  // For efficiency reasons we still pass in patch instead of extracting
109  // it from mesh_
110  scalar smallestDist
111  (
112  const point& p,
113  const polyPatch& patch,
114  const label nWallFaces,
115  const labelList& wallFaces,
116  label& meshFacei
117  ) const;
118 
119  //- Get faces sharing point with face on patch
121  (
122  const primitivePatch&,
123  const label patchFacei,
124  labelList&
125  ) const;
126 
127  //- Size of largest patch (out of supplied subset of patches)
128  label maxPatchSize(const labelHashSet& patchIDs) const;
129 
130  //- Sum of patch sizes (out of supplied subset of patches).
131  // Used in sizing arrays.
132  label sumPatchSize(const labelHashSet& patchIDs) const;
133 
134  //- Correct all cells connected to boundary (via face). Sets values in
135  // wallDistCorrected. Sets nearest wallface in nearestFace.
137  (
138  const labelHashSet& patchIDs,
139  scalarField& wallDistCorrected,
140  Map<label>& nearestFace
141  ) const;
142 
143 
144  //- Correct all cells connected to wall (via point). Sets values in
145  // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
147  (
148  const labelHashSet& patchIDs,
149  scalarField& wallDistCorrected,
150  Map<label>& nearestFace
151  ) const;
152 
153 
154  // Member Operators
155 
156  //- Disallow default bitwise assignment
157  void operator=(const cellDistFuncs&) = delete;
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #ifdef NoRepository
168  #include "cellDistFuncsTemplates.C"
169 #endif
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
labelHashSet getPatchIDs() const
Get patchIDs of/derived off certain type (e.g. &#39;processorPolyPatch&#39;)
label sumPatchSize(const labelHashSet &patchIDs) const
Sum of patch sizes (out of supplied subset of patches).
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
void operator=(const cellDistFuncs &)=delete
Disallow default bitwise assignment.
label getPointNeighbours(const primitivePatch &, const label patchFacei, labelList &) const
Get faces sharing point with face on patch.
void correctBoundaryFaceCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to boundary (via face). Sets values in.
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:61
A list of faces which address into the list of points.
cellDistFuncs(const polyMesh &mesh)
Construct from mesh.
Definition: cellDistFuncs.C:62
wordList patchNames(nPatches)
void correctBoundaryPointCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to wall (via point). Sets values in.
label maxPatchSize(const labelHashSet &patchIDs) const
Size of largest patch (out of supplied subset of patches)
scalar smallestDist(const point &p, const polyPatch &patch, const label nWallFaces, const labelList &wallFaces, label &meshFacei) const
Calculate smallest true distance (and face index)
Definition: cellDistFuncs.C:83
label nWallFaces(0)
Macro definitions for declaring ClassName(), NamespaceName(), etc.
label n
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
volScalarField & p
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:92
Namespace for OpenFOAM.
ClassName("cellDistFuncs")