cellDistFuncs.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) 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 Class
28  Foam::cellDistFuncs
29 
30 Description
31  Collection of functions used in wall distance calculation.
32 
33 SourceFiles
34  cellDistFuncs.C
35  cellDistFuncsTemplates.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef cellDistFuncs_H
40 #define cellDistFuncs_H
41 
42 #include "HashSet.H"
43 #include "Map.H"
44 #include "wordRe.H"
45 #include "scalarField.H"
46 #include "point.H"
47 #include "primitivePatch.H"
48 #include "className.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class polyMesh;
57 class polyPatch;
58 class polyBoundaryMesh;
59 
60 /*---------------------------------------------------------------------------*\
61  Class cellDistFuncs Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class cellDistFuncs
65 {
66  // Private Member Data
67 
68  //- Reference to mesh
69  const polyMesh& mesh_;
70 
71 
72  // Private Member Functions
73 
74  //- No copy construct
75  cellDistFuncs(const cellDistFuncs&) = delete;
76 
77  //- No copy assignment
78  void operator=(const cellDistFuncs&) = delete;
79 
80 public:
81 
82  ClassName("cellDistFuncs");
83 
84  // Constructors
85 
86  //- Construct from mesh
87  cellDistFuncs(const polyMesh& mesh);
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 labelUList& wallFaces,
115  label& meshFacei
116  ) const;
117 
118  //- Get faces sharing point with face on patch
119  void getPointNeighbours
120  (
121  const primitivePatch&,
122  const label patchFacei,
124  ) const;
125 
126  //- Size of largest patch (out of supplied subset of patches)
127  label maxPatchSize(const labelHashSet& patchIDs) const;
128 
129  //- Sum of patch sizes (out of supplied subset of patches).
130  // Used in sizing arrays.
131  label sumPatchSize(const labelHashSet& patchIDs) const;
132 
133  //- Correct all cells connected to boundary (via face). Sets values in
134  // wallDistCorrected. Sets nearest wallface in nearestFace.
136  (
137  const labelHashSet& patchIDs,
138  scalarField& wallDistCorrected,
139  Map<label>& nearestFace
140  ) const;
141 
142  //- Correct all cells connected to wall (via point). Sets values in
143  // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
145  (
146  const labelHashSet& patchIDs,
147  scalarField& wallDistCorrected,
148  Map<label>& nearestFace
149  ) const;
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160  #include "cellDistFuncsTemplates.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
scalarField.H
Foam::DynamicList< label >
point.H
Foam::cellDistFuncs::maxPatchSize
label maxPatchSize(const labelHashSet &patchIDs) const
Size of largest patch (out of supplied subset of patches)
Definition: cellDistFuncs.C:189
Foam::Map< label >
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::cellDistFuncs::correctBoundaryPointCells
void correctBoundaryPointCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to wall (via point). Sets values in.
Definition: cellDistFuncs.C:278
Map.H
Foam::Field< scalar >
Foam::cellDistFuncs::getPatchIDs
labelHashSet getPatchIDs() const
Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
wordRe.H
className.H
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Foam::cellDistFuncs::sumPatchSize
label sumPatchSize(const labelHashSet &patchIDs) const
Sum of patch sizes (out of supplied subset of patches).
Definition: cellDistFuncs.C:210
patchNames
wordList patchNames(nPatches)
HashSet.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellDistFuncs::mesh
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:92
Foam::cellDistFuncs::smallestDist
scalar smallestDist(const point &p, const polyPatch &patch, const labelUList &wallFaces, label &meshFacei) const
Calculate smallest true distance (and face index)
Definition: cellDistFuncs.C:63
Foam::cellDistFuncs
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:63
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::cellDistFuncs::correctBoundaryFaceCells
void correctBoundaryFaceCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to boundary (via face). Sets values in.
Definition: cellDistFuncs.C:232
Foam::cellDistFuncs::ClassName
ClassName("cellDistFuncs")
cellDistFuncsTemplates.C
Foam::cellDistFuncs::getPointNeighbours
void getPointNeighbours(const primitivePatch &, const label patchFacei, DynamicList< label > &) const
Get faces sharing point with face on patch.
Definition: cellDistFuncs.C:94
primitivePatch.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79