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-------------------------------------------------------------------------------
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;
58class polyBoundaryMesh;
59
60/*---------------------------------------------------------------------------*\
61 Class cellDistFuncs Declaration
62\*---------------------------------------------------------------------------*/
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:
82 ClassName("cellDistFuncs");
83
84 // Constructors
85
86 //- Construct from 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>
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
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// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
A HashTable to objects of type <T> with a label key.
Definition: Map.H:60
A list of faces which address into the list of points.
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:94
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:64
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.
Definition: cellDistFuncs.H:92
void correctBoundaryFaceCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to boundary (via face). Sets values in.
ClassName("cellDistFuncs")
void getPointNeighbours(const primitivePatch &, const label patchFacei, DynamicList< label > &) const
Get faces sharing point with face on patch.
Definition: cellDistFuncs.C:94
void correctBoundaryPointCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to wall (via point). Sets values in.
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
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
Macro definitions for declaring ClassName(), NamespaceName(), etc.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
volScalarField & p
Namespace for OpenFOAM.
wordList patchNames(nPatches)