Loading...
Searching...
No Matches
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,2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::cellDistFuncs
29
30Description
31 Collection of functions used in wall distance calculation.
32
33SourceFiles
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
52namespace Foam
53{
54
55// Forward declaration of classes
56class polyMesh;
57class polyPatch;
60/*---------------------------------------------------------------------------*\
61 Class cellDistFuncs Declaration
62\*---------------------------------------------------------------------------*/
63
64class 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
80public:
81
82 // Static Data Members
83
84 ClassName("cellDistFuncs");
86
87 //- Use combined-wall-patches wall distance v.s. v2406 per-patch
88 //- distance. Default is true
89 static bool useCombinedWallPatch;
90
91
92 // Constructors
93
94 //- Construct from mesh
95 cellDistFuncs(const polyMesh& mesh);
96
97
98 // Member Functions
99
100 //- Access mesh
101 const polyMesh& mesh() const
102 {
103 return mesh_;
104 }
105
106 //- Return the set of patch IDs corresponding to the given names
109 //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
110 // Uses isA, not isType
111 template<class Type>
113
114 //- Calculate smallest true distance (and patch face index)
115 // from pt to faces wallFaces.
116 template<class PatchType>
117 scalar smallestDist
118 (
119 const point& p,
120 const PatchType& patch,
121 const labelUList& wallFaces,
122 label& patchFacei
123 ) const;
125 //- Get faces sharing point with face on patch
126 template<class PatchType>
128 (
129 const PatchType&,
130 const label patchFacei,
132 ) const;
133
134 //- Size of largest patch (out of supplied subset of patches)
135 label maxPatchSize(const labelHashSet& patchIDs) const;
136
137 //- Sum of patch sizes (out of supplied subset of patches).
138 // Used in sizing arrays.
139 label sumPatchSize(const labelHashSet& patchIDs) const;
140
141 //- Correct all cells connected to boundary (via face). Sets values in
142 // wallDistCorrected. Sets nearest wallface in nearestFace.
144 (
145 const labelHashSet& patchIDs,
146 scalarField& wallDistCorrected,
147 Map<label>& nearestFace
148 ) const;
149
150 //- Correct all cells connected to wall (via point). Sets values in
151 // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
153 (
154 const labelHashSet& patchIDs,
155 scalarField& wallDistCorrected,
156 Map<label>& nearestFace
157 ) const;
158
159 //- Correct all cells connected to any of the patches in patchIDs. Sets
160 // - cell values in wallDistCorrected
161 // - (mesh) face that contains the nearest point
163 (
164 const labelList& patchIDs,
165 const bool doPointCells,
166 scalarField& wallDistCorrected,
167 Map<label>& nearestFace
168 ) const;
169};
170
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174} // End namespace Foam
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178#ifdef NoRepository
179 #include "cellDistFuncsTemplates.C"
180#endif
181
182// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183
184#endif
185
186// ************************************************************************* //
labelList patchIDs
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
A HashTable to objects of type <T> with a label key.
Definition Map.H:54
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
label maxPatchSize(const labelHashSet &patchIDs) const
Size of largest patch (out of supplied subset of patches).
label sumPatchSize(const labelHashSet &patchIDs) const
Sum of patch sizes (out of supplied subset of patches).
labelHashSet getPatchIDs() const
Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch').
const polyMesh & mesh() const
Access mesh.
void correctBoundaryFaceCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to boundary (via face). Sets values in.
scalar smallestDist(const point &p, const PatchType &patch, const labelUList &wallFaces, label &patchFacei) const
Calculate smallest true distance (and patch face index).
ClassName("cellDistFuncs")
void getPointNeighbours(const PatchType &, const label patchFacei, DynamicList< label > &) const
Get faces sharing point with face on patch.
void correctBoundaryCells(const labelList &patchIDs, const bool doPointCells, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to any of the patches in patchIDs. Sets.
void correctBoundaryPointCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to wall (via point). Sets values in.
static bool useCombinedWallPatch
Use combined-wall-patches wall distance v.s. v2406 per-patch distance. Default is true.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
Macro definitions for declaring ClassName(), NamespaceName(), etc.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
volScalarField & p
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
vector point
Point is a vector.
Definition point.H:37
UList< label > labelUList
A UList of labels.
Definition UList.H:75
wordList patchNames(nPatches)