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-2018 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  //- Disallow default bitwise copy construct
79 
80  //- Disallow default bitwise assignment
81  void operator=(const cellDistFuncs&);
82 
83 public:
84 
85  ClassName("cellDistFuncs");
86 
87  // Constructors
88 
89  //- Construct from mesh
90  cellDistFuncs(const polyMesh& mesh);
91 
92 
93  // Member Functions
94 
95  //- Access mesh
96  const polyMesh& mesh() const
97  {
98  return mesh_;
99  }
100 
101  //- Return the set of patch IDs corresponding to the given names
103 
104  //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
105  // Uses isA, not isType
106  template<class Type>
107  labelHashSet getPatchIDs() const;
108 
109  //- Calculate smallest true distance (and face index)
110  // from pt to faces wallFaces.
111  // For efficiency reasons we still pass in patch instead of extracting
112  // it from mesh_
113  scalar smallestDist
114  (
115  const point& p,
116  const polyPatch& patch,
117  const label nWallFaces,
118  const labelList& wallFaces,
119  label& meshFacei
120  ) const;
121 
122  //- Get faces sharing point with face on patch
124  (
125  const primitivePatch&,
126  const label patchFacei,
127  labelList&
128  ) const;
129 
130  //- Size of largest patch (out of supplied subset of patches)
131  label maxPatchSize(const labelHashSet& patchIDs) const;
132 
133  //- Sum of patch sizes (out of supplied subset of patches).
134  // Used in sizing arrays.
135  label sumPatchSize(const labelHashSet& patchIDs) const;
136 
137  //- Correct all cells connected to boundary (via face). Sets values in
138  // wallDistCorrected. Sets nearest wallface in nearestFace.
140  (
141  const labelHashSet& patchIDs,
142  scalarField& wallDistCorrected,
143  Map<label>& nearestFace
144  ) const;
145 
146 
147  //- Correct all cells connected to wall (via point). Sets values in
148  // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
150  (
151  const labelHashSet& patchIDs,
152  scalarField& wallDistCorrected,
153  Map<label>& nearestFace
154  ) const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #ifdef NoRepository
165  #include "cellDistFuncsTemplates.C"
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
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
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.
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:95
Namespace for OpenFOAM.
ClassName("cellDistFuncs")